Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-12-20 17:22:11 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-12-20 17:22:11 +0300
commit0c872e02b2c822e3397515ec324051ff540f0cd5 (patch)
treece2fb6ce7030e4dad0f4118d21ab6453e5938cdd /scripts/utils.sh
parentf7e05a6853b12f02911494c4b3fe53d9540d74fc (diff)
Add latest changes from gitlab-org/gitlab@15-7-stable-eev15.7.0-rc42
Diffstat (limited to 'scripts/utils.sh')
-rw-r--r--scripts/utils.sh43
1 files changed, 42 insertions, 1 deletions
diff --git a/scripts/utils.sh b/scripts/utils.sh
index 50ca7f558f6..92f647958fe 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
@@ -105,6 +107,27 @@ function install_junit_merge_gem() {
run_timed_command "gem install junit_merge --no-document --version 0.1.2"
}
+function fail_on_warnings() {
+ local cmd="$*"
+ local warnings
+ warnings="$(mktemp)"
+
+ eval "$cmd 2>$warnings"
+ local ret=$?
+
+ if test -s "$warnings";
+ then
+ echoerr "There were warnings:"
+ cat "$warnings"
+ rm "$warnings"
+ return 1
+ fi
+
+ rm "$warnings"
+
+ return $ret
+}
+
function run_timed_command() {
local cmd="${1}"
local metric_name="${2:-no}"
@@ -203,3 +226,21 @@ 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 inlining this function in `.gitlab/ci/package-and-test/main.gitlab-ci.yml` so make sure to reflect any changes there
+function assets_image_tag() {
+ local cache_assets_hash_file="cached-assets-hash.txt"
+
+ if [[ -n "${CI_COMMIT_TAG}" ]]; then
+ echo -n "${CI_COMMIT_REF_NAME}"
+ elif [[ -f "${cache_assets_hash_file}" ]]; then
+ echo -n "assets-hash-$(cat ${cache_assets_hash_file} | cut -c1-10)"
+ else
+ echo -n "${CI_COMMIT_SHA}"
+ fi
+}
+
+function setup_gcloud() {
+ gcloud auth activate-service-account --key-file="${REVIEW_APPS_GCP_CREDENTIALS}"
+ gcloud config set project "${REVIEW_APPS_GCP_PROJECT}"
+}