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

generate-e2e-pipeline « scripts - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 31a3122050a38cb58ed0f9bcd8eb4aa74d06bf0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/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

source "$(dirname "$0")/utils.sh"
source $ENV_FILE

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"

if [ "$QA_SKIP_ALL_TESTS" == "true" ]; then
  skip_pipeline=".gitlab/ci/_skip.yml"

  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

  exit
fi

# 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 }')"
# 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
variables=$(cat <<YML
variables:
  GIT_DEPTH: "20"
  GIT_STRATEGY: "clone" # 'GIT_STRATEGY: clone' optimizes the pack-objects cache hit ratio
  GIT_SUBMODULE_STRATEGY: "none"
  GITLAB_QA_CACHE_KEY: "$qa_cache_key"
  GITLAB_SEMVER_VERSION: "$(cat VERSION)"
  QA_EXPORT_TEST_METRICS: "${QA_EXPORT_TEST_METRICS:-true}"
  QA_FEATURE_FLAGS: "${QA_FEATURE_FLAGS}"
  QA_FRAMEWORK_CHANGES: "${QA_FRAMEWORK_CHANGES:-false}"
  QA_RUN_ALL_TESTS: "${QA_RUN_ALL_TESTS:-false}"
  QA_RUN_ALL_E2E_LABEL: "${QA_RUN_ALL_E2E_LABEL:-false}"
  QA_SAVE_TEST_METRICS: "${QA_SAVE_TEST_METRICS:-false}"
  QA_SUITES: "$QA_SUITES"
  QA_TESTS: "$QA_TESTS"
  KNAPSACK_TEST_FILE_PATTERN: "$KNAPSACK_TEST_FILE_PATTERN"
YML
)

echo "***Saving generated qa pipeline files***"
for key in "${!qa_pipelines[@]}"; do
  echo "Generating $key"

  if [ "${CI_PROJECT_NAMESPACE}" = "gitlab-cn" ]; then
    cp "jh/.gitlab/ci/${qa_pipelines[$key]}" "$key"
  else
    cp ".gitlab/ci/${qa_pipelines[$key]}" "$key"
  fi

  echo >>"$key" # add empty line so it's easier to read if debugging
  echo "$variables" >>"$key"
done

echoinfo "Successfully generated qa pipeline files"
echo "$variables"