diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-31 21:09:25 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-31 21:09:25 +0300 |
commit | 30b8ea126ffffc9bef610d38f8ebcd91bb687aba (patch) | |
tree | 3705b43015a6d3a1fd85864f1fc555383b8e248b /scripts/utils.sh | |
parent | a5519693560d1ac4e120e1afd7d806d13a2d09fd (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'scripts/utils.sh')
-rw-r--r-- | scripts/utils.sh | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/scripts/utils.sh b/scripts/utils.sh index ea2b390f249..5d18e724e5d 100644 --- a/scripts/utils.sh +++ b/scripts/utils.sh @@ -15,9 +15,11 @@ function retry() { function test_url() { local url="${1}" + local curl_args="${2}" local status + local cmd="curl ${curl_args} --output /dev/null -L -s -w ''%{http_code}'' \"${url}\"" - status=$(curl --output /dev/null -L -s -w ''%{http_code}'' "${url}") + status=$(eval "${cmd}") if [[ $status == "200" ]]; then return 0 @@ -203,3 +205,15 @@ function danger_as_local() { # We need to base SHA to help danger determine the base commit for this shallow clone. bundle exec danger dry_run --fail-on-errors=true --verbose --base="${CI_MERGE_REQUEST_DIFF_BASE_SHA}" --head="${CI_MERGE_REQUEST_SOURCE_BRANCH_SHA:-$CI_COMMIT_SHA}" --dangerfile="${DANGER_DANGERFILE:-Dangerfile}" } + +# We're doing the same operation in `scripts/trigger-build.rb` in the `assets_image_tag` method. +function assets_image_tag() { + local cache_assets_hash_file="cached-assets-hash.txt" + + if [[ ! -f "${cache_assets_hash_file}" ]]; then + echoerr "The ${cache_assets_hash_file} is missing!" + exit 1 + else + echo -n "assets-hash-$(cat ${cache_assets_hash_file} | cut -c1-10)" + fi +} |