GitLab Runner is a lightweight and highly scalable agent that runs various CI jobs defined in GitLab CI/CD pipelines and, once completed, sends the results back to the GitLab instance. Therefore, it is highly recommended that GitLab Runner should be configured correctly.
This article will explore the commands to help check and verify your GitLab Runner configuration.
Check GitLab Runner Status
Well, before looking for the Gitlab runner’s configuration file, you might want to know whether its service is activated and running without producing any errors. For that, we can use the given command.
sudo gitlab-runner status
or
sudo systemctl status gitlab-runner
![Check Gitlab runner status on Linux](https://linux.how2shout.com/wp-content/uploads/2024/08/Check-Gitlab-runner-status-on-Linux.webp)
List Registered Runners
You would like a list of registered runners on your system, along with their names and statuses, to ensure that the proper Runner has been registered and activated to execute the jobs.
sudo gitlab-runner list
![Get the List of running Gitlab runners](https://linux.how2shout.com/wp-content/uploads/2024/08/Get-the-List-of-running-Gitlab-runners-1024x88.webp)
Check or Update Runner Configuration File
Finally, suppose you have been assured that your GitLab Runner service works without errors and is active in running and executing jobs. You can inspect its configuration file for problems or settings in that case. GitLab Runner configurations are stored in the “config.toml” file.
sudo nano /etc/gitlab-runner/config.toml
Key settings to look for:
concurrent
: It indicates the maximum number of jobs that can run simultaneously.check_interval
: Used to define how frequently the runner checks for new jobs.runners
: This section contains configurations for each registered Runner, including URL, token, and executor type (e.g., Docker, Shell).- For Advanced Configuration, check out the official documentation.
After reviewing, press Ctrl + X
to exit the editor.
If you have made any changes to the GitLab runner configuration, then restart its service to apply the new settings:
sudo systemctl restart gitlab-runner
![Check Runner Configuration File](https://linux.how2shout.com/wp-content/uploads/2024/08/Check-Runner-Configuration-File-1024x653.webp)
Test Runner Connectivity
Those who have changed the Runner configuration file can use the given command to check the connectivity between the Runner and Gitlab instance, ensuring no connectivity issues.
sudo gitlab-runner verify
![Test Runner Connectivity](https://linux.how2shout.com/wp-content/uploads/2024/08/Test-Runner-Connectivity-1024x187.webp)
Check for Specific Runner Jobs
If you want to check if a particular Runner is picking up jobs correctly, you can view the jobs associated with it:
- Click on the “Admin” button on the bottom left side of your Gitlab web interface.
- Navigate to CI/CD > Jobs.
- If any job has been executed, you can see it here. You can filter the list by a specific runner to see which jobs it has executed.
![Check for Specific Runner Jobs](https://linux.how2shout.com/wp-content/uploads/2024/08/Check-for-Specific-Runner-Jobs-1024x737.webp)
Check GitLab Runner Logs
Reviewing logs is crucial for troubleshooting issues. The following command can help you view GitLab Runner logs and troubleshoot Runner performance and job execution.
sudo journalctl -u gitlab-runner --no-pager -l
![Check GitLab Runner Logs](https://linux.how2shout.com/wp-content/uploads/2024/08/Check-GitLab-Runner-Logs-1024x262.webp)
Conclusion
To ensure our CI/CD pipelines run efficiently and smoothly, it’s a good idea to check the Gitlab runner configuration intermittently. This will help the admins find and solve problems before they start occurring or in troubleshooting issues and make necessary adjustments to optimize performance.
Other Articles:
- How to install Gitlab Runner on Ubuntu 24.04 or 22.04 Linux
- Install GitLab on Ubuntu 24.04 or 22.04 LTS Linux
- How to Cherry-pick a commit in GitHub
- How to directly install the npm package from the GitHub repository
- Install and Use GDebi on Ubuntu 24.04 or 22.04