Upgrade to 17.0.1 fails with Recipe Compile Error in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/config.rb

:hugs: Please help fill in this template with all the details to help others help you more efficiently. Use formatting blocks for code, config, logs and ensure to remove sensitive data.

Problem to solve

Describe your question in as much detail as possible:
After an attempted upgrade from 16.11.3-ce to 17.0.1-ce

  • What are you seeing, and how does that differ from what you expect to see?
    I see errors:

[2024-05-22T18:26:08-05:00] INFO: Generating /etc/gitlab/gitlab-secrets.json file

================================================================================
Recipe Compile Error in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/config.rb

NoMethodError

undefined method `gsub’ for nil:NilClass

  redirect_uri = Gitlab['gitlab_pages']['auth_redirect_uri'].gsub('.', '\.')
                                                            ^^^^^

Cookbook Trace: (most recent call first)

/opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab-pages/libraries/gitlab_pages.rb:153:in parse_namespace_in_path' /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab-pages/libraries/gitlab_pages.rb:33:in parse_variables’
/opt/gitlab/embedded/cookbooks/cache/cookbooks/package/libraries/settings_dsl.rb:208:in block in generate_config' /opt/gitlab/embedded/cookbooks/cache/cookbooks/package/libraries/settings_dsl.rb:206:in each’
/opt/gitlab/embedded/cookbooks/cache/cookbooks/package/libraries/settings_dsl.rb:206:in generate_config' /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/config.rb:35:in from_file’

Relevant File Content:

/opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab-pages/libraries/gitlab_pages.rb:

146: # If GitLab Pages isn’t enabled or namespace_in_path is isn’t enabled, do nothing.
147: return unless Gitlab[‘gitlab_pages’][‘enable’] && Gitlab[‘gitlab_pages’][‘namespace_in_path’]
148:
149: Gitlab[‘pages_nginx’][‘namespace_in_path’] = Gitlab[‘gitlab_pages’][‘namespace_in_path’]
150: url_scheme = Gitlab[‘gitlab_rails’][‘pages_https’] ? ‘https’ : ‘http’
151:
152: pages_port = Gitlab[‘gitlab_rails’][‘pages_port’]
153>> redirect_uri = Gitlab[‘gitlab_pages’][‘auth_redirect_uri’].gsub(‘.’, ‘.’)
154: # Add the following when pages_port is not 80 or 443
155: Gitlab[‘pages_nginx’][‘proxy_redirect’] =
156: if [80, 443].include?(pages_port)
157: {
158: “~^(#{redirect_uri})(.)$" => “$1$2”,
159: "~^#{url_scheme}://([^/]
)\.(#{Gitlab[‘pages_nginx’][‘fqdn_regex’]})/(.)$" => “#{url_scheme}://$2/$1/$3”,
160: "~^//([^/]
)\.(#{Gitlab[‘pages_nginx’][‘fqdn_regex’]})/(.)$" => “/$1/$3”,
161: "~^/(.
)$” => “/$namespace/$1”,
162: }

System Info:

chef_version=18.3.0
platform=debian
platform_version=12
ruby=ruby 3.1.5p253 (2024-04-023 revision 1945f8dc0e) [x86_64-linux]
program_name=/opt/gitlab/embedded/bin/cinc-client
executable=/opt/gitlab/embedded/bin/cinc-client
Running handlers:
[2024-05-22T18:26:08-05:00] ERROR: Running exception handlers
Running handlers complete
[2024-05-22T18:26:08-05:00] ERROR: Exception handlers complete
Infra Phase failed. 0 resources updated in 02 seconds
[2024-05-22T18:26:08-05:00] FATAL: Stacktrace dumped to /opt/gitlab/embedded/cookbooks/cache/cinc-stacktrace.out
[2024-05-22T18:26:08-05:00] FATAL: ---------------------------------------------------------------------------------------
[2024-05-22T18:26:08-05:00] FATAL: PLEASE PROVIDE THE CONTENTS OF THE stacktrace.out FILE (above) IF YOU FILE A BUG REPORT
[2024-05-22T18:26:08-05:00] FATAL: ---------------------------------------------------------------------------------------
[2024-05-22T18:26:08-05:00] FATAL: NoMethodError: undefined method `gsub’ for nil:NilClass

  redirect_uri = Gitlab['gitlab_pages']['auth_redirect_uri'].gsub('.', '\.')
                                                            ^^^^^

Checking PostgreSQL executables: NOT OK
Could not update PostgreSQL executables.

  • Consider including screenshots, error messages, and/or other helpful visuals

Steps to reproduce

Which troubleshooting steps have you already taken? Can you link to any docs or other resources so we know where you have been?

internet search for others having the same issue with the upgrade.

Configuration

Provide screenshots from the GitLab UI showing relevant configuration, if applicable.
On self-managed instances, add the relevant configuration settings or changes.

Versions

Please select whether options apply, and add the version information.

Versions

System information
System: Debian 12
Current User: git
Using RVM: no
Ruby Version: 3.1.5p253
Gem Version: 3.5.9
Bundler Version:2.5.9
Rake Version: 13.0.6
Redis Version: 7.0.15
Sidekiq Version:7.1.6
Go Version: unknown

GitLab information
Version: 17.0.1
Revision: bd824d1abb2
Directory: /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: PostgreSQL
DB Version: 14.11GitLab Shell
Version: 14.35.0
Repository storages:

  • default: unix:/var/opt/gitlab/gitaly/gitaly.socket
    GitLab Shell path: /opt/gitlab/embedded/service/gitlab-shell

Gitaly

  • default Address: unix:/var/opt/gitlab/gitaly/gitaly.socket
  • default Version: 16.11.3
  • default Git Version: 2.43.4

Helpful resources

  1. Before opening a new topic, make sure to search for keywords in the forum search
  2. Check the GitLab project for existing issues. If you encounter a bug, please create a bug report issue.
  3. Troubleshooting docs: Self-managed GitLab instances.

Thanks for taking the time to be thorough in your request, it really helps! :blush:

1 Like

Same here, it disappears if I set auth_redirect_uri manually or enable access_control.

Ah thanks, this fix must have had a regression Omnibus generates invalid gitlab-pages-config: "auth-redirect-uri must be defined if authentication is supported" (#5954) ¡ Issues ¡ GitLab.org / omnibus-gitlab ¡ GitLab