Only one gitlab runner is available in my project. However, in the runner page I have multiple other runners listed. How do I add these runners to the project such that a runner will be randomly selected to execute the build? The runners are running in Docker containers and I am using a self-managed version of GitLab.
These are the runners I have available
Only runner1 is currently shown in /settings/cicd under Runners:
runner1
Basically, if you go by runners there are actually three types of a runner in Gitlab
Specific: Only for Specific Project
Group: For all projects in the particular group (if need more info on groups https://docs.gitlab.com/ee/user/group)
Shared: These will be available for every project in the GitLab
It will be difficult to specify here that how we can configure the runners but I can point to documentation from where we actually configured our Runners
https://docs.gitlab.com/ee/ci/runners/
Also to make a note of tagging is a very important task that needs to be done so that you can use your runners with your requirement like you said you want to use runners randomly from the list then all the runners in the list should have a common tag that can be further used in your .gitlab-ci.yml file.
eg. We have tag runners as per the AWS ec2 instance size so (like macro, small, medium, large, etc) so that people using can use the runners as per the requirement of there job)
job1:
tags:
- shared-large-runner
job2:
tags:
- shared-micro-runner
Note: you can have multiple tags for a single runner for better control over its usage.
Hopefully, this helps!!
Looking at your screenshot, to be able to use group runners, your project just need to be inside that group
Because the group tag shows that the runner was configured just to accept jobs from one group
I think you have one runner for each group, this is the reason that your project only have the runner1
Related
I have a pipeline set up on Gitlab, within which my project is built and unit tests are run every time I commit a change to "developer" git branch.
Recently I've updated versions of some libraries in the project and after that builds on CICD started to fail and says that node.js version should be updated.
As I undestand I need to somehow edit settings of a container in which builds are run.
We have our own gitlab instance. As I see from the settings there are group of shared runners, used from many projects.
How can I find out which of those runners are used for my project? in the Gitlab GUI I can see tags assigned to the shared runners, but I don't see any tags in my .gitlab-ci.yml
Gitlab version is 15.4.2-ee
self-managed
If its not tagged it will run on any runner which is configured to run untagged jobs. Not just on any runner. By default runners don't run untagged jobs.
We have a locally deployed instance of Gitlab, where at the time we cannot afford to have a GitLab Runner to run CI/CD pipelines.
Is it possible to use GitLab Pages without CI/CD? E.g. is it possible to manually prepare the HTML-content, put it in the public folder in the root and make it accessible?
I assume you don't want to use GitLab shared runner which costs you and CI minutes limits.
Public folder
Refer to this gitlab-ci.yaml for making HTML content available https://gitlab.com/pages/plain-html/-/blob/master/.gitlab-ci.yml
Running locally without registration
Here is the known limitations: https://docs.gitlab.com/runner/commands/#limitations-of-gitlab-runner-exec
Pages are directly managed by Gitlab so running locally won't affect the page's state.
Use your own runner and register with gitlab (Possible)
Install GitLab runner on your machine and register as a runner, instructions can be found at Settings->CI/CD->Runners->Specific runner Enable it for your project or group.
I use my personal machine gitlab-runner to execute CI jobs that aren't counted towards CI minutes.
[Disclamer] : this post focus exclusively on CI / build aspects and has nothing to do with CD / deployment
Say I have a project hosted on Gitlab involving some source code compilation. For the present purpose, let's say I wan't Maven to create two cars (STAGE PROD) of some java project every time a developer merges on master. Those cars:
will be stored on the project registry
need to contain the environment variables defined for this project.
Can I legitimately assume that those environment variables will remain safe (i.e. private) if the project is compiled with shared gitlab runners based on the assumption that Docker runners are ephemeral ? Is there a (better) way to enforce privacy despite using shared runners?
One possible alternative would be using Protected environment variables.
issue 1452 show them in "CI/CD" panel of Settings.
By prefixing them with STAGE_ or PROD_, your maven job could use the right variable depending on the current car.
By their protected nature, they would not be exposed.
I want to use gitlab runners for our builds and our deployment to QA. Can I set up a second runner that ONLY does deployments, or just a specific environment? I don't see a way to do this. (Gitlab.com/private runners)
Found it. This can be achieved using tags. CI runners can be configured to run only jobs that have specific tags, and tags can be applied to jobs.
Gitlab jobs and runners can be tagged - so only runners with the tag can run the job. See documentation here: http://docs.gitlab.com/ce/ci/yaml/README.html#tags
I want to ensure that my runners that have tags only pick up tagged jobs. Currently jobs without any tags are eligible to run on these runners too.
Can this be done?
During the Registration process of the runner: https://docs.gitlab.com/runner/register/index.html
Choose whether the Runner should pick up jobs that do not have tags, you can change this later in GitLab's UI (defaults to false):
In the Admin panel https://<SERVER>/admin/runners
And in the config dialog of your specific runner (URL: https://<PROJECT_URL>/settings/ci_cd)
...you can set the option, to only run tagged jobs.
If you then also tag your jobs accordingly, you have reached your goal.
e.g.:
job:
tags:
- ruby
- postgres