diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-07-19 17:16:28 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-07-19 17:16:28 +0300 |
commit | e4384360a16dd9a19d4d2d25d0ef1f2b862ed2a6 (patch) | |
tree | 2fcdfa7dcdb9db8f5208b2562f4b4e803d671243 /scripts/utils.sh | |
parent | ffda4e7bcac36987f936b4ba515995a6698698f0 (diff) |
Add latest changes from gitlab-org/gitlab@16-2-stable-eev16.2.0-rc42
Diffstat (limited to 'scripts/utils.sh')
-rw-r--r-- | scripts/utils.sh | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/scripts/utils.sh b/scripts/utils.sh index edfcf0f2dac..800b81f1dea 100644 --- a/scripts/utils.sh +++ b/scripts/utils.sh @@ -127,6 +127,50 @@ function assets_compile_script() { section_end "assets-compile" } +function setup_database_yml() { + if [ "$DECOMPOSED_DB" == "true" ]; then + if [ "$CLUSTERWIDE_DB" == "true" ]; then + echo "Using decomposed database config, containing clusterwide connection (config/database.yml.decomposed-clusterwide-postgresql)" + cp config/database.yml.decomposed-clusterwide-postgresql config/database.yml + else + echo "Using decomposed database config (config/database.yml.decomposed-postgresql)" + cp config/database.yml.decomposed-postgresql config/database.yml + fi + else + echo "Using two connections, single database config (config/database.yml.postgresql)" + cp config/database.yml.postgresql config/database.yml + + if [ "$CI_CONNECTION_DB" != "true" ]; then + echo "Disabling ci connection in config/database.yml" + sed -i "/ci:$/, /geo:$/ {s|^|#|;s|# geo:| geo:|;}" config/database.yml + fi + fi + + # Set up Geo database if the job name matches `rspec-ee` or `geo`. + # Since Geo is an EE feature, we shouldn't set it up for non-EE tests. + if [[ "${CI_JOB_NAME}" =~ "rspec-ee" ]] || [[ "${CI_JOB_NAME}" =~ "geo" ]]; then + echoinfo "Geo DB will be set up." + else + echoinfo "Geo DB won't be set up." + sed -i '/geo:/,/^$/d' config/database.yml + fi + + # Set up Embedding database if the job name matches `rspec-ee` + # Since Embedding is an EE feature, we shouldn't set it up for non-EE tests. + if [[ "${CI_JOB_NAME}" =~ "rspec-ee" ]]; then + echoinfo "Embedding DB will be set up." + else + echoinfo "Embedding DB won't be set up." + sed -i '/embedding:/,/^$/d' config/database.yml + fi + + # Set user to a non-superuser to ensure we test permissions + sed -i 's/username: root/username: gitlab/g' config/database.yml + + sed -i 's/localhost/postgres/g' config/database.yml + sed -i 's/username: git/username: postgres/g' config/database.yml +} + function setup_db_user_only() { source scripts/create_postgres_user.sh } @@ -162,6 +206,10 @@ function install_junit_merge_gem() { run_timed_command "gem install junit_merge --no-document --version 0.1.2" } +function select_existing_files() { + ruby -e 'print $stdin.read.split(" ").select { |f| File.exist?(f) }.join(" ")' +} + function fail_on_warnings() { local cmd="$*" local warning_file |