ci: Stricter pattern matching for image download - #38
Merged
Conversation
gardenlinux releases from 2150.1.0 [0] started including file <release>.logs.tar.xz in its artifacts. This file matched our pattern that searches for the image itself, causing our CI jobs to fail[1]. The new regexp should match only the image itself, disregarding logs, or any other additional artifact that might be included in the future. [0] https://github.com/gardenlinux/gardenlinux/releases/tag/2150.1.0 [1] https://github.com/ironcore-dev/os-images/actions/runs/24617135043/job/71981127138 Signed-off-by: Martin Kalcok <martin.kalcok@sap.com>
Contributor
Author
|
Manual testing with the updated regexp passes locally. "Fetch artifacts from Github release" step adapted to a bash script: #!/usr/bin/env bash
set -xeuo pipefail
VERSION="2150.1.0"
IMAGE="ghcr.io/ironcore-dev/gardenlinux"
test_run() {
asset_pattern=$1; shift
variant=$1; shift
ASSETS=$(curl -s \
"https://api.github.com/repos/gardenlinux/gardenlinux/releases/tags/$VERSION" \
| jq -r '.assets[].name')
for ARCH in amd64 arm64; do
ASSET=$(echo "$ASSETS" | grep -E "^$asset_pattern-$ARCH-[0-9]+\.[0-9]+\.[0-9]+-[0-9a-f]+\.tar\.xz$" | head -1)
if [ -z "$ASSET" ]; then
echo "::error::Could not find asset matching $asset_pattern-$ARCH-*.tar.xz"
exit 1
fi
# The asset base name (without .tar.xz) is the prefix for all
# files inside the archive.
ASSET_BASE="${ASSET%.tar.xz}"
echo "Downloading $ASSET"
mkdir -p "artifacts/${ARCH}"
curl -sL "https://github.com/gardenlinux/gardenlinux/releases/download/${VERSION}/${ASSET}" \
-o "artifacts/${ARCH}/${ASSET}"
echo "Extracting $ASSET"
tar -xf "artifacts/${ARCH}/${ASSET}" -C "artifacts/${ARCH}"
rm "artifacts/${ARCH}/${ASSET}"
if [ "$variant" = "kvm" ]; then
RAW_FILE="artifacts/${ARCH}/${ASSET_BASE}.raw"
if [ ! -f "$RAW_FILE" ]; then
echo "::error::Expected .raw file not found at ${RAW_FILE}"
exit 1
fi
echo "KVM_${ARCH^^}_RAW=${RAW_FILE}" >> "$GITHUB_ENV"
else
# Metal: extract the nested PXE tarball to get initrd, vmlinuz, root.squashfs.
PXE_TARBALL="artifacts/${ARCH}/${ASSET_BASE}.pxe.tar.gz"
if [ ! -f "$PXE_TARBALL" ]; then
echo "::error::Could not find nested PXE tarball at ${PXE_TARBALL}"
exit 1
fi
tar -xzf "$PXE_TARBALL" -C "artifacts/${ARCH}"
for BIN in initrd vmlinuz root.squashfs; do
if [ ! -f "artifacts/${ARCH}/${BIN}" ]; then
echo "::error::Could not find ${BIN} for ${ARCH}"
exit 1
fi
done
echo "METAL_${ARCH^^}_DIR=artifacts/${ARCH}" >> "GITHUB_ENV"
echo "METAL_${ARCH^^}_ASSET_BASE=${ASSET_BASE}" >> "GITHUB_ENV"
fi
done
}
test_run baremetal_pxe metalresults: |
friegger
approved these changes
Apr 22, 2026
Member
|
Let's give it a spin |
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
gardenlinux releases from 2150.1.0 [0] started including file .logs.tar.xz in its artifacts. This file matched our pattern that searches for the image itself, causing our CI jobs to fail[1].
The new regexp should match only the image itself, disregarding logs, or any other additional artifact that might be included in the future.
[0] https://github.com/gardenlinux/gardenlinux/releases/tag/2150.1.0
[1] https://github.com/ironcore-dev/os-images/actions/runs/24617135043/job/71981127138