Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example does not work #44

Closed
thibaultsmnt opened this issue May 10, 2019 · 7 comments
Closed

Example does not work #44

thibaultsmnt opened this issue May 10, 2019 · 7 comments

Comments

@thibaultsmnt
Copy link

It seems that the following example playbook from the readme cannot be run:

gitlab_runner_registration_token: 'HUzTMgnxk17YV8Rj8ucQ'
gitlab_runner_runners:
  - name: 'Example Docker GitLab Runner'
    executor: docker
    tags:
      - node
      - ruby
      - mysql
    docker_volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"
      - "/cache"
    extra_configs:
      runners.docker:
        memory: 512m
        allowed_images: ["ruby:*", "python:*", "php:*"]
      runners.docker.sysctls:
        net.ipv4.ip_forward: "1"

As the docker image is not specified and not defined in the default. Extract from defaults:

# The default Docker image to use. Required when executor is `docker`.
    docker_image: ''

I get the following error from ansible:

The docker-image needs to be entered

Possible fix is to update the example to:

gitlab_runner_registration_token: 'HUzTMgnxk17YV8Rj8ucQ'
gitlab_runner_runners:
  - name: 'Example Docker GitLab Runner'
    executor: docker
    docker_image: 'alpine'
    tags:
      - node
      - ruby
      - mysql
    docker_volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"
      - "/cache"
    extra_configs:
      runners.docker:
        memory: 512m
        allowed_images: ["ruby:*", "python:*", "php:*"]
      runners.docker.sysctls:
        net.ipv4.ip_forward: "1"
@riemers
Copy link
Owner

riemers commented May 10, 2019

Like how it is now right?

@thibaultsmnt
Copy link
Author

Yes exactly! Thanks

@fleaz
Copy link

fleaz commented Mar 24, 2020

Hey,
I just ran into the same problem because I wrote my host vars by hand and didn't defined the docker_image line. Debugging was quite cumbersome because I had to get rid of the no_log to see the actual error message and debug the problem :/

Why not set a sane default for docker_image like alpine, instead of "" which will break the task? From what I saw, this change would require just two lines changed.

@riemers
Copy link
Owner

riemers commented Mar 24, 2020

In the example it is set to "alpine" is that not what you are referring to?

@fleaz
Copy link

fleaz commented Mar 24, 2020

No, I'm referring to the actual register_runner.yml task. In line 44 we have

    --docker-image '{{ gitlab_runner.docker_image|default("") }}'

Which results in an empty --docker-image flag for the register which will then fail because it's an required parameter. And because of the no_log this is hard to debug because you don`t get any output.

My idea was to change this default("") part in the task itself and insert alpine over there. This would make the playbook more robust and it would also run fine if one doesn"t define a docker_image in its vars

@riemers
Copy link
Owner

riemers commented Mar 24, 2020

liked the idea ;p

@fleaz
Copy link

fleaz commented Mar 25, 2020

Awesome. Thanks for the quick fix :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants