OmniAuth::Strategies::OAuth2Generic fails to load
Summary
In the GitLab Docker container, OmniAuth strategies don't load properly anymore after updating GitLab, causing configure to fail.
This worked "previously" (with the Docker container that was considered latest
about 36 hours ago).
Steps to reproduce
- Creater a
docker-compose.yml
with the following contents:
web:
image: 'gitlab/gitlab-ce:latest'
container_name: gitlab-web-staging
restart: always
hostname: 'vorkurs-gitlab'
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'https://vorkurs-staging.cs.uni-saarland.de/gitlab'
gitlab_rails['gitlab_shell_ssh_port'] = 22222
nginx['listen_port'] = 80
nginx['listen_https'] = false
nginx['proxy_set_headers'] = {
"X-Forwarded-Proto" => "https",
"X-Forwarded-Ssl" => "on"
}
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "mail.cs.uni-saarland.de"
gitlab_rails['smtp_port'] = 25
gitlab_rails['smtp_domain'] = "vorkurs-staging.cs.uni-saarland.de"
gitlab_rails['smtp_authentication'] = false
gitlab_rails['smtp_enable_starttls_auto'] = false
ports:
- '127.0.0.1:8088:80'
- '22222:22'
volumes:
- './config:/etc/gitlab'
- './logs:/var/log/gitlab'
- './data:/var/opt/gitlab'
(gitlab/gitlab-ce:lates
currently refers to image 8e28c88b6a21
.)
- Create
config/gitlab.rb
with these contents:
### OmniAuth Settings
###! Docs: https://docs.gitlab.com/ce/integration/omniauth.html
gitlab_rails['omniauth_enabled'] = true
gitlab_rails['omniauth_auto_sign_in_with_provider'] = 'test'
gitlab_rails['omniauth_allow_single_sign_on'] = true
gitlab_rails['omniauth_block_auto_created_users'] = false
gitlab_rails['omniauth_providers'] = [
{
'name' => 'test',
'app_id' => 'GitLab',
'app_secret' => 'seeeeeeeeeeeeeecret',
'args' => {
client_options: {
'site' => 'https://oauthsource.uni-saarland.de', # including port if necessary
'user_info_url' => '/user',
'authorize_url' => '/authorize',
'token_url' => '/access_token'
},
user_response_structure: {
root_path: [], # i.e. if attributes are returned in JsonAPI format (in a 'user' node nested under a 'data' node)
attributes: { name: 'name', email: 'email', nickname: 'login' } # if the nickname attribute of a user is called 'username'
},
# optionally, you can add the following two lines to "white label" the display name of this strategy (appears in urls and Gitlab login buttons) If yo$ # also replace oauth2_generic, everywhere it appears above, with the new name.
name: 'test', # display name for this strategy
strategy_class: "OmniAuth::Strategies::OAuth2Generic" # Devise-specific config option Gitlab uses to find renamed strategy
}
}
]
- Run
docker-compose up
.
What is the current bug behavior?
GitLab fails to start because the OAuth2Generic strategy didn't load correctly.
What is the expected correct behavior?
GitLab should load, and use SSO with the OAuth2Generic strategy.
Relevant logs and/or screenshots
gitlab-web-staging | Recipe: gitlab::database_migrations
gitlab-web-staging | * bash[migrate gitlab-rails database] action run
gitlab-web-staging | [execute] rake aborted!
gitlab-web-staging | NoMethodError: undefined method `new' for "OmniAuth::Strategies::OAuth2Generic":String
gitlab-web-staging | Did you mean? next
gitlab-web-staging | /opt/gitlab/embedded/service/gitlab-rails/config/environment.rb:6:in `<top (required)>'
gitlab-web-staging | /opt/gitlab/embedded/bin/bundle:23:in `load'
gitlab-web-staging | /opt/gitlab/embedded/bin/bundle:23:in `<main>'
gitlab-web-staging | Tasks: TOP => gitlab:db:configure => environment
gitlab-web-staging | (See full trace by running task with --trace)
gitlab-web-staging |
gitlab-web-staging | ================================================================================
gitlab-web-staging | Error executing action `run` on resource 'bash[migrate gitlab-rails database]'
gitlab-web-staging | ================================================================================
Note that when using an empty configuration file, in the Rails console, `OmniAuth::Strategies::OAuth2Generic::new`` appears to exist.
Output of checks
Results of GitLab environment info
Expand for output related to GitLab environment info
rake aborted! NoMethodError: undefined method `new' for "OmniAuth::Strategies::OAuth2Generic":String Did you mean? next /opt/gitlab/embedded/service/gitlab-rails/config/environment.rb:6:in `' /opt/gitlab/embedded/bin/bundle:23:in `load' /opt/gitlab/embedded/bin/bundle:23:in `' Tasks: TOP => gitlab:env:info => gitlab_environment => environment (See full trace by running task with --trace)
Results of GitLab application Check
Expand for output related to the GitLab application check
rake aborted! NoMethodError: undefined method `new' for "OmniAuth::Strategies::OAuth2Generic":String Did you mean? next /opt/gitlab/embedded/service/gitlab-rails/config/environment.rb:6:in `' /opt/gitlab/embedded/bin/bundle:23:in `load' /opt/gitlab/embedded/bin/bundle:23:in `' Tasks: TOP => gitlab:check => gitlab_environment => environment (See full trace by running task with --trace)