Reputation: 22984
I'm new to Gitlab CI.
I have configured .gitlab-ci.yml file, and using CI Lint it has passed the validation process.
Based on this documentation, I can see a specific runner should be configured on a virtual machine, a VPS, a bare-metal machine, a docker container or even a cluster of containers.
And I can see gitlab has its own shared runners and enabled by default.
When I visit the Pipeline page I can only see the blue Get Started with Pipeline button and when clicked I was redirected to this page.
The "Gitlab CI - How to start Shared Runner" says that Gitlab CI will only run the job for the testing
branch, however, none of my git use branch unless for very specific cases. So
The question is how to use this shared runner in my normal (private) repo that has only the single master
branch?
Upvotes: 3
Views: 2801
Reputation: 1612
Shared runners will run for any branch, so for the master
branch too (unless you configure otherwise).
Additionally,
except
directives.For example, following job will trigger for any push, despite the branch:
buildClient:
stage: buildComponents
script:
- echo "Building the client..."
On the other hand, this job will trigger only for push to the develop
branch and it will be processed by any available runner with the docker
tag:
buildServer:
stage: buildComponents
script:
- echo "Building the server with Docker..."
only:
- develop
tags:
- docker
According the blue Get Started with Pipeline button: You need to add a .gitlab-ci.yml
file to the root of your project and push it to GitLab. This file defines stages and jobs of your build pipeline. Jobs are then picked-up by runners according the given configuration. E.g. simple .gitlab-ci.yml
can look like this:
image: alpine:latest
stages:
- test
- build
testApp:
stage: test
script: echo "Testing..."
buildApp:
stage: build
script: echo "Building..."
See Configuration of your jobs with .gitlab-ci.yml in GitLab documentation for more details.
Upvotes: 3