Unable to start rails console if using master from gitlab-shell

Summary

From source, running bin/rails console will result in failure if Gitlab::Shell.new.version returns nil. This was found in charts/gitlab#488, which builds from master nightly. This includes gitlab-shell's master, which does not have a version lock.

Steps to reproduce

  1. Deploy charts/gitlab
  2. kubectl exec -ti <unicorn pod> -- /home/git/gitlab/bin/rails console

What is the current bug behavior?

There is an attempted string concatenation of nil here

~/gitlab$ bin/rails console
WARNING: This version of GitLab depends on gitlab-shell 7.1.2, but you're running Unknown. Please update gitlab-shell.
-------------------------------------------------------------------------------------
 Gitlab:       11.0.0-pre (6eba0dd7)
/home/git/gitlab/config/initializers/console_message.rb:7:in `+': no implicit conversion of nil into String (TypeError)
        from /home/git/gitlab/config/initializers/console_message.rb:7:in `<top (required)>'
        from /home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:268:in `load'
        from /home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:268:in `block in load'
        from /home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:240:in `load_dependency'
        from /home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:268:in `load'
        from /home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/railties-4.2.10/lib/rails/engine.rb:652:in `block in load_config_initializer'
...

What is the expected correct behavior?

~/gitlab$ bin/rails console
WARNING: This version of GitLab depends on gitlab-shell 7.1.2, but you're running Unknown. Please update gitlab-shell.
-------------------------------------------------------------------------------------
 Gitlab:       11.0.0-pre (6eba0dd7)
 Gitlab Shell: Unknown
 postgresql:   9.6.8
-------------------------------------------------------------------------------------
Loading production environment (Rails 4.2.10)
irb(main):001:0>

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info
$ bundle exec rake gitlab:env:info RAIL_ENV=production
WARNING: This version of GitLab depends on gitlab-shell 7.1.2, but you're running Unknown. Please update gitlab-shell.

System information System: Proxy: no Current User: git Using RVM: no Ruby Version: 2.3.5p376 Gem Version: 2.6.13 Bundler Version:1.15.4 Rake Version: 12.3.1 Redis Version: unknown Git Version: 2.13.5 Sidekiq Version:5.1.3 Go Version: unknown

GitLab information Version: 11.0.0-pre Revision: 6eba0dd7 Directory: /home/git/gitlab DB Adapter: postgresql DB Version: 9.6.8 URL: https://gitlab.separate-containers.party HTTP Clone URL: https://gitlab.separate-containers.party/some-group/some-project.git SSH Clone URL: git@gitlab.separate-containers.party:some-group/some-project.git Elasticsearch: no Geo: no Using LDAP: no Using Omniauth: yes Omniauth Providers: google_oauth2

GitLab Shell Version: unknown Repository storage paths:

  • default: /var/opt/gitlab/repo Hooks: /home/git/gitlab-shell/hooks Git: /usr/bin/git

Results of GitLab application Check

Expand for output related to the GitLab application check
$ bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true
WARNING: This version of GitLab depends on gitlab-shell 7.1.2, but you're running Unknown. Please update gitlab-shell.
Checking GitLab Shell ...

GitLab Shell version >= 7.1.2 ? ... FAIL. Please update gitlab-shell to 7.1.2 from Unknown Repo base directory exists? default... yes Repo storage directories are symlinks? default... no Repo paths owned by git:root, or git:git? default... yes Repo paths access is drwxrws---? default... yes hooks directories in repos are links: ... 1/2 ... wrong or missing hooks Try fixing it: sudo -u git -H /home/git/gitlab-shell/bin/create-hooks /var/opt/gitlab/repo Check the hooks_path in config/gitlab.yml Check your gitlab-shell installation For more information see: doc/install/installation.md in section "GitLab Shell" Please fix the error above and rerun the checks. Running /home/git/gitlab-shell/bin/check gitlab-shell self-check failed Try fixing it: Make sure GitLab is running; Check the gitlab-shell configuration file: sudo -u git -H editor /home/git/gitlab-shell/config.yml Please fix the error above and rerun the checks.

Checking GitLab Shell ... Finished

Checking Sidekiq ...

Running? ... no Try fixing it: sudo -u git -H RAILS_ENV=production bin/background_jobs start For more information see: doc/install/installation.md in section "Install Init Script" see log/sidekiq.log for possible errors Please fix the error above and rerun the checks.

Checking Sidekiq ... Finished

Reply by email is disabled in config/gitlab.yml Checking LDAP ...

LDAP is disabled in config/gitlab.yml

Checking LDAP ... Finished

Checking GitLab ...

Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... no Try fixing it: sudo chown -R gitlab /home/git/gitlab/tmp sudo chmod -R u+rwX /home/git/gitlab/tmp For more information see: doc/install/installation.md in section "GitLab" Please fix the error above and rerun the checks. Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... skipped (no tmp uploads folder yet) Init script exists? ... no Try fixing it: Install the init script For more information see: doc/install/installation.md in section "Install Init Script" Please fix the error above and rerun the checks. Init script up-to-date? ... can't check because of previous errors Projects have namespace: ... 1/2 ... yes Redis version >= 2.8.0? ... no Try fixing it: Update your redis server to a version >= 2.8.0 For more information see: gitlab-public-wiki/wiki/Trouble-Shooting-Guide in section sidekiq Please fix the error above and rerun the checks. Ruby version >= 2.3.5 ? ... yes (2.3.5) Git version >= 2.9.5 ? ... yes (2.13.5) Git user has default SSH configuration? ... yes Active users: ... 1 Elasticsearch version 5.1 - 5.5? ... skipped (elasticsearch is disabled)

Checking GitLab ... Finished

Note: in the CNG images, this unicorn pod runs only the Unicorn & Workhorse processes. As such there is no Sidekiq active (in a different container), Redis is provided externally,

Possible fixes

https://gitlab.com/gitlab-org/gitlab-ce/blob/master/config/initializers/console_message.rb#L7 should read as puts " Gitlab Shell:".ljust(justify) + (Gitlab::Shell.new.version || 'Unknown')

Assignee Loading
Time tracking Loading