diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-02 15:14:26 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-02 15:14:26 +0300 |
commit | ce459835cb32ed396fb7524fb615a5d07f8c51ef (patch) | |
tree | bc56e024828f25d53f8b713b4d8f6393b8755112 /scripts | |
parent | 374f3dee7dc0fae10a34daf503b8bf3078008f4b (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/api/base.rb | 2 | ||||
-rw-r--r-- | scripts/gitlab_component_helpers.sh | 31 |
2 files changed, 32 insertions, 1 deletions
diff --git a/scripts/api/base.rb b/scripts/api/base.rb index 4872ede253d..972b461a09a 100644 --- a/scripts/api/base.rb +++ b/scripts/api/base.rb @@ -8,7 +8,7 @@ class Base @project = options.fetch(:project) # If api_token is nil, it's set to '' to allow unauthenticated requests (for forks). - api_token = options.fetch(:api_token, '') + api_token = options[:api_token] || '' warn "No API token given." if api_token.empty? diff --git a/scripts/gitlab_component_helpers.sh b/scripts/gitlab_component_helpers.sh index c46dbb57a58..309e339de01 100644 --- a/scripts/gitlab_component_helpers.sh +++ b/scripts/gitlab_component_helpers.sh @@ -51,6 +51,24 @@ export GITLAB_ASSETS_HASH="${GITLAB_ASSETS_HASH:-"NO_HASH"}" export GITLAB_ASSETS_PACKAGE="assets-${NODE_ENV}-${GITLAB_EDITION}-${GITLAB_ASSETS_HASH}-${GITLAB_ASSETS_PACKAGE_VERSION}.tar.gz" export GITLAB_ASSETS_PACKAGE_URL="${API_PACKAGES_BASE_URL}/assets/${NODE_ENV}-${GITLAB_EDITION}-${GITLAB_ASSETS_HASH}/${GITLAB_ASSETS_PACKAGE}" +# Fixtures constants + +# Export the SHA variable for updating/downloading fixture packages, using the following order of precedence: +# 1. If MERGE_BASE_SHA is defined, use its value. +# 2. If CI_MERGE_REQUEST_SOURCE_BRANCH_SHA is defined, use its value for merge request pipelines. +# 3. Otherwise, use the value of CI_COMMIT_SHA for default branch pipelines or merge requests with detached pipelines. +if [ -n "${MERGE_BASE_SHA:-}" ]; then + export FIXTURES_SHA="${MERGE_BASE_SHA}" +elif [ -n "${CI_MERGE_REQUEST_SOURCE_BRANCH_SHA:-}" ]; then + export FIXTURES_SHA="${CI_MERGE_REQUEST_SOURCE_BRANCH_SHA}" +else + export FIXTURES_SHA="${CI_COMMIT_SHA}" +fi + +export FIXTURES_PATH="tmp/tests/frontend/**/*" +export FIXTURES_PACKAGE="fixtures-${FIXTURES_SHA}.tar.gz" +export FIXTURES_PACKAGE_URL="${API_PACKAGES_BASE_URL}/fixtures/${FIXTURES_SHA}/${FIXTURES_PACKAGE}" + # Generic helper functions function archive_doesnt_exist() { local package_url="${1}" @@ -147,3 +165,16 @@ function create_gitlab_assets_package() { function upload_gitlab_assets_package() { upload_package "${GITLAB_ASSETS_PACKAGE}" "${GITLAB_ASSETS_PACKAGE_URL}" } + +# Fixtures functions +function fixtures_archive_doesnt_exist() { + archive_doesnt_exist "${FIXTURES_PACKAGE_URL}" +} + +function create_fixtures_package() { + create_package "${FIXTURES_PACKAGE}" "${FIXTURES_PATH}" +} + +function upload_fixtures_package() { + upload_package "${FIXTURES_PACKAGE}" "${FIXTURES_PACKAGE_URL}" +} |