sameersbn / docker-gitlab-ci-runner

Dockerfile to build a base GitLab CI Runner container image.
MIT License
98 stars 37 forks source link

Problem with starting the container #8

Closed Brootux closed 9 years ago

Brootux commented 9 years ago

Hello,

the current version of the /app/init-script (docker image hash: 06e501269e54) does not work for me. If ill try to start a new container via

docker run --name gitlab-ci-runner -it --rm \
-v /opt/gitlab-ci-runner:/home/gitlab_ci_runner/data \
sameersbn/gitlab-ci-runner:5.0.0-1 app:setup

it will not ask me for a CI-URL or Registration-Token. Instead ill get the following error

/usr/lib/ruby/2.1.0/net/http.rb:879:in `initialize': no implicit conversion of nil into String (TypeError)
    from /usr/lib/ruby/2.1.0/net/http.rb:879:in `open'
    from /usr/lib/ruby/2.1.0/net/http.rb:879:in `block in connect'
    from /usr/lib/ruby/2.1.0/timeout.rb:76:in `timeout'
    from /usr/lib/ruby/2.1.0/net/http.rb:878:in `connect'
    from /usr/lib/ruby/2.1.0/net/http.rb:863:in `do_start'
    from /usr/lib/ruby/2.1.0/net/http.rb:852:in `start'
    from /usr/lib/ruby/2.1.0/net/http.rb:1369:in `request'
    from /home/gitlab_ci_runner/gitlab-ci-runner/vendor/bundle/ruby/2.1.0/gems/httparty-0.11.0/lib/httparty/request.rb:92:in `perform'
    from /home/gitlab_ci_runner/gitlab-ci-runner/vendor/bundle/ruby/2.1.0/gems/httparty-0.11.0/lib/httparty.rb:461:in `perform_request'
    from /home/gitlab_ci_runner/gitlab-ci-runner/vendor/bundle/ruby/2.1.0/gems/httparty-0.11.0/lib/httparty.rb:414:in `post'
    from /home/gitlab_ci_runner/gitlab-ci-runner/lib/network.rb:86:in `register_runner'
    from /home/gitlab_ci_runner/gitlab-ci-runner/lib/setup.rb:35:in `register_runner'
    from /home/gitlab_ci_runner/gitlab-ci-runner/lib/setup.rb:9:in `initialize'
    from ./bin/setup:4:in `new'
    from ./bin/setup:4:in `<main>'

After short research ive found out, that the setting of the environment variable in /app/init may be the problem. If i change

appSetup () {
  sudo -u gitlab_ci_runner -H CI_SERVER_URL=$1 REGISTRATION_TOKEN=$2 bundle exec ./bin/setup
  sudo -u gitlab_ci_runner -H mv config.yml ${DATA_DIR}/config.yml
}

to

appSetup () {
  sudo -u gitlab_ci_runner bundle exec ./bin/setup
  sudo -u gitlab_ci_runner -H mv config.yml ${DATA_DIR}/config.yml
}

and execute it inside of the container, it will then ask me for URL and TOKEN.

Can anyone confirm this bug?

sameersbn commented 9 years ago

This issue has been fixed in ec2dd57776eb51f734a2adcbd90db227eb3a686d. Please update docker pull sameersbn/gitlab-ci-runner:latest and retry.

Brootux commented 9 years ago

Jees,

that was fast, it works now.

Thank you