How to Check GitLab Runner Configuration

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

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

 

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

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

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

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

 

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:

 

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.