What are Gitlab Runners?
GitLab Runner is an application that works with GitLab CI/CD to run jobs in a pipeline. They can also run
inside a Docker container or be deployed into a Kubernetes cluster.
Types of Runners:
- Shared Runner: These types of runners are available globally and can automatically be allocated based on their availability.
- Specific Runner: For this, you have to register a runner and you can only use it in a specific project or can also use it in a specific stage of your pipeline. Will discuss this more in detail.
- Group Runner: These runners are shared across projects in the group.
How to register a specific runner?
sudo gitlab-runner register
This command will start the process of registering a runner. Then go to the Gitlab Project -Settings->CI/CD->Runners and copy the URL of specific runners.
How to use this specific runner in a pipeline?
Just add the tags field in your pipeline and name the tag which you added during the registration of a runner.
Here is the sample pipeline for your reference.
stage: test
script:
- echo "Testing"
- test -f "build/info.txt"
tags:
- testing
npm:
image: node:latest
stage: npm
How to use this specific runner in a pipeline?
script:
- echo "image pulled"
No comments:
Post a Comment