debian-mirror-gitlab/scripts/generate-e2e-pipeline

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

66 lines
2.3 KiB
Text
Raw Permalink Normal View History

2022-10-11 01:57:18 +05:30
#!/bin/bash
set -e
# Script to generate e2e test child pipeline
# This is required because environment variables that are generated dynamically are not picked up by rules in child pipelines
2023-07-09 08:55:56 +05:30
source "$(dirname "$0")/utils.sh"
2022-10-11 01:57:18 +05:30
source $ENV_FILE
2023-07-09 08:55:56 +05:30
echoinfo "Generating child pipeline yml definitions for e2e test pipelines child pipelines"
declare -A qa_pipelines
# key/value pairs for qa pipeline yml definitions
qa_pipelines["package-and-test-pipeline.yml"]="package-and-test/main.gitlab-ci.yml"
qa_pipelines["package-and-test-nightly-pipeline.yml"]="package-and-test-nightly/main.gitlab-ci.yml"
qa_pipelines["review-app-pipeline.yml"]="review-apps/main.gitlab-ci.yml"
qa_pipelines["test-on-gdk-pipeline.yml"]="test-on-gdk/main.gitlab-ci.yml"
2022-10-11 01:57:18 +05:30
if [ "$QA_SKIP_ALL_TESTS" == "true" ]; then
skip_pipeline=".gitlab/ci/_skip.yml"
2023-07-09 08:55:56 +05:30
echoinfo "Using ${skip_pipeline} for all e2e test pipelines due to QA_SKIP_ALL_TESTS set to 'true'"
for key in "${!qa_pipelines[@]}"; do
cp $skip_pipeline "$key"
done
2022-10-11 01:57:18 +05:30
exit
fi
2022-11-25 23:54:43 +05:30
# set custom cache key to override default cache in pipeline-common because we use bundle to install gitlab-qa gem
qa_cache_key="qa-e2e-ruby-${RUBY_VERSION}-$(md5sum qa/Gemfile.lock | awk '{ print $1 }')"
2023-07-09 08:55:56 +05:30
# these variables are used across all qa child pipelines
# it allows to use all features across all child pipelines like skipping all tests, selective test execution etc
2022-10-11 01:57:18 +05:30
variables=$(cat <<YML
variables:
2023-04-23 21:23:45 +05:30
GIT_DEPTH: "20"
GIT_STRATEGY: "clone" # 'GIT_STRATEGY: clone' optimizes the pack-objects cache hit ratio
GIT_SUBMODULE_STRATEGY: "none"
2022-11-25 23:54:43 +05:30
GITLAB_QA_CACHE_KEY: "$qa_cache_key"
2023-05-27 22:25:52 +05:30
GITLAB_SEMVER_VERSION: "$(cat VERSION)"
2023-06-20 00:43:36 +05:30
SKIP_OMNIBUS_TRIGGER: "false"
2023-01-13 00:05:48 +05:30
QA_EXPORT_TEST_METRICS: "${QA_EXPORT_TEST_METRICS:-true}"
QA_FEATURE_FLAGS: "${QA_FEATURE_FLAGS}"
2023-04-23 21:23:45 +05:30
QA_FRAMEWORK_CHANGES: "${QA_FRAMEWORK_CHANGES:-false}"
QA_RUN_ALL_TESTS: "${QA_RUN_ALL_TESTS:-false}"
2023-06-20 00:43:36 +05:30
QA_RUN_ALL_E2E_LABEL: "${QA_RUN_ALL_E2E_LABEL:-false}"
2023-04-23 21:23:45 +05:30
QA_SAVE_TEST_METRICS: "${QA_SAVE_TEST_METRICS:-false}"
2022-10-11 01:57:18 +05:30
QA_SUITES: "$QA_SUITES"
2023-04-23 21:23:45 +05:30
QA_TESTS: "$QA_TESTS"
2022-10-11 01:57:18 +05:30
YML
)
2023-07-09 08:55:56 +05:30
echo "***Saving generated qa pipeline files***"
for key in "${!qa_pipelines[@]}"; do
echo "Generating $key"
cp ".gitlab/ci/${qa_pipelines[$key]}" "$key"
2023-05-27 22:25:52 +05:30
2023-07-09 08:55:56 +05:30
echo >>"$key" # add empty line so it's easier to read if debugging
echo "$variables" >>"$key"
done
2022-10-11 01:57:18 +05:30
2023-07-09 08:55:56 +05:30
echoinfo "Successfully generated qa pipeline files"