Several CI adjustments #157
Workflow file for this run
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
| name: Integration Tests | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| inputs: | |
| build-node-images: | |
| description: "Force building node images" | |
| required: false | |
| default: false | |
| type: boolean | |
| push-node-images: | |
| description: "Push built node images to GHCR" | |
| required: false | |
| default: false | |
| type: boolean | |
| concurrency: | |
| group: integration-${{ github.head_ref || github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| BINK_IMAGES: >- | |
| ghcr.io/bootc-dev/bink/cluster:latest | |
| ghcr.io/bootc-dev/bink/dns:latest | |
| EXTERNAL_IMAGES: >- | |
| docker.io/library/registry:2 | |
| docker.io/library/haproxy:lts-alpine | |
| quay.io/libpod/busybox:latest | |
| PUSH_REGISTRY: ghcr.io/bootc-dev/bink | |
| PUSH_IMAGE: node | |
| jobs: | |
| changes: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| node-images: ${{ steps.filter.outputs.node-images }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v7 | |
| - name: Detect changed paths | |
| id: filter | |
| uses: dorny/paths-filter@v3 | |
| with: | |
| filters: | | |
| node-images: | |
| - 'node-images/fedora/**' | |
| supported-versions: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| all-versions: ${{ steps.set-matrix.outputs.all-versions }} | |
| non-default-versions: ${{ steps.set-matrix.outputs.non-default-versions }} | |
| steps: | |
| - name: Get supported Kubernetes versions | |
| id: set-matrix | |
| run: | | |
| DEFAULT="1.35" | |
| 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))') | |
| echo "all-versions=${ALL}" >> "$GITHUB_OUTPUT" | |
| echo "non-default-versions=${NON_DEFAULT}" >> "$GITHUB_OUTPUT" | |
| build-node-images: | |
| needs: [changes, supported-versions] | |
| if: needs.changes.outputs.node-images == 'true' || inputs.build-node-images == true | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| kube-minor: ${{ fromJson(needs.supported-versions.outputs.all-versions) }} | |
| permissions: | |
| contents: read | |
| packages: write | |
| container: | |
| image: quay.io/fedora/fedora:44 | |
| options: --privileged --device /dev/kvm -v /var/lib/containers | |
| steps: | |
| - name: Install dependencies | |
| run: dnf install -y --setopt=install_weak_deps=0 podman git make | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| - name: Build bootc image | |
| working-directory: node-images/fedora | |
| run: make build-bootc-image KUBE_MINOR=${{ matrix.kube-minor }} | |
| - name: Determine image tag | |
| id: meta | |
| working-directory: node-images/fedora | |
| run: | | |
| TAG=$(make -s print-image-tag KUBE_MINOR=${{ matrix.kube-minor }}) | |
| echo "tag=${TAG}" >> "$GITHUB_OUTPUT" | |
| echo "Image tag: ${TAG}" | |
| - name: Build disk image | |
| working-directory: node-images/fedora | |
| run: make build-disk-image KUBE_MINOR=${{ matrix.kube-minor }} | |
| - name: Save disk image | |
| working-directory: node-images/fedora | |
| run: | | |
| DISK_SRC=$(make -s print-node-image KUBE_MINOR=${{ matrix.kube-minor }}) | |
| podman save -o ${{ github.workspace }}/node-image.tar ${DISK_SRC} | |
| - name: Upload disk image artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: node-image-${{ matrix.kube-minor }} | |
| path: node-image.tar | |
| - name: Build composefs disk image | |
| working-directory: node-images/fedora | |
| run: make build-disk-image-composefs KUBE_MINOR=${{ matrix.kube-minor }} | |
| - name: Save composefs disk image | |
| working-directory: node-images/fedora | |
| run: | | |
| DISK_SRC=$(make -s print-node-image-composefs KUBE_MINOR=${{ matrix.kube-minor }}) | |
| podman save -o ${{ github.workspace }}/node-image-composefs.tar ${DISK_SRC} | |
| - name: Upload composefs disk image artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: node-image-composefs-${{ matrix.kube-minor }} | |
| path: node-image-composefs.tar | |
| - name: Log in to GHCR | |
| if: github.event_name == 'push' || inputs.push-node-images == true | |
| run: podman login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} ghcr.io | |
| - name: Push bootc image | |
| id: push-bootc | |
| if: github.event_name == 'push' || inputs.push-node-images == true | |
| working-directory: node-images/fedora | |
| run: | | |
| TAG=${{ steps.meta.outputs.tag }} | |
| BOOTC_SRC=$(make -s print-bootc-image KUBE_MINOR=${{ matrix.kube-minor }}) | |
| PUSH_DEST=${{ env.PUSH_REGISTRY }}/${{ env.PUSH_IMAGE }} | |
| podman tag ${BOOTC_SRC} ${PUSH_DEST}:${TAG} | |
| podman push ${PUSH_DEST}:${TAG} | |
| - name: Push disk image | |
| if: github.event_name == 'push' || inputs.push-node-images == true | |
| working-directory: node-images/fedora | |
| run: | | |
| TAG=${{ steps.meta.outputs.tag }} | |
| DISK_SRC=$(make -s print-node-image KUBE_MINOR=${{ matrix.kube-minor }}) | |
| PUSH_DEST=${{ env.PUSH_REGISTRY }}/${{ env.PUSH_IMAGE }} | |
| podman tag ${DISK_SRC} ${PUSH_DEST}:${TAG}-disk | |
| podman push ${PUSH_DEST}:${TAG}-disk | |
| - name: Push composefs disk image | |
| if: github.event_name == 'push' || inputs.push-node-images == true | |
| working-directory: node-images/fedora | |
| run: | | |
| TAG=${{ steps.meta.outputs.tag }} | |
| DISK_SRC=$(make -s print-node-image-composefs KUBE_MINOR=${{ matrix.kube-minor }}) | |
| PUSH_DEST=${{ env.PUSH_REGISTRY }}/${{ env.PUSH_IMAGE }} | |
| podman tag ${DISK_SRC} ${PUSH_DEST}:${TAG}-disk-composefs | |
| podman push ${PUSH_DEST}:${TAG}-disk-composefs | |
| integration-tests: | |
| needs: [changes, build-node-images] | |
| # Run when build-node-images is skipped (no node image changes) or succeeded, but not when it failed | |
| if: ${{ !cancelled() && needs.build-node-images.result != 'failure' }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 120 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v7 | |
| - name: Download node image artifact | |
| if: needs.build-node-images.result == 'success' | |
| uses: actions/download-artifact@v7 | |
| with: | |
| name: node-image-1.35 | |
| - name: Load node image | |
| if: needs.build-node-images.result == 'success' | |
| run: sudo podman load -i node-image.tar | |
| - name: Setup bink | |
| uses: ./.github/actions/setup-bink | |
| with: | |
| cache-key-prefix: integration | |
| # If the build of the image was skipped then we use the default one which needs to be pulled, otherwise we use | |
| # the local one | |
| node-image: ${{ needs.build-node-images.result == 'skipped' && 'ghcr.io/bootc-dev/bink/node:v1.35-fedora-44-disk' || '' }} | |
| - name: Run integration tests | |
| run: sudo make test-integration TEST_PROCS=2 | |
| timeout-minutes: 90 | |
| env: | |
| CONTAINER_HOST: unix:///run/podman/podman.sock | |
| - name: Collect logs | |
| if: failure() | |
| run: .github/collect-logs.sh | |
| - name: Upload logs | |
| if: failure() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: test-logs | |
| path: /tmp/bink-logs/ | |
| - name: Cleanup test clusters | |
| if: always() | |
| run: | | |
| sudo podman ps -a --filter "name=k8s-test-bink" --format '{{.Names}}' | \ | |
| xargs -r sudo podman rm -f 2>/dev/null || true | |
| sudo podman volume prune -f 2>/dev/null || true | |
| integration-tests-composefs: | |
| needs: [changes, build-node-images] | |
| # Run when build-node-images is skipped (no node image changes) or succeeded, but not when it failed | |
| if: ${{ !cancelled() && needs.build-node-images.result != 'failure' }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 120 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v7 | |
| - name: Download composefs node image artifact | |
| if: needs.build-node-images.result == 'success' | |
| uses: actions/download-artifact@v7 | |
| with: | |
| name: node-image-composefs-1.35 | |
| - name: Load composefs node image | |
| if: needs.build-node-images.result == 'success' | |
| run: sudo podman load -i node-image-composefs.tar | |
| - name: Setup bink | |
| uses: ./.github/actions/setup-bink | |
| with: | |
| cache-key-prefix: composefs | |
| node-image: ${{ needs.build-node-images.result == 'skipped' && 'ghcr.io/bootc-dev/bink/node:v1.35-fedora-44-disk-composefs' || '' }} | |
| - name: Run composefs integration tests | |
| run: sudo make test-integration-composefs | |
| timeout-minutes: 90 | |
| env: | |
| CONTAINER_HOST: unix:///run/podman/podman.sock | |
| BINK_NODE_IMAGE: ghcr.io/bootc-dev/bink/node:v1.35-fedora-44-disk-composefs | |
| - name: Collect logs | |
| if: failure() | |
| run: .github/collect-logs.sh | |
| - name: Upload logs | |
| if: failure() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: test-logs-composefs | |
| path: /tmp/bink-logs/ | |
| - name: Cleanup test clusters | |
| if: always() | |
| run: | | |
| sudo podman ps -a --filter "name=k8s-test-bink" --format '{{.Names}}' | \ | |
| xargs -r sudo podman rm -f 2>/dev/null || true | |
| sudo podman volume prune -f 2>/dev/null || true | |
| integration-tests-k8s-versions: | |
| needs: [changes, supported-versions, build-node-images] | |
| # Run when build-node-images is skipped (no node image changes) or succeeded, but not when it failed | |
| if: ${{ !cancelled() && needs.build-node-images.result != 'failure' }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 120 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| kube-minor: ${{ fromJson(needs.supported-versions.outputs.non-default-versions) }} | |
| env: | |
| BINK_NODE_IMAGE: ghcr.io/bootc-dev/bink/node:v${{ matrix.kube-minor }}-fedora-44-disk | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v7 | |
| - name: Download node image artifact | |
| if: needs.build-node-images.result == 'success' | |
| uses: actions/download-artifact@v7 | |
| with: | |
| name: node-image-${{ matrix.kube-minor }} | |
| - name: Load node image | |
| if: needs.build-node-images.result == 'success' | |
| run: sudo podman load -i node-image.tar | |
| - name: Setup bink | |
| uses: ./.github/actions/setup-bink | |
| with: | |
| cache-key-prefix: k8s-${{ matrix.kube-minor }} | |
| node-image: ${{ needs.build-node-images.result == 'skipped' && format('ghcr.io/bootc-dev/bink/node:v{0}-fedora-44-disk', matrix.kube-minor) || '' }} | |
| - name: Run integration tests (K8s ${{ matrix.kube-minor }}) | |
| run: sudo make test-integration GINKGO_FOCUS="should create and initialize a complete Kubernetes cluster" | |
| timeout-minutes: 90 | |
| env: | |
| CONTAINER_HOST: unix:///run/podman/podman.sock | |
| BINK_NODE_IMAGE: ${{ env.BINK_NODE_IMAGE }} | |
| - name: Collect logs | |
| if: failure() | |
| run: .github/collect-logs.sh | |
| - name: Upload logs | |
| if: failure() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: test-logs-k8s-${{ matrix.kube-minor }} | |
| path: /tmp/bink-logs/ | |
| - name: Cleanup test clusters | |
| if: always() | |
| run: | | |
| sudo podman ps -a --filter "name=k8s-test-bink" --format '{{.Names}}' | \ | |
| xargs -r sudo podman rm -f 2>/dev/null || true | |
| sudo podman volume prune -f 2>/dev/null || true |