diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-25 18:07:58 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-25 18:07:58 +0300 |
commit | 0d8e625e4cd499162e6113dca4988b28f9faa9b6 (patch) | |
tree | 8744ab9fdba76e924f15272bba473521e39b8760 /scripts | |
parent | b5249f2d99206a72459bc5e2bf2aeb2f06ee36f3 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/gemfile_lock_changed.sh | 2 | ||||
-rwxr-xr-x | scripts/lint-changelog-filenames | 4 | ||||
-rw-r--r-- | scripts/sync-stable-branch.sh | 54 | ||||
-rw-r--r-- | scripts/utils.sh | 26 |
4 files changed, 43 insertions, 43 deletions
diff --git a/scripts/gemfile_lock_changed.sh b/scripts/gemfile_lock_changed.sh index 24e2c685f11..eec31af1f77 100755 --- a/scripts/gemfile_lock_changed.sh +++ b/scripts/gemfile_lock_changed.sh @@ -2,7 +2,7 @@ gemfile_lock_changed() { if [ -n "$(git diff --name-only -- Gemfile.lock)" ]; then - cat << EOF + cat <<EOF Gemfile was updated but Gemfile.lock was not updated. Usually, when Gemfile is updated, you should run diff --git a/scripts/lint-changelog-filenames b/scripts/lint-changelog-filenames index 2355ac6f7b2..fc07b7153aa 100755 --- a/scripts/lint-changelog-filenames +++ b/scripts/lint-changelog-filenames @@ -6,7 +6,7 @@ lint_paths="changelogs/unreleased" invalid_files=$(find $lint_paths -type f -not -name "*.yml" -not -name ".gitkeep") if [ -n "$invalid_files" ]; then - echo "Changelog files must end in .yml, but these did not:" - echo "$invalid_files" | sed -e "s/^/* /" + echo "Changelog files must end in .yml, but these did not:" + echo "$invalid_files" | sed -e "s/^/* /" exit 1 fi diff --git a/scripts/sync-stable-branch.sh b/scripts/sync-stable-branch.sh index 5aaec323628..59ab52844fb 100644 --- a/scripts/sync-stable-branch.sh +++ b/scripts/sync-stable-branch.sh @@ -7,56 +7,56 @@ set -e if [[ "$MERGE_TRAIN_TRIGGER_TOKEN" == '' ]] then - echo 'The variable MERGE_TRAIN_TRIGGER_TOKEN must be set to a non-empty value' - exit 1 + echo 'The variable MERGE_TRAIN_TRIGGER_TOKEN must be set to a non-empty value' + exit 1 fi if [[ "$MERGE_TRAIN_TRIGGER_URL" == '' ]] then - echo 'The variable MERGE_TRAIN_TRIGGER_URL must be set to a non-empty value' - exit 1 + echo 'The variable MERGE_TRAIN_TRIGGER_URL must be set to a non-empty value' + exit 1 fi if [[ "$CI_COMMIT_REF_NAME" == '' ]] then - echo 'The variable CI_COMMIT_REF_NAME must be set to a non-empty value' - exit 1 + echo 'The variable CI_COMMIT_REF_NAME must be set to a non-empty value' + exit 1 fi if [[ "$SOURCE_PROJECT" == '' ]] then - echo 'The variable SOURCE_PROJECT must be set to a non-empty value' - exit 1 + echo 'The variable SOURCE_PROJECT must be set to a non-empty value' + exit 1 fi if [[ "$TARGET_PROJECT" == '' ]] then - echo 'The variable TARGET_PROJECT must be set to a non-empty value' - exit 1 + echo 'The variable TARGET_PROJECT must be set to a non-empty value' + exit 1 fi if [[ "$TARGET_PROJECT" != "gitlab-org/gitlab-foss" ]] then - echo 'This is a security FOSS merge train' - echo "Checking if $CI_COMMIT_SHA is available on canonical" + echo 'This is a security FOSS merge train' + echo "Checking if $CI_COMMIT_SHA is available on canonical" - gitlab_com_commit_status=$(curl -s "https://gitlab.com/api/v4/projects/278964/repository/commits/$CI_COMMIT_SHA" | jq -M .status) + gitlab_com_commit_status=$(curl -s "https://gitlab.com/api/v4/projects/278964/repository/commits/$CI_COMMIT_SHA" | jq -M .status) - if [[ "$gitlab_com_commit_status" != "null" ]] - then - echo 'Commit available on canonical, skipping merge train' - exit 0 - fi + if [[ "$gitlab_com_commit_status" != "null" ]] + then + echo 'Commit available on canonical, skipping merge train' + exit 0 + fi - echo 'Commit not available, triggering a merge train' + echo 'Commit not available, triggering a merge train' fi curl -X POST \ - -F token="$MERGE_TRAIN_TRIGGER_TOKEN" \ - -F ref=master \ - -F "variables[MERGE_FOSS]=1" \ - -F "variables[SOURCE_BRANCH]=$CI_COMMIT_REF_NAME" \ - -F "variables[TARGET_BRANCH]=${CI_COMMIT_REF_NAME/-ee/}" \ - -F "variables[SOURCE_PROJECT]=$SOURCE_PROJECT" \ - -F "variables[TARGET_PROJECT]=$TARGET_PROJECT" \ - "$MERGE_TRAIN_TRIGGER_URL" + -F token="$MERGE_TRAIN_TRIGGER_TOKEN" \ + -F ref=master \ + -F "variables[MERGE_FOSS]=1" \ + -F "variables[SOURCE_BRANCH]=$CI_COMMIT_REF_NAME" \ + -F "variables[TARGET_BRANCH]=${CI_COMMIT_REF_NAME/-ee/}" \ + -F "variables[SOURCE_PROJECT]=$SOURCE_PROJECT" \ + -F "variables[TARGET_PROJECT]=$TARGET_PROJECT" \ + "$MERGE_TRAIN_TRIGGER_URL" diff --git a/scripts/utils.sh b/scripts/utils.sh index 897f8d5a8b8..f81e5c8982a 100644 --- a/scripts/utils.sh +++ b/scripts/utils.sh @@ -1,25 +1,25 @@ function retry() { + if eval "$@"; then + return 0 + fi + + for i in 2 1; do + sleep 3s + echo "Retrying $i..." if eval "$@"; then - return 0 + return 0 fi - - for i in 2 1; do - sleep 3s - echo "Retrying $i..." - if eval "$@"; then - return 0 - fi - done - return 1 + done + return 1 } function setup_db_user_only() { - source scripts/create_postgres_user.sh + source scripts/create_postgres_user.sh } function setup_db() { - run_timed_command "setup_db_user_only" - run_timed_command "bundle exec rake db:drop db:create db:structure:load db:migrate gitlab:db:setup_ee" + run_timed_command "setup_db_user_only" + run_timed_command "bundle exec rake db:drop db:create db:structure:load db:migrate gitlab:db:setup_ee" } function install_api_client_dependencies_with_apk() { |