Update Docker to v45 #31
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: Build and Push Node Image | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - "node-images/fedora/**" | |
| pull_request: | |
| paths: | |
| - "node-images/fedora/**" | |
| workflow_dispatch: | |
| inputs: | |
| push: | |
| description: "Push image to registry" | |
| required: false | |
| default: "false" | |
| type: boolean | |
| env: | |
| PUSH_REGISTRY: ghcr.io/bootc-dev/bink | |
| PUSH_IMAGE: node | |
| 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" | |
| build: | |
| needs: supported-versions | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| kube-minor: ${{ fromJson(needs.supported-versions.outputs.matrix) }} | |
| 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: Log in to GHCR | |
| if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.push) | |
| run: podman login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} ghcr.io | |
| - 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: Push bootc image | |
| id: push-bootc | |
| if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.push) | |
| 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 --digestfile=/tmp/bootc-digest ${PUSH_DEST}:${TAG} | |
| BOOTC_DIGEST=$(cat /tmp/bootc-digest) | |
| echo "digest=${BOOTC_DIGEST}" >> "$GITHUB_OUTPUT" | |
| echo "Bootc image pushed with digest: ${BOOTC_DIGEST}" | |
| echo "Clean up local images" | |
| podman rmi -f ${BOOTC_SRC} ${PUSH_DEST}:${TAG} | |
| echo "push_dest=${PUSH_DEST}:${TAG}" >> "$GITHUB_OUTPUT" | |
| - name: Build disk image | |
| working-directory: node-images/fedora | |
| run: | | |
| BOOTC_DIGEST="${{ steps.push-bootc.outputs.digest }}" | |
| PUSH_DEST="${{ steps.push-bootc.outputs.push_dest }}" | |
| if [ -n "${BOOTC_DIGEST}" ] && [ -n "${PUSH_DEST}" ]; then | |
| podman pull "${PUSH_DEST}" | |
| make build-disk-image KUBE_MINOR=${{ matrix.kube-minor }} BOOTC_IMAGE="${PUSH_DEST}" BOOTC_DIGEST="${BOOTC_DIGEST}" | |
| else | |
| make build-disk-image KUBE_MINOR=${{ matrix.kube-minor }} | |
| fi | |
| - name: Push disk image | |
| if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.push) | |
| 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: Build composefs disk image | |
| working-directory: node-images/fedora | |
| run: | | |
| BOOTC_DIGEST="${{ steps.push-bootc.outputs.digest }}" | |
| PUSH_DEST="${{ steps.push-bootc.outputs.push_dest }}" | |
| if [ -n "${BOOTC_DIGEST}" ] && [ -n "${PUSH_DEST}" ]; then | |
| make build-disk-image-composefs KUBE_MINOR=${{ matrix.kube-minor }} BOOTC_IMAGE="${PUSH_DEST}" BOOTC_DIGEST="${BOOTC_DIGEST}" | |
| else | |
| make build-disk-image-composefs KUBE_MINOR=${{ matrix.kube-minor }} | |
| fi | |
| - name: Push composefs disk image | |
| if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.push) | |
| 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 |