Reputation: 1537
I am trying to setup gitlab-runner
in a aws instance.
My project is in a group. Hence setting up group-runner
so that I can use it for other projects in the group.
# gitlab-runner version
Version: 11.7.0
Git revision: 8bb608ff
Git branch: 11-7-stable
GO version: go1.8.7
Built: 2019-01-22T11:46:13+0000
OS/Arch: linux/amd64
# docker
Docker version 18.09.1, build 4c52b90
docker-machine version 0.16.0, build 702c267f
Registered the runner with
sudo gitlab-runner register
Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com )
https://gitlab.com
Please enter the gitlab-ci token for this runner
<group runner token>
Please enter the gitlab-ci description for this runner
[hostame] my-runner
Please enter the executor: ssh, docker+machine, docker-ssh+machine, kubernetes, docker, parallels, virtualbox, docker-ssh, shell:
docker
Please enter the Docker image (eg. ruby:2.1):
ruby:2.5
I can see my-runner
runner registered from gitlab UI.
Whenever I run/retry the pipeline, it always execute with gitlab's auto-scaling instance.
Running with gitlab-runner 11.7.0-rc1 (6e20bd76)
on docker-auto-scale ed2dce3a
Using Docker executor with image ruby:2.5 ...
Pulling docker image ruby:2.5 ...
Using docker image sha256:feea8cad6f9e7cc58f7ae793ac92bd80fa1ce4da54a381921f161447e978021f for ruby:2.5 ...
Running on runner-ed2dce3a-project-10682917-concurrent-0 via runner-ed2dce3a-srm-1549352595-5d0f29b8...
Cloning repository...
Cloning into '/builds/dr5nn/gitlab-ci-demo'...
Where and what I am missing to run gitlab-runner
from my custom machine?
Do I need to add IP address
somewhere or enable some port in my aws instance?
Bellow is my .gitlab-ci.yml
before_script:
- apt-get update -qq && apt-get install -y -qq sqlite3 libsqlite3-dev nodejs
- ruby -v
- which ruby
- gem install bundler -v 2.0.1
- bundle install --jobs $(nproc) "${FLAGS[@]}"
rubocop:
script:
- bundle exec rubocop
Upvotes: 1
Views: 1603
Reputation: 1537
With suggestion from grapes. I'm able to run with bellow configurations.
While registering gitlab-runner
from my aws intance
...
...
Please enter the gitlab-ci tags for this runner (comma separated):
my-tag
...
...
And changed gitlab-ci.yml
file with
before_script:
- apt-get update -qq && apt-get install -y -qq sqlite3 libsqlite3-dev nodejs
- ruby -v
- which ruby
- gem install bundler -v 2.0.1
- bundle install --jobs $(nproc) "${FLAGS[@]}"
rubocop:
tags:
- my-tag
script:
- bundle exec rubocop
Upvotes: 0
Reputation: 8636
You are on right way - all you need is to disable shared gitlab runners for your group or particular project.
Registering group runner enables it for the group, but that doesn't actually disable all other runners - pipeline still chooses the most convenient one based on tags and other criteria.
Other way - use your private tags (not like docker
and etc) to select runner. Runners pick their jobs according to the set of tags
, specified for jobs. For example, if job has tags docker
and linux
, only runners with such tags can pick it up. So, you can simply mark jobs, which you want to execute on your group runner (and not on shared runners) with tag like private-runner
and add this tag to your runner.
Upvotes: 1