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>2023-08-04 18:10:27 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-08-04 18:10:27 +0300
commitd984d4a092018d86eec724a06ce2e6c066c3fb44 (patch)
treeb72454a613480658d9b2b14b74eb7b8c75858544 /scripts
parent30a8e054751fe9020a9ed526434db83af35b4718 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/review_apps/review-apps.sh4
-rw-r--r--scripts/utils.sh35
2 files changed, 37 insertions, 2 deletions
diff --git a/scripts/review_apps/review-apps.sh b/scripts/review_apps/review-apps.sh
index af6c2ec5383..365894e6118 100755
--- a/scripts/review_apps/review-apps.sh
+++ b/scripts/review_apps/review-apps.sh
@@ -243,7 +243,7 @@ function download_chart() {
function base_config_changed() {
if [ -z "${CI_MERGE_REQUEST_IID}" ]; then return; fi
- curl "${CI_API_V4_URL}/projects/${CI_MERGE_REQUEST_PROJECT_ID}/merge_requests/${CI_MERGE_REQUEST_IID}/changes" | jq '.changes | any(.old_path == "scripts/review_apps/base-config.yaml")'
+ curl "${CI_API_V4_URL}/projects/${CI_MERGE_REQUEST_PROJECT_ID}/merge_requests/${CI_MERGE_REQUEST_IID}/changes" | jq --arg path "${GITLAB_REVIEW_APP_BASE_CONFIG_FILE}" '.changes | any(.old_path == $path)'
}
function parse_gitaly_image_tag() {
@@ -263,7 +263,7 @@ function deploy() {
local base_config_file_ref="${CI_DEFAULT_BRANCH}"
if [[ "$(base_config_changed)" == "true" ]]; then base_config_file_ref="${CI_COMMIT_SHA}"; fi
- local base_config_file="${GITLAB_REPO_URL}/raw/${base_config_file_ref}/scripts/review_apps/base-config.yaml"
+ local base_config_file="${GITLAB_REPO_URL}/raw/${base_config_file_ref}/${GITLAB_REVIEW_APP_BASE_CONFIG_FILE}"
echoinfo "Deploying ${release} to ${CI_ENVIRONMENT_URL} ..." true
diff --git a/scripts/utils.sh b/scripts/utils.sh
index 4ed56b2de1a..e19622d07c6 100644
--- a/scripts/utils.sh
+++ b/scripts/utils.sh
@@ -416,3 +416,38 @@ function url_encode() {
-e 's/}/%7d/g' \
-e 's/~/%7e/g'
}
+
+# Download the local gems in `gems` and `vendor/gems` folders from the API.
+#
+# This is useful if you need to run bundle install while not doing a git clone of the gitlab-org/gitlab repo.
+function download_local_gems() {
+ for folder_path in vendor/gems gems; do
+ local output="${folder_path}.tar.gz"
+
+ # From https://docs.gitlab.com/ee/api/repositories.html#get-file-archive:
+ #
+ # This endpoint can be accessed without authentication if the repository is publicly accessible.
+ # For GitLab.com users, this endpoint has a rate limit threshold of 5 requests per minute.
+ #
+ # We don't want to set a token for public repo (e.g. gitlab-org/gitlab), as 5 requests/minute can
+ # potentially be reached with many pipelines running in parallel.
+ local private_token_header=""
+ if [[ "${CI_PROJECT_VISIBILITY}" != "public" ]]; then
+ private_token_header="Private-Token: ${PROJECT_TOKEN_FOR_CI_SCRIPTS_API_USAGE}"
+ fi
+
+ echo "Downloading ${folder_path}"
+
+ url=${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/repository/archive
+ curl -f \
+ --get \
+ --header "${private_token_header}" \
+ --output "${output}" \
+ --data-urlencode "sha=${CI_COMMIT_SHA}" \
+ --data-urlencode "path=${folder_path}" \
+ "${url}"
+
+ tar -zxf "${output}" --strip-component 1
+ rm "${output}"
+ done
+}