• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env bash
2# shellcheck disable=SC2038 # TODO: rewrite the find
3# shellcheck disable=SC2086 # we want word splitting
4# shellcheck disable=SC1091 # relative paths only become valid at runtime
5
6. "${SCRIPTS_DIR}/setup-test-env.sh"
7
8section_switch prepare-artifacts "artifacts: prepare"
9
10set -e
11set -o xtrace
12
13mkdir -p artifacts/
14
15# Test runs don't pull down the git tree, so put the dEQP helper
16# script and associated bits there.
17echo "$(cat VERSION) (git-$(git rev-parse HEAD | cut -b -10))" > artifacts/VERSION
18cp -Rp .gitlab-ci/report-flakes.py artifacts/
19cp -Rp .gitlab-ci/setup-test-env.sh artifacts/
20cp -Rp .gitlab-ci/common artifacts/ci-common
21cp -Rp .gitlab-ci/b2c artifacts/
22cp -Rp .gitlab-ci/bare-metal artifacts/
23cp -Rp .gitlab-ci/lava artifacts/
24cp -Rp .gitlab-ci/bin/*_logger.py artifacts/
25
26mapfile -t duplicate_files < <(
27  find src/ -path '*/ci/*' \
28    \( \
29      -name '*.txt' \
30      -o -name '*.toml' \
31      -o -name '*traces*.yml' \
32    \) \
33    -exec basename -a {} + | sort | uniq -d
34)
35if [ ${#duplicate_files[@]} -gt 0 ]; then
36  echo 'Several files with the same name in various ci/ folders:'
37  printf -- '  %s\n' "${duplicate_files[@]}"
38  exit 1
39fi
40
41if [ -d "src/" ]; then
42  find src/ -path '*/ci/*' \
43    \( \
44      -name '*.txt' \
45      -o -name '*.toml' \
46      -o -name '*traces*.yml' \
47    \) \
48    -exec cp -p {} artifacts/ \;
49fi
50cp -Rp .gitlab-ci/*.txt artifacts/
51
52if [ -n "$S3_ARTIFACT_NAME" ]; then
53    # Pass needed files to the test stage
54    S3_ARTIFACT_TAR="$S3_ARTIFACT_NAME.tar.zst"
55    tar cv artifacts/ | zstd -o "${S3_ARTIFACT_TAR}"
56    ci-fairy s3cp --token-file "${S3_JWT_FILE}" "${S3_ARTIFACT_TAR}" "https://${PIPELINE_ARTIFACTS_BASE}/${S3_ARTIFACT_TAR}"
57    rm "${S3_ARTIFACT_TAR}"
58fi
59
60section_end prepare-artifacts
61