1#!/usr/bin/env bash 2# shellcheck disable=SC2038 # TODO: rewrite the find 3# shellcheck disable=SC2086 # we want word splitting 4 5section_switch prepare-artifacts "artifacts: prepare" 6 7set -e 8set -o xtrace 9 10CROSS_FILE=/cross_file-"$CROSS".txt 11 12# Delete unused bin and includes from artifacts to save space. 13rm -rf install/bin install/include 14 15# Strip the drivers in the artifacts to cut 80% of the artifacts size. 16if [ -n "$CROSS" ]; then 17 STRIP=$(sed -n -E "s/strip\s*=\s*\[?'(.*)'\]?/\1/p" "$CROSS_FILE") 18 if [ -z "$STRIP" ]; then 19 echo "Failed to find strip command in cross file" 20 exit 1 21 fi 22else 23 STRIP="strip" 24fi 25if [ -z "$ARTIFACTS_DEBUG_SYMBOLS" ]; then 26 find install -name \*.so -exec $STRIP --strip-debug {} \; 27fi 28 29# Test runs don't pull down the git tree, so put the dEQP helper 30# script and associated bits there. 31echo "$(cat VERSION) (git-$(git rev-parse HEAD | cut -b -10))" > install/VERSION 32cp -Rp .gitlab-ci/bare-metal install/ 33cp -Rp .gitlab-ci/common install/ 34cp -Rp .gitlab-ci/piglit install/ 35cp -Rp .gitlab-ci/fossils.yml install/ 36cp -Rp .gitlab-ci/fossils install/ 37cp -Rp .gitlab-ci/fossilize-runner.sh install/ 38cp -Rp .gitlab-ci/crosvm-init.sh install/ 39cp -Rp .gitlab-ci/*.txt install/ 40cp -Rp .gitlab-ci/report-flakes.py install/ 41cp -Rp .gitlab-ci/valve install/ 42cp -Rp .gitlab-ci/vkd3d-proton install/ 43cp -Rp .gitlab-ci/setup-test-env.sh install/ 44cp -Rp .gitlab-ci/*-runner.sh install/ 45cp -Rp .gitlab-ci/bin/structured_logger.py install/ 46cp -Rp .gitlab-ci/bin/custom_logger.py install/ 47find . -path \*/ci/\*.txt \ 48 -o -path \*/ci/\*.toml \ 49 -o -path \*/ci/\*traces\*.yml \ 50 | xargs -I '{}' cp -p '{}' install/ 51 52# Tar up the install dir so that symlinks and hardlinks aren't each 53# packed separately in the zip file. 54mkdir -p artifacts/ 55tar -cf artifacts/install.tar install 56cp -Rp .gitlab-ci/common artifacts/ci-common 57cp -Rp .gitlab-ci/lava artifacts/ 58cp -Rp .gitlab-ci/b2c artifacts/ 59 60if [ -n "$S3_ARTIFACT_NAME" ]; then 61 # Pass needed files to the test stage 62 S3_ARTIFACT_NAME="$S3_ARTIFACT_NAME.tar.zst" 63 zstd artifacts/install.tar -o ${S3_ARTIFACT_NAME} 64 ci-fairy s3cp --token-file "${CI_JOB_JWT_FILE}" ${S3_ARTIFACT_NAME} https://${PIPELINE_ARTIFACTS_BASE}/${S3_ARTIFACT_NAME} 65fi 66 67section_end prepare-artifacts 68