postgresql_extension[pg_trgm] ordering problem in ee nightly
Summary
gitlab_rails['enable'] = false
breaks postgresql_extension[pg_trgm]
There is an attempt to load an extension into a database that hasn't been created
Steps to reproduce
-
Install gitlab-ee-10.4.0+rnightly.74605.a11fe033-0.el7.x86_64 on a fresh redhat7 vm
-
Add
gitlab_rails['enable'] = false
to the gitlab.rb
$ egrep '^[^#]' /etc/gitlab/gitlab.rb
external_url 'http://gitlab.example.com'
gitlab_rails['enable'] = false
- Run
gitlab-ctl reconfigure
What is the current bug behavior?
Reconfigure retries loading pg_trgm extension into database that has not been created, then fails:
Running handlers:
There was an error running gitlab-ctl reconfigure:
postgresql_extension[pg_trgm] (gitlab::postgresql line 213) had an error: Mixlib::ShellOut::ShellCommandFailed: postgresql_query[enable pg_trgm extension] (/opt/gitlab/embedded/cookbooks/cache/cookbooks/postgresql/resources/extension.rb line 6) had an error: Mixlib::ShellOut::ShellCommandFailed: execute[enable pg_trgm extension (gitlab-psql)] (/opt/gitlab/embedded/cookbooks/cache/cookbooks/postgresql/resources/query.rb line 11) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '2'
---- Begin output of /opt/gitlab/bin/gitlab-psql -d gitlabhq_production -c "CREATE EXTENSION IF NOT EXISTS pg_trgm" ----
STDOUT:
STDERR: psql: FATAL: database "gitlabhq_production" does not exist
---- End output of /opt/gitlab/bin/gitlab-psql -d gitlabhq_production -c "CREATE EXTENSION IF NOT EXISTS pg_trgm" ----
Ran /opt/gitlab/bin/gitlab-psql -d gitlabhq_production -c "CREATE EXTENSION IF NOT EXISTS pg_trgm" returned 2
Running handlers complete
Chef Client failed. 81 resources updated in 01 minutes 16 seconds
What is the expected correct behavior?
Either a successful run, or a reproduction of #2670 (closed)
Relevant logs
Tail of gitlab-ctl reconfigure:
Running handlers:
There was an error running gitlab-ctl reconfigure:
postgresql_extension[pg_trgm] (gitlab::postgresql line 213) had an error: Mixlib::ShellOut::ShellCommandFailed: postgresql_query[enable pg_trgm extension] (/opt/gitlab/embedd
ed/cookbooks/cache/cookbooks/postgresql/resources/extension.rb line 6) had an error: Mixlib::ShellOut::ShellCommandFailed: execute[enable pg_trgm extension (gitlab-psql)] (/o
pt/gitlab/embedded/cookbooks/cache/cookbooks/postgresql/resources/query.rb line 11) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but
received '2'
---- Begin output of /opt/gitlab/bin/gitlab-psql -d gitlabhq_production -c "CREATE EXTENSION IF NOT EXISTS pg_trgm" ----
STDOUT:
STDERR: psql: FATAL: database "gitlabhq_production" does not exist
---- End output of /opt/gitlab/bin/gitlab-psql -d gitlabhq_production -c "CREATE EXTENSION IF NOT EXISTS pg_trgm" ----
Ran /opt/gitlab/bin/gitlab-psql -d gitlabhq_production -c "CREATE EXTENSION IF NOT EXISTS pg_trgm" returned 2
/var/log/gitlab/reconfigure/1516100971.log
: should be attached1516100971.log
Details of package version
# rpm -qa gitlab-ee
gitlab-ee-10.4.0+rnightly.74605.a11fe033-0.el7.x86_64
Environment details
- Operating System:
centos/7
- Installation Target, remove incorrect values:
- VM: Virtualbox running centos/7 vagrant box. https://app.vagrantup.com/centos/boxes/7
- Installation Type, remove incorrect values:
- New Installation
- Is there any other software running on the machine: No
- Is this a single or multiple node installation? Single
- Resources
- CPU:
REPLACE-WITH-DETAILS
- Memory total:
REPLACE-WITH-DETAILS
- CPU:
Vagrant.configure("2") do |config|
config.vm.box = "centos/7"
config.vm.provider "virtualbox" do |vb|
vb.memory = 2048
vb.cpus = 2
end
config.vm.provision "shell", inline: <<-SHELL
curl -s https://packages.gitlab.com/install/repositories/gitlab/nightly-builds/script.rpm.sh | bash
SHELL
end
Configuration details
$ egrep '^[^#]' /etc/gitlab/gitlab.rb
external_url 'http://gitlab.example.com'
gitlab_rails['enable'] = false
Edited by Richard Clamp