ci: Add and use find_s3_project_artifact (and curl-with-retry) helpers
Introduce find_s3_project_artifact (and curl-with-retry) helpers to simplify locating S3 artifacts across upstream mesa/mesa and forks. Use these helpers in the Fluster build process and for fetching LAVA rootfs artifacts. Signed-off-by: Valentine Burley <valentine.burley@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35167>
This commit is contained in:
committed by
Marge Bot
parent
7537f0f42b
commit
0ccfa323bc
@@ -35,11 +35,7 @@ variables:
|
||||
FDO_CI_CONCURRENT: 6 # should be replaced by per-machine definitions
|
||||
# the dispatchers use this to cache data locally
|
||||
LAVA_HTTP_CACHE_URI: "http://caching-proxy/cache/?uri="
|
||||
# base system generated by the container build job, shared between many pipelines
|
||||
BASE_SYSTEM_HOST_PREFIX: "${S3_HOST}/${S3_KERNEL_BUCKET}"
|
||||
# path to the LAVA rootfs
|
||||
BASE_SYSTEM_MAINLINE_HOST_PATH: "${BASE_SYSTEM_HOST_PREFIX}/${FDO_UPSTREAM_REPO}/${MESA_IMAGE_PATH}:${FDO_DISTRIBUTION_TAG}"
|
||||
BASE_SYSTEM_FORK_HOST_PATH: "${BASE_SYSTEM_HOST_PREFIX}/${CI_PROJECT_PATH}/${MESA_IMAGE_PATH}:${FDO_DISTRIBUTION_TAG}"
|
||||
LAVA_ROOTFS_PATH: "${MESA_IMAGE_PATH}:${FDO_DISTRIBUTION_TAG}/lava-rootfs.tar.zst"
|
||||
# per-job build artifacts
|
||||
JOB_RESULTS_PATH: "${JOB_ARTIFACTS_BASE}/results.tar.zst"
|
||||
S3_ARTIFACT_NAME: "mesa-${ARCH}-default-debugoptimized"
|
||||
|
||||
@@ -6,27 +6,17 @@
|
||||
# .gitlab-ci/image-tags.yml tags:
|
||||
# ALPINE_X86_64_LAVA_TRIGGER_TAG
|
||||
|
||||
# If we run in the fork (not from mesa or Marge-bot), reuse mainline kernel and rootfs, if exist.
|
||||
_check_artifact_path() {
|
||||
_url="https://${1}/${2}"
|
||||
if curl -s -o /dev/null -I -L -f --retry 4 --retry-delay 15 "${_url}"; then
|
||||
echo -n "${_url}"
|
||||
fi
|
||||
}
|
||||
. "${SCRIPTS_DIR}/setup-test-env.sh"
|
||||
|
||||
get_path_to_artifact() {
|
||||
_mainline_artifact="$(_check_artifact_path ${BASE_SYSTEM_MAINLINE_HOST_PATH} ${1})"
|
||||
if [ -n "${_mainline_artifact}" ]; then
|
||||
echo -n "${_mainline_artifact}"
|
||||
return
|
||||
fi
|
||||
_fork_artifact="$(_check_artifact_path ${BASE_SYSTEM_FORK_HOST_PATH} ${1})"
|
||||
if [ -n "${_fork_artifact}" ]; then
|
||||
echo -n "${_fork_artifact}"
|
||||
return
|
||||
fi
|
||||
section_start prepare_rootfs "Preparing root filesystem"
|
||||
|
||||
set -ex
|
||||
|
||||
# If we run in the fork (not from mesa or Marge-bot), reuse mainline kernel and rootfs, if exist.
|
||||
ROOTFS_URL="$(find_s3_project_artifact "$LAVA_ROOTFS_PATH")" ||
|
||||
{
|
||||
set +x
|
||||
error "Sorry, I couldn't find a viable built path for ${1} in either mainline or a fork." >&2
|
||||
error "Sorry, I couldn't find a viable built path for ${LAVA_ROOTFS_PATH} in either mainline or a fork." >&2
|
||||
echo "" >&2
|
||||
echo "If you're working on CI, this probably means that you're missing a dependency:" >&2
|
||||
echo "this job ran ahead of the job which was supposed to upload that artifact." >&2
|
||||
@@ -38,15 +28,6 @@ get_path_to_artifact() {
|
||||
exit 1
|
||||
}
|
||||
|
||||
. "${SCRIPTS_DIR}/setup-test-env.sh"
|
||||
|
||||
section_start prepare_rootfs "Preparing root filesystem"
|
||||
|
||||
set -ex
|
||||
|
||||
ROOTFS_URL="$(get_path_to_artifact lava-rootfs.tar.zst)"
|
||||
[ $? != 1 ] || exit 1
|
||||
|
||||
rm -rf results
|
||||
mkdir results
|
||||
|
||||
@@ -73,7 +54,7 @@ if [ -n "${LAVA_FIRMWARE:-}" ]; then
|
||||
LAVA_EXTRA_OVERLAYS+=(
|
||||
- append-overlay
|
||||
--name=linux-firmware
|
||||
--url="https://${BASE_SYSTEM_HOST_PREFIX}/${FIRMWARE_REPO}/${fw}-${FIRMWARE_TAG}.tar"
|
||||
--url="https://${S3_BASE_PATH}/${FIRMWARE_REPO}/${fw}-${FIRMWARE_TAG}.tar"
|
||||
--path="/"
|
||||
--format=tar
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user