2022-12-12 00:46:41 +08:00
|
|
|
#!/usr/bin/env bash
|
2023-05-21 06:47:05 +08:00
|
|
|
# shellcheck disable=SC2038 # TODO: rewrite the find
|
|
|
|
# shellcheck disable=SC2086 # we want word splitting
|
2022-12-12 00:46:41 +08:00
|
|
|
|
|
|
|
section_switch prepare-artifacts "artifacts: prepare"
|
2019-10-24 00:42:53 +08:00
|
|
|
|
|
|
|
set -e
|
|
|
|
set -o xtrace
|
|
|
|
|
2019-12-17 18:50:14 +08:00
|
|
|
CROSS_FILE=/cross_file-"$CROSS".txt
|
|
|
|
|
2019-11-07 02:58:19 +08:00
|
|
|
# Delete unused bin and includes from artifacts to save space.
|
|
|
|
rm -rf install/bin install/include
|
2019-10-24 00:42:53 +08:00
|
|
|
|
|
|
|
# Strip the drivers in the artifacts to cut 80% of the artifacts size.
|
|
|
|
if [ -n "$CROSS" ]; then
|
2022-11-27 04:29:38 +08:00
|
|
|
STRIP=$(sed -n -E "s/strip\s*=\s*\[?'(.*)'\]?/\1/p" "$CROSS_FILE")
|
2019-10-24 00:42:53 +08:00
|
|
|
if [ -z "$STRIP" ]; then
|
|
|
|
echo "Failed to find strip command in cross file"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
STRIP="strip"
|
|
|
|
fi
|
2021-08-26 21:00:40 +08:00
|
|
|
if [ -z "$ARTIFACTS_DEBUG_SYMBOLS" ]; then
|
2023-10-31 02:48:50 +08:00
|
|
|
find install -name \*.so -exec $STRIP --strip-debug {} \;
|
2021-01-15 01:56:52 +08:00
|
|
|
fi
|
2019-10-24 00:42:53 +08:00
|
|
|
|
|
|
|
# Test runs don't pull down the git tree, so put the dEQP helper
|
|
|
|
# script and associated bits there.
|
2021-05-05 15:10:44 +08:00
|
|
|
echo "$(cat VERSION) (git-$(git rev-parse HEAD | cut -b -10))" > install/VERSION
|
2020-06-09 06:36:16 +08:00
|
|
|
cp -Rp .gitlab-ci/bare-metal install/
|
2021-04-23 06:51:56 +08:00
|
|
|
cp -Rp .gitlab-ci/common install/
|
2020-03-24 19:58:30 +08:00
|
|
|
cp -Rp .gitlab-ci/piglit install/
|
|
|
|
cp -Rp .gitlab-ci/fossils.yml install/
|
|
|
|
cp -Rp .gitlab-ci/fossils install/
|
|
|
|
cp -Rp .gitlab-ci/fossilize-runner.sh install/
|
2021-02-04 22:14:26 +08:00
|
|
|
cp -Rp .gitlab-ci/crosvm-init.sh install/
|
2021-10-26 01:27:10 +08:00
|
|
|
cp -Rp .gitlab-ci/*.txt install/
|
2021-05-27 01:45:33 +08:00
|
|
|
cp -Rp .gitlab-ci/report-flakes.py install/
|
2023-03-03 15:53:05 +08:00
|
|
|
cp -Rp .gitlab-ci/setup-test-env.sh install/
|
2021-10-09 04:17:27 +08:00
|
|
|
cp -Rp .gitlab-ci/*-runner.sh install/
|
2023-08-30 12:45:13 +08:00
|
|
|
cp -Rp .gitlab-ci/bin/structured_logger.py install/
|
|
|
|
cp -Rp .gitlab-ci/bin/custom_logger.py install/
|
2024-07-26 22:11:21 +08:00
|
|
|
|
2024-07-26 22:11:21 +08:00
|
|
|
mapfile -t duplicate_files < <(
|
|
|
|
find src/ -path '*/ci/*' \
|
|
|
|
\( \
|
|
|
|
-name '*.txt' \
|
|
|
|
-o -name '*.toml' \
|
|
|
|
-o -name '*traces*.yml' \
|
|
|
|
\) \
|
|
|
|
-exec basename -a {} + | sort | uniq -d
|
|
|
|
)
|
|
|
|
if [ ${#duplicate_files[@]} -gt 0 ]; then
|
|
|
|
echo 'Several files with the same name in various ci/ folders:'
|
|
|
|
printf -- ' %s\n' "${duplicate_files[@]}"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2024-07-26 22:11:21 +08:00
|
|
|
find src/ -path '*/ci/*' \
|
|
|
|
\( \
|
|
|
|
-name '*.txt' \
|
|
|
|
-o -name '*.toml' \
|
|
|
|
-o -name '*traces*.yml' \
|
|
|
|
\) \
|
|
|
|
-exec cp -p {} install/ \;
|
2019-10-24 00:42:53 +08:00
|
|
|
|
|
|
|
# Tar up the install dir so that symlinks and hardlinks aren't each
|
|
|
|
# packed separately in the zip file.
|
2020-03-24 19:58:30 +08:00
|
|
|
mkdir -p artifacts/
|
2019-10-24 00:42:53 +08:00
|
|
|
tar -cf artifacts/install.tar install
|
2021-06-11 00:00:32 +08:00
|
|
|
cp -Rp .gitlab-ci/common artifacts/ci-common
|
2021-06-10 18:10:10 +08:00
|
|
|
cp -Rp .gitlab-ci/lava artifacts/
|
2022-06-22 20:36:02 +08:00
|
|
|
cp -Rp .gitlab-ci/b2c artifacts/
|
2019-12-17 18:50:14 +08:00
|
|
|
|
2023-06-08 23:34:04 +08:00
|
|
|
if [ -n "$S3_ARTIFACT_NAME" ]; then
|
2020-01-31 07:20:35 +08:00
|
|
|
# Pass needed files to the test stage
|
2023-06-08 23:34:04 +08:00
|
|
|
S3_ARTIFACT_NAME="$S3_ARTIFACT_NAME.tar.zst"
|
|
|
|
zstd artifacts/install.tar -o ${S3_ARTIFACT_NAME}
|
2024-04-25 03:40:18 +08:00
|
|
|
ci-fairy s3cp --token-file "${S3_JWT_FILE}" ${S3_ARTIFACT_NAME} https://${PIPELINE_ARTIFACTS_BASE}/${S3_ARTIFACT_NAME}
|
2019-12-17 18:50:14 +08:00
|
|
|
fi
|
2022-12-12 00:46:41 +08:00
|
|
|
|
|
|
|
section_end prepare-artifacts
|