sameersbn / docker-gitlab-ci-runner

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

Strange git messages on build start and bundler crashs #13

Closed Jack12816 closed 9 years ago

Jack12816 commented 9 years ago

I'm expecting strange git messages on build start. (git clone enabled) The link between /home/gitlab_ci_runner/gitlab-ci-runner/tmp/builds and /home/gitlab_ci_runner/data seems to cause problems?

Additionally I'm expecting very unstable bundle install results. On a system shared base it fails randomly on building native gems, write permission issues an stuff like this. :(

Maybe you got a clever hint or a solution?

The build script:

ls -la
ruby -v
bundle install --path vendor/bundle
export RAILS_ENV=ci
export DISABLE_SPRING=1
bundle exec rake db:drop
bundle exec rake db:setup
bundle exec rspec

The build trace:

cd /home/gitlab_ci_runner/gitlab-ci-runner/tmp/builds && git clone http://gitlab-ci-token:xxxxxx@code.jity.de/testd/api.git project-1 && cd project-1 && git checkout 2e9742416d6968875d5a58825b902924e771a6a1
fatal: destination path 'project-1' already exists and is not an empty directory.
cd /home/gitlab_ci_runner/gitlab-ci-runner/tmp/builds/project-1 && git reset --hard && git checkout 2e9742416d6968875d5a58825b902924e771a6a1
fatal: Not a git repository (or any parent up to mount point /home/gitlab_ci_runner/data)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
ls -la
total 80
drwxr-xr-x 8 gitlab_ci_runner gitlab_ci_runner 4096 Mar 19 00:43 .
drwxr-xr-x 3 gitlab_ci_runner gitlab_ci_runner 4096 Mar 19 00:29 ..
drwxr-xr-x 2 gitlab_ci_runner gitlab_ci_runner 4096 Mar 19 00:29 .bundle
-rw-r--r-- 1 gitlab_ci_runner gitlab_ci_runner   11 Mar 19 00:29 .dockerignore
-rw-r--r-- 1 gitlab_ci_runner gitlab_ci_runner  306 Mar 19 00:29 .editorconfig
-rw-r--r-- 1 gitlab_ci_runner gitlab_ci_runner  447 Mar 19 00:29 .gitignore
-rw-r--r-- 1 gitlab_ci_runner gitlab_ci_runner   48 Mar 19 00:29 .rspec
-rw-r--r-- 1 gitlab_ci_runner gitlab_ci_runner 1146 Mar 19 00:29 Dockerfile
-rw-r--r-- 1 gitlab_ci_runner gitlab_ci_runner 1313 Mar 19 00:29 Gemfile
-rw-r--r-- 1 gitlab_ci_runner gitlab_ci_runner 5937 Mar 19 00:29 Gemfile.lock
-rw-r--r-- 1 gitlab_ci_runner gitlab_ci_runner  653 Mar 19 00:29 README.md
-rw-r--r-- 1 gitlab_ci_runner gitlab_ci_runner  249 Mar 19 00:29 Rakefile
drwxr-xr-x 2 gitlab_ci_runner gitlab_ci_runner 4096 Mar 19 00:29 bin
drwxr-xr-x 5 gitlab_ci_runner gitlab_ci_runner 4096 Mar 19 00:29 config
-rw-r--r-- 1 gitlab_ci_runner gitlab_ci_runner  153 Mar 19 00:29 config.ru
drwxr-xr-x 2 gitlab_ci_runner gitlab_ci_runner 4096 Mar 19 00:29 db
-rw-r--r-- 1 gitlab_ci_runner gitlab_ci_runner  468 Mar 19 00:29 fig.yml
drwxr-xr-x 2 gitlab_ci_runner gitlab_ci_runner 4096 Mar 19 00:33 log
drwxr-xr-x 3 gitlab_ci_runner gitlab_ci_runner 4096 Mar 19 00:43 vendor
ruby -v
ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-linux-gnu]
bundle install --path vendor/bundle
――― ERROR REPORT TEMPLATE ―――――――――――――――――――――――――――――――――――――――――――――――――――――――
- What did you do?
- What did you expect to happen?
- What happened instead?

Error details

    NoMethodError: undefined method `name' for nil:NilClass
    /usr/lib/ruby/2.1.0/rubygems/specification.rb:748:in `block in _resort!'
    /usr/lib/ruby/2.1.0/rubygems/specification.rb:747:in `sort!'
    /usr/lib/ruby/2.1.0/rubygems/specification.rb:747:in `_resort!'
    /usr/lib/ruby/2.1.0/rubygems/specification.rb:699:in `_all'
    /usr/lib/ruby/2.1.0/rubygems/specification.rb:882:in `each'
    /var/lib/gems/2.1.0/gems/bundler-1.8.5/lib/bundler/rubygems_integration.rb:505:in `to_a'
    /var/lib/gems/2.1.0/gems/bundler-1.8.5/lib/bundler/rubygems_integration.rb:505:in `all_specs'
    /var/lib/gems/2.1.0/gems/bundler-1.8.5/lib/bundler/source/rubygems.rb:250:in `installed_specs'
    /var/lib/gems/2.1.0/gems/bundler-1.8.5/lib/bundler/source/rubygems.rb:77:in `specs'
    /var/lib/gems/2.1.0/gems/bundler-1.8.5/lib/bundler/lazy_specification.rb:53:in `__materialize__'
    /var/lib/gems/2.1.0/gems/bundler-1.8.5/lib/bundler/spec_set.rb:88:in `block in materialize'
    /var/lib/gems/2.1.0/gems/bundler-1.8.5/lib/bundler/spec_set.rb:85:in `map!'
    /var/lib/gems/2.1.0/gems/bundler-1.8.5/lib/bundler/spec_set.rb:85:in `materialize'
    /var/lib/gems/2.1.0/gems/bundler-1.8.5/lib/bundler/definition.rb:158:in `missing_specs'
    /var/lib/gems/2.1.0/gems/bundler-1.8.5/lib/bundler/installer.rb:70:in `block in run'
    /var/lib/gems/2.1.0/gems/bundler-1.8.5/lib/bundler/ui/shell.rb:66:in `silence'
    /var/lib/gems/2.1.0/gems/bundler-1.8.5/lib/bundler/installer.rb:67:in `run'
    /var/lib/gems/2.1.0/gems/bundler-1.8.5/lib/bundler/installer.rb:18:in `install'
    /var/lib/gems/2.1.0/gems/bundler-1.8.5/lib/bundler/cli/install.rb:80:in `run'
    /var/lib/gems/2.1.0/gems/bundler-1.8.5/lib/bundler/cli.rb:157:in `install'
    /var/lib/gems/2.1.0/gems/bundler-1.8.5/lib/bundler/vendor/thor/command.rb:27:in `run'
    /var/lib/gems/2.1.0/gems/bundler-1.8.5/lib/bundler/vendor/thor/invocation.rb:121:in `invoke_command'
    /var/lib/gems/2.1.0/gems/bundler-1.8.5/lib/bundler/vendor/thor.rb:363:in `dispatch'
    /var/lib/gems/2.1.0/gems/bundler-1.8.5/lib/bundler/vendor/thor/base.rb:440:in `start'
    /var/lib/gems/2.1.0/gems/bundler-1.8.5/lib/bundler/cli.rb:10:in `start'
    /var/lib/gems/2.1.0/gems/bundler-1.8.5/bin/bundle:20:in `block in <top (required)>'
    /var/lib/gems/2.1.0/gems/bundler-1.8.5/lib/bundler/friendly_errors.rb:6:in `with_friendly_errors'
    /var/lib/gems/2.1.0/gems/bundler-1.8.5/bin/bundle:18:in `<top (required)>'
    /usr/local/bin/bundle:23:in `load'
    /usr/local/bin/bundle:23:in `<main>'

Environment

    Bundler   1.8.5
    Rubygems  2.2.2
    Ruby      2.1.5p273 (2014-11-13 revision 48405) [x86_64-linux-gnu]
    GEM_HOME  /home/gitlab_ci_runner/data/builds/project-1/vendor/bundle/ruby/2.1.0
    GEM_PATH  
    Git       2.2.2

Bundler settings

    path
      Set for your local app (/home/gitlab_ci_runner/data/builds/project-1/.bundle/config): "vendor/bundle"
    disable_shared_gems
      Set for your local app (/home/gitlab_ci_runner/data/builds/project-1/.bundle/config): "1"
――― TEMPLATE END ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

Unfortunately, an unexpected error occurred, and Bundler cannot continue.

First, try this link to see if there are any existing issue reports for this error:
https://github.com/bundler/bundler/search?q=undefined+method+%60name%27+for+nil%3ANilClass&type=Issues

If there aren't any reports for this error yet, please create copy and paste the report template above into a new issue. Don't forget to anonymize any private data! The new issue form is located at:
https://github.com/bundler/bundler/issues/new
sameersbn commented 9 years ago

@Jack12816 This error is probably specific to the project you are building. There are a host of reasons this could happen:

I would suggest you start the runner image with the bash prompt and manually try to perform the steps listed in the build script. Additionally you might want to do gem list to see the list of gems currently installed and inspect the projects Gemfile for any conflicts in the gem versions. You might also want to check the ruby/rails version installed verses the ruby/rails version required by the project.

If this does not help, then the most cumbersome way to find out the problem would be to truncate the Gemfile and add gems one at a time (using the Gemfile) till you find the gem that causes the error and take it from there.

The error message you pasted above does not give an indication of where the error originates from. To me its just a bunch of gibberish that is common for various types of errors. I hope you have not truncated any part of the output, because there could be a possibility that you might have left out some important piece of information.

I am not a rails developer. I only have a overall understanding of how stuff works with rails (and I happen to be good at doing google searches :smile: ). I have no development experience with rails. Maybe a real rails developer might be able to help.

Hope you find this information useful.

Jack12816 commented 9 years ago

Thank you for the hints. Last thing I tried was installing ruby 2.2 with rvm on my custom container. This seems to working for the moment. But the issues while cloning the repos / git fatals is although present. Any hints on this?

I would suggest you start the runner image with the bash prompt and manually try to perform the steps listed in the build script.

This is working well. The funny thing is: it works randomly and it crashs randomly. Really wired.

Jack12816 commented 9 years ago

With the latest CI runner version (5.2.1) this seems to be fixed. Did not seen any further problems. Thank you.