Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 3 additions & 41 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ jobs:
ALL=$(curl -s https://endoflife.date/api/kubernetes.json | \
jq -c '[.[] | select(.eol > (now | strftime("%Y-%m-%d"))) | .cycle][:3]')
NON_DEFAULT=$(echo "$ALL" | jq -c --arg default "$DEFAULT" 'map(select(. != $default))')
# Construct the staging branch tag based on the branch name that is suitable for container image
# tags. It converts all the character to lower cases, and replaces all non lower cases letter, numbers, '.'
# or '-' with a single hyphen.
BRANCH_TAG=$(echo "${{ github.head_ref || github.ref_name }}" | tr '[:upper:]' '[:lower:]' | sed -E 's/[^a-z0-9._-]+/-/g')
echo "all-versions=${ALL}" >> "$GITHUB_OUTPUT"
echo "non-default-versions=${NON_DEFAULT}" >> "$GITHUB_OUTPUT"
Expand Down Expand Up @@ -439,44 +442,3 @@ jobs:
sudo podman tag ${DISK_SRC} ${PUSH_DEST}:latest-disk-composefs
sudo podman push ${PUSH_DEST}:latest-disk-composefs
fi

cleanup-staged-images:
needs:
[
supported-versions,
build-node-images,
integration-tests,
integration-tests-composefs,
integration-tests-k8s-versions,
push-node-images,
]
# Only staged (push/workflow_dispatch) runs push anything to GHCR in the first
# place. Always run once every consumer has finished, regardless of whether
# they succeeded, failed, or were skipped.
if: always() && needs.build-node-images.result != 'skipped' && (github.event_name == 'push' || inputs.push-node-images == true)
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- name: Delete staged bootc images from GHCR
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
OWNER=$(echo "${{ env.PUSH_REGISTRY }}" | cut -d'/' -f2)
PACKAGE="$(echo "${{ env.PUSH_REGISTRY }}" | cut -d'/' -f3)/${{ env.PUSH_IMAGE }}"
PACKAGE_ENC="${PACKAGE//\//%2F}"
BRANCH_TAG=${{ needs.supported-versions.outputs.branch-tag }}

for kube_minor in $(echo '${{ needs.supported-versions.outputs.all-versions }}' | jq -r '.[]'); do
TAG="v${kube_minor}-fedora-${{ needs.supported-versions.outputs.fedora-version }}"
STAGING_TAG="${BRANCH_TAG}-${TAG}"
echo "Looking up staged image tag: ${STAGING_TAG}"
VERSION_ID=$(gh api "/orgs/${OWNER}/packages/container/${PACKAGE_ENC}/versions" --paginate \
--jq ".[] | select(.metadata.container.tags[]? == \"${STAGING_TAG}\") | .id" | head -n1)
if [ -n "$VERSION_ID" ]; then
gh api --method DELETE "/orgs/${OWNER}/packages/container/${PACKAGE_ENC}/versions/${VERSION_ID}"
echo "Deleted staged image version ${VERSION_ID} (${STAGING_TAG})"
else
echo "No staged image found for ${STAGING_TAG}, skipping"
fi
done
Loading