diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 461a3e9..4c086dd 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -17,6 +17,18 @@ concurrency: cancel-in-progress: true jobs: + supported-versions: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + steps: + - name: Get supported Kubernetes versions + id: set-matrix + run: | + MATRIX=$(curl -s https://endoflife.date/api/kubernetes.json | \ + jq -c '[.[] | select(.eol > (now | strftime("%Y-%m-%d"))) | .cycle][:3]') + echo "matrix=${MATRIX}" >> "$GITHUB_OUTPUT" + unit: runs-on: ubuntu-latest permissions: @@ -83,15 +95,40 @@ jobs: name: bink path: bink + build-operator: + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Checkout + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + persist-credentials: false + + - name: Build operator image + run: make buildimg + + - name: Save operator image + run: podman save -o operator-image.tar bootc-operator:dev + + - name: Upload operator image + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: operator-image + path: operator-image.tar + e2e: runs-on: ubuntu-latest - needs: build-bink + needs: [build-bink, build-operator, supported-versions] timeout-minutes: 30 permissions: contents: read - packages: write + strategy: + fail-fast: false + matrix: + kube-minor: ${{ fromJson(needs.supported-versions.outputs.matrix) }} env: - IMAGE: ghcr.io/${{ github.repository }} + BINK_NODE_DISK_IMAGE: ghcr.io/bootc-dev/bink/node:v${{ matrix.kube-minor }}-fedora-44-disk steps: - name: Checkout uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 @@ -138,8 +175,13 @@ jobs: - name: Start podman socket run: systemctl --user start podman.socket - - name: Build operator image - run: make buildimg + - name: Download operator image + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: operator-image + + - name: Load operator image + run: podman load -i operator-image.tar - name: Start bink cluster run: make start-bink @@ -158,12 +200,29 @@ jobs: if: always() uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: - name: e2e-logs + name: e2e-logs-${{ matrix.kube-minor }} path: _output/logs/ if-no-files-found: ignore + push: + if: github.event_name == 'push' + runs-on: ubuntu-latest + needs: e2e + permissions: + contents: read + packages: write + env: + IMAGE: ghcr.io/${{ github.repository }} + steps: + - name: Download operator image + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: operator-image + + - name: Load operator image + run: podman load -i operator-image.tar + - name: Push to GHCR - if: github.event_name == 'push' env: ACTOR: ${{ github.actor }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/Makefile b/Makefile index 490f271..c9e5f7d 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,8 @@ CONTAINER_TOOL ?= podman BINK_CLUSTER_NAME ?= e2e KUBECONFIG_BINK ?= ./kubeconfig-$(BINK_CLUSTER_NAME) ARTIFACTS ?= $(abspath _output/logs) -BINK_NODE_DISK_IMAGE ?= ghcr.io/bootc-dev/bink/node:v1.35-fedora-44-disk +DEFAULT_KUBE_MINOR ?= 1.35 +BINK_NODE_DISK_IMAGE ?= ghcr.io/bootc-dev/bink/node:v$(DEFAULT_KUBE_MINOR)-fedora-44-disk BINK_LOCAL_REGISTRY_NODE_IMAGE ?= registry.cluster.local:5000/node # YEAR defines the year value used for substituting the YEAR placeholder in the boilerplate header. YEAR ?= $(shell date +%Y) @@ -21,6 +22,9 @@ all: build ##@ General +print-var-%: + @echo $($*) + .PHONY: help help: ## Display this help. @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)