From 3e1bd5570f0ca277fb82a45d83f5bf44f3663a0d Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Wed, 22 Mar 2017 22:31:07 +0800 Subject: Test both PostgreSQL and MySQL for the win. --- scripts/prepare_build.sh | 48 ++++++++++++++++++++++++++++++------------------ scripts/utils.sh | 14 ++++++++++++++ 2 files changed, 44 insertions(+), 18 deletions(-) create mode 100644 scripts/utils.sh (limited to 'scripts') diff --git a/scripts/prepare_build.sh b/scripts/prepare_build.sh index 6e3f76b8399..822bb83e6c4 100755 --- a/scripts/prepare_build.sh +++ b/scripts/prepare_build.sh @@ -1,25 +1,21 @@ #!/bin/sh -retry() { - if eval "$@"; then - return 0 - fi +. scripts/utils.sh - for i in 2 1; do - sleep 3s - echo "Retrying $i..." - if eval "$@"; then - return 0 - fi - done - return 1 -} +export SETUP_DB=${SETUP_DB:-true} +export GITLAB_DATABASE=${GITLAB_DATABASE:-postgresql} +export USE_BUNDLE_INSTALL=${USE_BUNDLE_INSTALL:-true} if [ -f /.dockerenv ] || [ -f ./dockerinit ]; then - cp config/database.yml.mysql config/database.yml - sed -i 's/username:.*/username: root/g' config/database.yml - sed -i 's/password:.*/password:/g' config/database.yml - sed -i 's/# socket:.*/host: mysql/g' config/database.yml + cp config/database.yml.$GITLAB_DATABASE config/database.yml + + if [ "$GITLAB_DATABASE" = 'postgresql' ]; then + sed -i 's/# host:.*/host: postgres/g' config/database.yml + else # assume it's mysql + sed -i 's/username:.*/username: root/g' config/database.yml + sed -i 's/password:.*/password:/g' config/database.yml + sed -i 's/# socket:.*/host: mysql/g' config/database.yml + fi cp config/resque.yml.example config/resque.yml sed -i 's/localhost/redis/g' config/resque.yml @@ -28,8 +24,24 @@ if [ -f /.dockerenv ] || [ -f ./dockerinit ]; then else rnd=$(awk 'BEGIN { srand() ; printf("%d\n",rand()*5) }') export PATH="$HOME/bin:/usr/local/bin:/usr/bin:/bin" - cp config/database.yml.mysql config/database.yml + cp config/database.yml.$GITLAB_DATABASE config/database.yml sed "s/username\:.*$/username\: runner/" -i config/database.yml sed "s/password\:.*$/password\: 'password'/" -i config/database.yml sed "s/gitlabhq_test/gitlabhq_test_$rnd/" -i config/database.yml fi + +cp config/gitlab.yml.example config/gitlab.yml + +if [ "$USE_BUNDLE_INSTALL" != "false" ]; then + retry bundle install --without production --jobs $(nproc) --clean $FLAGS +fi + +retry gem install knapsack + +if [ "$SETUP_DB" != "false" ]; then + bundle exec rake db:drop db:create db:schema:load db:migrate + + if [ "$GITLAB_DATABASE" = "mysql" ]; then + bundle exec rake add_limits_mysql + fi +fi diff --git a/scripts/utils.sh b/scripts/utils.sh new file mode 100644 index 00000000000..6faa701f0ce --- /dev/null +++ b/scripts/utils.sh @@ -0,0 +1,14 @@ +retry() { + if eval "$@"; then + return 0 + fi + + for i in 2 1; do + sleep 3s + echo "Retrying $i..." + if eval "$@"; then + return 0 + fi + done + return 1 +} -- cgit v1.2.1 From d0c44ee1e2d3a747a2092d60067cd96578089fb4 Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Fri, 24 Mar 2017 05:27:02 +0800 Subject: Note that install knapsack later than bundle install Otherwise oddly some native gems could not be found under some circumstance. No idea why, hours wasted. --- scripts/prepare_build.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/prepare_build.sh b/scripts/prepare_build.sh index 822bb83e6c4..885b7eabba0 100755 --- a/scripts/prepare_build.sh +++ b/scripts/prepare_build.sh @@ -11,7 +11,7 @@ if [ -f /.dockerenv ] || [ -f ./dockerinit ]; then if [ "$GITLAB_DATABASE" = 'postgresql' ]; then sed -i 's/# host:.*/host: postgres/g' config/database.yml - else # assume it's mysql + else # Assume it's mysql sed -i 's/username:.*/username: root/g' config/database.yml sed -i 's/password:.*/password:/g' config/database.yml sed -i 's/# socket:.*/host: mysql/g' config/database.yml @@ -36,6 +36,8 @@ if [ "$USE_BUNDLE_INSTALL" != "false" ]; then retry bundle install --without production --jobs $(nproc) --clean $FLAGS fi +# Only install knapsack after bundle install! Otherwise oddly some native +# gems could not be found under some circumstance. No idea why, hours wasted. retry gem install knapsack if [ "$SETUP_DB" != "false" ]; then -- cgit v1.2.1 From f86edca66c2baa9fd8b0cdb0d89e961a30c78716 Mon Sep 17 00:00:00 2001 From: bogdanvlviv Date: Wed, 5 Apr 2017 13:07:25 +0300 Subject: Remove unused code from the scripts/prepare_build.sh file --- scripts/prepare_build.sh | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) (limited to 'scripts') diff --git a/scripts/prepare_build.sh b/scripts/prepare_build.sh index 6e3f76b8399..6cacb81b8bc 100755 --- a/scripts/prepare_build.sh +++ b/scripts/prepare_build.sh @@ -15,21 +15,12 @@ retry() { return 1 } -if [ -f /.dockerenv ] || [ -f ./dockerinit ]; then - cp config/database.yml.mysql config/database.yml - sed -i 's/username:.*/username: root/g' config/database.yml - sed -i 's/password:.*/password:/g' config/database.yml - sed -i 's/# socket:.*/host: mysql/g' config/database.yml +cp config/database.yml.mysql config/database.yml +sed -i 's/username:.*/username: root/g' config/database.yml +sed -i 's/password:.*/password:/g' config/database.yml +sed -i 's/# socket:.*/host: mysql/g' config/database.yml - cp config/resque.yml.example config/resque.yml - sed -i 's/localhost/redis/g' config/resque.yml +cp config/resque.yml.example config/resque.yml +sed -i 's/localhost/redis/g' config/resque.yml - export FLAGS="--path vendor --retry 3 --quiet" -else - rnd=$(awk 'BEGIN { srand() ; printf("%d\n",rand()*5) }') - export PATH="$HOME/bin:/usr/local/bin:/usr/bin:/bin" - cp config/database.yml.mysql config/database.yml - sed "s/username\:.*$/username\: runner/" -i config/database.yml - sed "s/password\:.*$/password\: 'password'/" -i config/database.yml - sed "s/gitlabhq_test/gitlabhq_test_$rnd/" -i config/database.yml -fi +export FLAGS="--path vendor --retry 3 --quiet" -- cgit v1.2.1 From a9945a6500351331426226efe80631f81cb832aa Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Mon, 10 Apr 2017 18:41:35 +0800 Subject: Replace on host rather than socket, feedback: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/10156#note_26812377 --- scripts/prepare_build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/prepare_build.sh b/scripts/prepare_build.sh index f170743aea3..b8d8cc2851a 100755 --- a/scripts/prepare_build.sh +++ b/scripts/prepare_build.sh @@ -14,7 +14,7 @@ if [ -f /.dockerenv ] || [ -f ./dockerinit ]; then else # Assume it's mysql sed -i 's/username:.*/username: root/g' config/database.yml sed -i 's/password:.*/password:/g' config/database.yml - sed -i 's/# socket:.*/host: mysql/g' config/database.yml + sed -i 's/# host:.*/host: mysql/g' config/database.yml fi cp config/resque.yml.example config/resque.yml -- cgit v1.2.1 From f1e2387e2851009cf2091ab22b3d6a70a27dfa1e Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Mon, 10 Apr 2017 19:09:02 +0800 Subject: Use GITLAB_DATABASE: $CI_JOB_NAME[1] so that we reduce variables definitions. Feedback: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/10156#note_26811996 --- scripts/prepare_build.sh | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'scripts') diff --git a/scripts/prepare_build.sh b/scripts/prepare_build.sh index b8d8cc2851a..2b041892eab 100755 --- a/scripts/prepare_build.sh +++ b/scripts/prepare_build.sh @@ -6,6 +6,10 @@ export SETUP_DB=${SETUP_DB:-true} export GITLAB_DATABASE=${GITLAB_DATABASE:-postgresql} export USE_BUNDLE_INSTALL=${USE_BUNDLE_INSTALL:-true} +if [ "$GITLAB_DATABASE" = 'pg' ]; then + export GITLAB_DATABASE='postgresql' +fi + if [ -f /.dockerenv ] || [ -f ./dockerinit ]; then cp config/database.yml.$GITLAB_DATABASE config/database.yml -- cgit v1.2.1 From c78f03ae6ef446e9862e185eba2dc3116b04fdb5 Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Mon, 10 Apr 2017 21:59:53 +0800 Subject: We cannot use array in yaml variables --- scripts/prepare_build.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/prepare_build.sh b/scripts/prepare_build.sh index 2b041892eab..48b046116e4 100755 --- a/scripts/prepare_build.sh +++ b/scripts/prepare_build.sh @@ -2,11 +2,15 @@ . scripts/utils.sh +echo $CI_JOB_NAME +job_name=$(echo $CI_JOB_NAME | cut -f2 -d' ') +echo $job_name + export SETUP_DB=${SETUP_DB:-true} -export GITLAB_DATABASE=${GITLAB_DATABASE:-postgresql} +export GITLAB_DATABASE=${GITLAB_DATABASE:-$job_name} export USE_BUNDLE_INSTALL=${USE_BUNDLE_INSTALL:-true} -if [ "$GITLAB_DATABASE" = 'pg' ]; then +if [ "$GITLAB_DATABASE" != 'mysql' ]; then export GITLAB_DATABASE='postgresql' fi -- cgit v1.2.1 From 5e6d09edba4c782237544ac46edc320a27bcd98f Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Tue, 11 Apr 2017 01:56:30 +0800 Subject: Just set GITLAB_DATABASE in the script --- scripts/prepare_build.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'scripts') diff --git a/scripts/prepare_build.sh b/scripts/prepare_build.sh index 48b046116e4..81fdf753c4e 100755 --- a/scripts/prepare_build.sh +++ b/scripts/prepare_build.sh @@ -2,12 +2,8 @@ . scripts/utils.sh -echo $CI_JOB_NAME -job_name=$(echo $CI_JOB_NAME | cut -f2 -d' ') -echo $job_name - export SETUP_DB=${SETUP_DB:-true} -export GITLAB_DATABASE=${GITLAB_DATABASE:-$job_name} +export GITLAB_DATABASE=$(echo $CI_JOB_NAME | cut -f2 -d' ') export USE_BUNDLE_INSTALL=${USE_BUNDLE_INSTALL:-true} if [ "$GITLAB_DATABASE" != 'mysql' ]; then -- cgit v1.2.1 From 11ef3154bbd7073a3083e05a79f4bf022ccd6859 Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Thu, 13 Apr 2017 15:48:25 +0800 Subject: Always use . and add more comments to prepare_build.sh --- scripts/prepare_build.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/prepare_build.sh b/scripts/prepare_build.sh index b176830ffb4..8c5ffe92960 100755 --- a/scripts/prepare_build.sh +++ b/scripts/prepare_build.sh @@ -3,9 +3,14 @@ . scripts/utils.sh export SETUP_DB=${SETUP_DB:-true} -export GITLAB_DATABASE=$(echo $CI_JOB_NAME | cut -f2 -d' ') export USE_BUNDLE_INSTALL=${USE_BUNDLE_INSTALL:-true} +# Determine the database by looking at the job name. +# For example, we'll get pg if the job is `rspec pg 19 20` +export GITLAB_DATABASE=$(echo $CI_JOB_NAME | cut -f2 -d' ') + +# This would make the default database postgresql, and we could also use +# pg to mean postgresql. if [ "$GITLAB_DATABASE" != 'mysql' ]; then export GITLAB_DATABASE='postgresql' fi -- cgit v1.2.1 From 075d2bacfd6e9d34763ac905c45c8a7dc1278c35 Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Thu, 13 Apr 2017 16:02:36 +0800 Subject: Properly use $BUNDLE_INSTALL_FLAGS --- scripts/prepare_build.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/prepare_build.sh b/scripts/prepare_build.sh index 8c5ffe92960..de7379425cf 100755 --- a/scripts/prepare_build.sh +++ b/scripts/prepare_build.sh @@ -4,6 +4,7 @@ export SETUP_DB=${SETUP_DB:-true} export USE_BUNDLE_INSTALL=${USE_BUNDLE_INSTALL:-true} +export BUNDLE_INSTALL_FLAGS="--without production --jobs $(nproc) --path vendor --retry 3 --quiet" # Determine the database by looking at the job name. # For example, we'll get pg if the job is `rspec pg 19 20` @@ -31,7 +32,7 @@ sed -i 's/localhost/redis/g' config/resque.yml cp config/gitlab.yml.example config/gitlab.yml if [ "$USE_BUNDLE_INSTALL" != "false" ]; then - retry bundle install --without production --jobs $(nproc) --clean $FLAGS + retry bundle install --clean $BUNDLE_INSTALL_FLAGS fi # Only install knapsack after bundle install! Otherwise oddly some native @@ -45,5 +46,3 @@ if [ "$SETUP_DB" != "false" ]; then bundle exec rake add_limits_mysql fi fi - -export FLAGS="--path vendor --retry 3 --quiet" -- cgit v1.2.1 From b45b08cbbfeabdd0a7d0f1c03a2584e58ebe684b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Wed, 26 Apr 2017 17:37:01 +0200 Subject: Run `bundle check` after `bundle install` instead of having a dedicated job for it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rémy Coutable --- scripts/prepare_build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/prepare_build.sh b/scripts/prepare_build.sh index de7379425cf..fd173c0ba88 100755 --- a/scripts/prepare_build.sh +++ b/scripts/prepare_build.sh @@ -32,7 +32,7 @@ sed -i 's/localhost/redis/g' config/resque.yml cp config/gitlab.yml.example config/gitlab.yml if [ "$USE_BUNDLE_INSTALL" != "false" ]; then - retry bundle install --clean $BUNDLE_INSTALL_FLAGS + retry bundle install --clean $BUNDLE_INSTALL_FLAGS && bundle check fi # Only install knapsack after bundle install! Otherwise oddly some native -- cgit v1.2.1 From fe57708e6a0f2b09d95e61130310c826b3437524 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Fri, 28 Apr 2017 18:05:39 +0000 Subject: Resolve "rspec_profiling is enabled for MySQL" --- scripts/prepare_build.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) mode change 100755 => 100644 scripts/prepare_build.sh (limited to 'scripts') diff --git a/scripts/prepare_build.sh b/scripts/prepare_build.sh old mode 100755 new mode 100644 index fd173c0ba88..c727a0e2d88 --- a/scripts/prepare_build.sh +++ b/scripts/prepare_build.sh @@ -1,5 +1,3 @@ -#!/bin/sh - . scripts/utils.sh export SETUP_DB=${SETUP_DB:-true} @@ -32,7 +30,7 @@ sed -i 's/localhost/redis/g' config/resque.yml cp config/gitlab.yml.example config/gitlab.yml if [ "$USE_BUNDLE_INSTALL" != "false" ]; then - retry bundle install --clean $BUNDLE_INSTALL_FLAGS && bundle check + bundle install --clean $BUNDLE_INSTALL_FLAGS && bundle check fi # Only install knapsack after bundle install! Otherwise oddly some native -- cgit v1.2.1 From 336d79fbf9715839d7f969f00d51632282b91fa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Wed, 26 Apr 2017 18:54:48 +0200 Subject: Group static-analysis jobs into a single job MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rémy Coutable --- scripts/lint-doc.sh | 1 - 1 file changed, 1 deletion(-) (limited to 'scripts') diff --git a/scripts/lint-doc.sh b/scripts/lint-doc.sh index 62236ed539a..54c1ef3dfdd 100755 --- a/scripts/lint-doc.sh +++ b/scripts/lint-doc.sh @@ -21,4 +21,3 @@ fi echo "✔ Linting passed" exit 0 - -- cgit v1.2.1 From 9b3f728cca163e1e6c0a67b932bbd04f74896d87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Fri, 28 Apr 2017 17:31:18 +0200 Subject: Add scripts/static-analysis to run all the static analysers in one go MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rémy Coutable --- scripts/static-analysis | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 scripts/static-analysis (limited to 'scripts') diff --git a/scripts/static-analysis b/scripts/static-analysis new file mode 100755 index 00000000000..192d9d4c3ba --- /dev/null +++ b/scripts/static-analysis @@ -0,0 +1,40 @@ +#!/usr/bin/env ruby + +require ::File.expand_path('../lib/gitlab/popen', __dir__) + +tasks = [ + %w[bundle exec rake config_lint], + %w[bundle exec rake flay], + %w[bundle exec rake haml_lint], + %w[bundle exec rake scss_lint], + %w[bundle exec rake brakeman], + %w[bundle exec license_finder], + %w[scripts/lint-doc.sh], + %w[yarn run eslint], + %w[bundle exec rubocop --require rubocop-rspec] +] + +failed_tasks = tasks.reduce({}) do |failures, task| + output, status = Gitlab::Popen.popen(task) + + puts "Running: #{task.join(' ')}" + puts output + + failures[task.join(' ')] = output unless status.zero? + + failures +end + +if failed_tasks.empty? + puts 'All static analyses passed successfully.' +else + puts "\n===================================================\n\n" + puts "Some static analyses failed:" + + failed_tasks.each do |failed_task, output| + puts "\n**** #{failed_task} failed with the following error:\n\n" + puts output + end + + exit 1 +end -- cgit v1.2.1 From aafe288982811ac33d80547993c5b49930dd4bad Mon Sep 17 00:00:00 2001 From: Zeger-Jan van de Weg Date: Sun, 5 Mar 2017 18:19:08 +0000 Subject: Remove notify slack job --- scripts/notify_slack.sh | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100755 scripts/notify_slack.sh (limited to 'scripts') diff --git a/scripts/notify_slack.sh b/scripts/notify_slack.sh deleted file mode 100755 index 6b3bc563c7a..00000000000 --- a/scripts/notify_slack.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -# Sends Slack notification ERROR_MSG to CHANNEL -# An env. variable CI_SLACK_WEBHOOK_URL needs to be set. - -CHANNEL=$1 -ERROR_MSG=$2 - -if [ -z "$CHANNEL" ] || [ -z "$ERROR_MSG" ] || [ -z "$CI_SLACK_WEBHOOK_URL" ]; then - echo "Missing argument(s) - Use: $0 channel message" - echo "and set CI_SLACK_WEBHOOK_URL environment variable." -else - curl -X POST --data-urlencode 'payload={"channel": "'"$CHANNEL"'", "username": "gitlab-ci", "text": "'"$ERROR_MSG"'", "icon_emoji": ":gitlab:"}' "$CI_SLACK_WEBHOOK_URL" -fi \ No newline at end of file -- cgit v1.2.1 From c5bca70d550434001e544824ce182cce68a58677 Mon Sep 17 00:00:00 2001 From: Achilleas Pipinellis Date: Wed, 3 May 2017 16:40:43 +0000 Subject: Move api lint out of static analysis job --- scripts/static-analysis | 1 - 1 file changed, 1 deletion(-) (limited to 'scripts') diff --git a/scripts/static-analysis b/scripts/static-analysis index 192d9d4c3ba..1bd6b339830 100755 --- a/scripts/static-analysis +++ b/scripts/static-analysis @@ -9,7 +9,6 @@ tasks = [ %w[bundle exec rake scss_lint], %w[bundle exec rake brakeman], %w[bundle exec license_finder], - %w[scripts/lint-doc.sh], %w[yarn run eslint], %w[bundle exec rubocop --require rubocop-rspec] ] -- cgit v1.2.1 From 221dccab97766be810d87c6eb1d120145b41b364 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Thu, 4 May 2017 16:34:52 +0200 Subject: Include the bundler:audit job into the static-analysis job MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rémy Coutable --- scripts/static-analysis | 1 + 1 file changed, 1 insertion(+) (limited to 'scripts') diff --git a/scripts/static-analysis b/scripts/static-analysis index 1bd6b339830..7dc8f679036 100755 --- a/scripts/static-analysis +++ b/scripts/static-analysis @@ -3,6 +3,7 @@ require ::File.expand_path('../lib/gitlab/popen', __dir__) tasks = [ + %w[bundle exec bundle-audit check --update --ignore CVE-2016-4658], %w[bundle exec rake config_lint], %w[bundle exec rake flay], %w[bundle exec rake haml_lint], -- cgit v1.2.1 From e85aa42428e2ab77ed74317b481351197e34e1e3 Mon Sep 17 00:00:00 2001 From: Balasankar C Date: Tue, 9 May 2017 15:19:48 +0530 Subject: Move triggering build logic to separate script --- scripts/trigger-build | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 scripts/trigger-build (limited to 'scripts') diff --git a/scripts/trigger-build b/scripts/trigger-build new file mode 100755 index 00000000000..ccdb01c96ca --- /dev/null +++ b/scripts/trigger-build @@ -0,0 +1,18 @@ +#!/usr/bin/env ruby + +require 'net/http' +require 'json' + +uri = URI('https://gitlab.com/api/v4/projects/20699/trigger/pipeline') +params = { + "token" => ENV['BUILD_TRIGGER_TOKEN'], + "variables[GITLAB_VERSION]" => ENV['CI_COMMIT_SHA'], + "variables[ALTERNATIVE_SOURCES]" => true, +} +params['ref'] = ENV['OMNIBUS_BRANCH'] || "master" +Dir.glob("*_VERSION").each do |version_file| + params["variables[#{version_file}]"] = File.read(version_file).strip +end +res = Net::HTTP.post_form(uri, params) +pipeline_id = JSON.parse(res.body)['id'] +puts "Triggered pipeline can be found at https://gitlab.com/gitlab-org/omnibus-gitlab/pipelines/#{pipeline_id}" -- cgit v1.2.1 From 784941eee6fb3ce8b2cdccf2eb75e908a9b15d7a Mon Sep 17 00:00:00 2001 From: Balasankar C Date: Tue, 9 May 2017 18:51:32 +0530 Subject: Improve readability of code --- scripts/trigger-build | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/trigger-build b/scripts/trigger-build index ccdb01c96ca..741e6361f01 100755 --- a/scripts/trigger-build +++ b/scripts/trigger-build @@ -5,14 +5,17 @@ require 'json' uri = URI('https://gitlab.com/api/v4/projects/20699/trigger/pipeline') params = { - "token" => ENV['BUILD_TRIGGER_TOKEN'], - "variables[GITLAB_VERSION]" => ENV['CI_COMMIT_SHA'], + "ref" => ENV["OMNIBUS_BRANCH"] || "master", + "token" => ENV["BUILD_TRIGGER_TOKEN"], + "variables[GITLAB_VERSION]" => ENV["CI_COMMIT_SHA"], "variables[ALTERNATIVE_SOURCES]" => true, } -params['ref'] = ENV['OMNIBUS_BRANCH'] || "master" + Dir.glob("*_VERSION").each do |version_file| params["variables[#{version_file}]"] = File.read(version_file).strip end + res = Net::HTTP.post_form(uri, params) pipeline_id = JSON.parse(res.body)['id'] + puts "Triggered pipeline can be found at https://gitlab.com/gitlab-org/omnibus-gitlab/pipelines/#{pipeline_id}" -- cgit v1.2.1 From d40e1f547ea9e31e822229bb808aaa6b9201f473 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Wed, 3 May 2017 13:22:03 +0200 Subject: Enable the Style/TrailingCommaInLiteral cop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use the EnforcedStyleForMultiline: no_comma option. Signed-off-by: Rémy Coutable --- scripts/trigger-build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/trigger-build b/scripts/trigger-build index 741e6361f01..565bc314ef1 100755 --- a/scripts/trigger-build +++ b/scripts/trigger-build @@ -8,7 +8,7 @@ params = { "ref" => ENV["OMNIBUS_BRANCH"] || "master", "token" => ENV["BUILD_TRIGGER_TOKEN"], "variables[GITLAB_VERSION]" => ENV["CI_COMMIT_SHA"], - "variables[ALTERNATIVE_SOURCES]" => true, + "variables[ALTERNATIVE_SOURCES]" => true } Dir.glob("*_VERSION").each do |version_file| -- cgit v1.2.1 From 6813c9ef5146e90b3a28dffaeef7f305d01e7587 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Tue, 2 May 2017 18:55:06 +0200 Subject: Move the DB name at the end of the first jobs' name word and prepend it with a dash MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rémy Coutable --- scripts/prepare_build.sh | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'scripts') diff --git a/scripts/prepare_build.sh b/scripts/prepare_build.sh index c727a0e2d88..03de59f27ad 100644 --- a/scripts/prepare_build.sh +++ b/scripts/prepare_build.sh @@ -4,9 +4,22 @@ export SETUP_DB=${SETUP_DB:-true} export USE_BUNDLE_INSTALL=${USE_BUNDLE_INSTALL:-true} export BUNDLE_INSTALL_FLAGS="--without production --jobs $(nproc) --path vendor --retry 3 --quiet" +if [ "$USE_BUNDLE_INSTALL" != "false" ]; then + bundle install --clean $BUNDLE_INSTALL_FLAGS && bundle check +fi + +# Only install knapsack after bundle install! Otherwise oddly some native +# gems could not be found under some circumstance. No idea why, hours wasted. +retry gem install knapsack fog-aws mime-types + +cp config/resque.yml.example config/resque.yml +sed -i 's/localhost/redis/g' config/resque.yml + +cp config/gitlab.yml.example config/gitlab.yml + # Determine the database by looking at the job name. -# For example, we'll get pg if the job is `rspec pg 19 20` -export GITLAB_DATABASE=$(echo $CI_JOB_NAME | cut -f2 -d' ') +# For example, we'll get pg if the job is `rspec-pg 19 20` +export GITLAB_DATABASE=$(echo $CI_JOB_NAME | cut -f1 -d' ' | cut -f2 -d-) # This would make the default database postgresql, and we could also use # pg to mean postgresql. @@ -24,19 +37,6 @@ else # Assume it's mysql sed -i 's/# host:.*/host: mysql/g' config/database.yml fi -cp config/resque.yml.example config/resque.yml -sed -i 's/localhost/redis/g' config/resque.yml - -cp config/gitlab.yml.example config/gitlab.yml - -if [ "$USE_BUNDLE_INSTALL" != "false" ]; then - bundle install --clean $BUNDLE_INSTALL_FLAGS && bundle check -fi - -# Only install knapsack after bundle install! Otherwise oddly some native -# gems could not be found under some circumstance. No idea why, hours wasted. -retry gem install knapsack fog-aws mime-types - if [ "$SETUP_DB" != "false" ]; then bundle exec rake db:drop db:create db:schema:load db:migrate -- cgit v1.2.1