Reputation: 7344
Is it possible to run a pipeline on a specific runner? (not using tags)
Is it feasible to use environments
, or even gitlab runner exec
maybe?
Scenario:
Have an existing project with multiple runners already attached to it (specific project token used to register the runner) and has it's own associated tags (so can't change these either).
I'm adding a new runner, however need to test it first to ensure it works, but I need to force the pipeline to build on this machine, without changing any tags, or specific project of the runner.
Upvotes: 28
Views: 39910
Reputation: 51
You have two mechanisms by which you can attempt to isolate a new runner for testing:
use tags and private runner attachment (already called out).
To further expand on this... even in a draconian setup where you can't alter tags and whatnot -- you can always FORK the project.
In your new private fork, you can go to Settings >> CI/CD and override the .gitlab-ci.yml file in the Custom CI Configuration Path under the General Pipelines Settings. This allows you to git cp .gitlab-ci.yml .mycustomgitlab-ci.yml
and then simply git add
/git commit
/git push
and you're in business.
Opinion: If you cannot use the mechanisms in place to adjust the tags on the questionable runner and isolate a new forked project, this isn't a technical problem, it is a political problem.
Gitlab-runner exec....
Assuming you're using a shell gitlab runner...
/tmp/myrepo
/path/to/gitlab-runner exec shell {.gitlab-ci.yml target}
See https://docs.gitlab.com/runner/commands/#gitlab-runner-exec and a blog about it at https://substrakt.com/how-to-debug-gitlab-ci-builds-locally/
Canary the gitlab-runner for a single build.
You can spin up the gitlab-runner process to do N number of builds and then go back offline. See: https://docs.gitlab.com/runner/commands/#gitlab-runner-run-single
... This is not zero-impact, but will definitely limit the blast radius of any problems.
Upvotes: 5
Reputation: 7344
There currently isn't a solution for building on a specific runner in GitLab, but there is an issue open for Sticky Runners, which hopefully will be out in the next 3-6 months according to the Milestones!
The work around I've done so far to build a project on a specific runner is to use the GitLab Runner API, in a rather hacky way, along the lines of:
Upvotes: 4
Reputation: 2541
If you do not want to use tags another option could be to assign the runner to your specific projects. This option or the tag alternative are the way Gitlab is designed.
Upvotes: 2