ci(buildkite): localised node artifacts (#5087)

This change ensures that vega Buildkite nodes will upload artifacts to a local MinIO instance and also retrieve artifacts from this location if the same constraint is met.
pull/5079/head^2
Amir Zarrinkafsh 2023-03-19 15:02:37 +10:00 committed by GitHub
parent 2a2f2dfee2
commit bfb45c57b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 8 deletions

View File

@ -0,0 +1,8 @@
#!/usr/bin/env bash
set +u
if [[ "${BUILDKITE_LABEL}" == ":docker: Build Image [coverage]" && "${BUILDKITE_AGENT_NAME}" =~ ^vega[0-9]+$ ]]; then
mv authelia-image-coverage.tar.zst authelia-image-coverage-vega.tar.zst
BUILDKITE_S3_ENDPOINT="${S3_ENDPOINT}" BUILDKITE_ARTIFACT_UPLOAD_DESTINATION="${S3_BUCKET}" BUILDKITE_S3_ACCESS_URL="${S3_ACCESS_URL}" BUILDKITE_S3_ACCESS_KEY_ID="${S3_ACCESS_KEY_ID}" BUILDKITE_S3_SECRET_ACCESS_KEY="${S3_SECRET_ACCESS_KEY}" buildkite-agent artifact upload authelia-image-coverage-vega.tar.zst
fi

View File

@ -21,7 +21,6 @@ if [[ "${BUILDKITE_LABEL}" == ":hammer_and_wrench: Unit Test" ]]; then
fi fi
if [[ "${BUILDKITE_LABEL}" == ":docker: Build Image [coverage]" ]]; then if [[ "${BUILDKITE_LABEL}" == ":docker: Build Image [coverage]" ]]; then
# Saving image for docker push
docker save "${DOCKER_IMAGE}" | zstdmt -T0 -12 > "authelia-image-coverage.tar.zst" docker save "${DOCKER_IMAGE}" | zstdmt -T0 -12 > "authelia-image-coverage.tar.zst"
fi fi

View File

@ -29,14 +29,20 @@ if [[ "${BUILDKITE_LABEL}" =~ ":debian: Build Package" ]]; then
fi fi
if [[ "${BUILDKITE_LABEL}" =~ ":selenium:" ]]; then if [[ "${BUILDKITE_LABEL}" =~ ":selenium:" ]]; then
DEFAULT_ARCH=coverage
echo "--- :docker: Extract and load build container" echo "--- :docker: Extract and load build container"
mkdir coverage mkdir coverage
buildkite-agent artifact download "authelia-image-${DEFAULT_ARCH}*" .
if [[ "${SUITE}" == "Kubernetes" ]]; then if [[ "${BUILDKITE_AGENT_NAME}" =~ ^vega[0-9]+$ ]]; then
zstd -d authelia-image-coverage.tar.zst --stdout > ./internal/suites/example/kube/authelia-image-${DEFAULT_ARCH}.tar BUILDKITE_S3_ENDPOINT="${S3_ENDPOINT}" BUILDKITE_ARTIFACT_UPLOAD_DESTINATION="${S3_BUCKET}" BUILDKITE_S3_ACCESS_URL="${S3_ACCESS_URL}" BUILDKITE_S3_ACCESS_KEY_ID="${S3_ACCESS_KEY_ID}" BUILDKITE_S3_SECRET_ACCESS_KEY="${S3_SECRET_ACCESS_KEY}" buildkite-agent artifact download "authelia-image-coverage-vega*" .
mv authelia-image-coverage-vega.tar.zst authelia-image-coverage.tar.zst
else else
zstdcat "authelia-image-${DEFAULT_ARCH}.tar.zst" | docker load buildkite-agent artifact download "authelia-image-coverage.*" .
fi
if [[ "${SUITE}" == "Kubernetes" ]]; then
zstd -d authelia-image-coverage.tar.zst --stdout > ./internal/suites/example/kube/authelia-image-coverage.tar
else
zstdcat "authelia-image-coverage.tar.zst" | docker load
fi fi
if [[ "${BUILD_DUO}" == "true" ]] && [[ "${SUITE}" == "DuoPush" ]]; then if [[ "${BUILD_DUO}" == "true" ]] && [[ "${SUITE}" == "DuoPush" ]]; then
@ -55,13 +61,13 @@ if [[ "${BUILDKITE_LABEL}" =~ ":selenium:" ]]; then
fi fi
if [[ "${BUILDKITE_LABEL}" == ":docker: Build and Deploy" ]]; then if [[ "${BUILDKITE_LABEL}" == ":docker: Build and Deploy" ]]; then
echo ${DOCKER_PASSWORD} | docker login -u ${DOCKER_USERNAME} --password-stdin echo "${DOCKER_PASSWORD}" | docker login -u "${DOCKER_USERNAME}" --password-stdin
fi fi
if [[ "${BUILDKITE_LABEL}" == ":docker: Deploy Manifest" ]]; then if [[ "${BUILDKITE_LABEL}" == ":docker: Deploy Manifest" ]]; then
echo "--- :go: :react: :swagger: Extract pre-built binary" echo "--- :go: :react: :swagger: Extract pre-built binary"
buildkite-agent artifact download "authelia-linux-*-musl.tar.gz" . buildkite-agent artifact download "authelia-linux-*-musl.tar.gz" .
for archive in authelia-linux-*-musl.tar.gz; do tar xzf ${archive} --wildcards "authelia-linux-*"; done for archive in authelia-linux-*-musl.tar.gz; do tar xzf "${archive}" --wildcards "authelia-linux-*"; done
fi fi
if [[ "${BUILDKITE_LABEL}" == ":github: Deploy Artifacts" ]]; then if [[ "${BUILDKITE_LABEL}" == ":github: Deploy Artifacts" ]]; then