Skip to content

cli: fix node list to show only cluster nodes #270

cli: fix node list to show only cluster nodes

cli: fix node list to show only cluster nodes #270

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@v4
with:
filters: |
node-images:
- 'node-images/fedora/**'
- '.github/workflows/integration-tests.yml'
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 }}
default-version: ${{ steps.set-matrix.outputs.default-version }}
fedora-version: ${{ steps.set-matrix.outputs.fedora-version }}
branch-tag: ${{ steps.set-matrix.outputs.branch-tag }}
steps:
- name: Get supported Kubernetes versions
id: set-matrix
run: |
DEFAULT="1.35"
FEDORA_VERSION="44"
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"
echo "default-version=${DEFAULT}" >> "$GITHUB_OUTPUT"
echo "fedora-version=${FEDORA_VERSION}" >> "$GITHUB_OUTPUT"
echo "branch-tag=${BRANCH_TAG}" >> "$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
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Set up KVM
run: |
sudo chmod 666 /dev/kvm
ls -la /dev/kvm
- name: Start local registry
run: sudo podman run -d -p 5000:5000 --name registry docker.io/library/registry:2
- name: Build bootc image
working-directory: node-images/fedora
run: sudo 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 }})
STAGING_TAG=${{ needs.supported-versions.outputs.branch-tag }}-${TAG}
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
echo "staging-tag=${STAGING_TAG}" >> "$GITHUB_OUTPUT"
echo "Image tag: ${TAG} (staging: ${STAGING_TAG})"
# Podman reports a different digest for a freshly-built local image than the
# one bcvk will see once it's distributed via a real registry. Round-tripping
# through a registry normalizes it. This must not depend on GHCR credentials:
# it always runs, including for fork PRs, which never get a writable token.
- name: Push bootc image to local registry
working-directory: node-images/fedora
run: |
BOOTC_SRC=$(make -s print-bootc-image KUBE_MINOR=${{ matrix.kube-minor }})
sudo podman tag ${BOOTC_SRC} localhost:5000/node:${{ steps.meta.outputs.tag }}
sudo podman push --tls-verify=false localhost:5000/node:${{ steps.meta.outputs.tag }}
- name: Pull bootc image from local registry
working-directory: node-images/fedora
run: |
BOOTC_SRC=$(make -s print-bootc-image KUBE_MINOR=${{ matrix.kube-minor }})
sudo podman rmi ${BOOTC_SRC} || true
sudo podman pull --tls-verify=false localhost:5000/node:${{ steps.meta.outputs.tag }}
sudo podman tag localhost:5000/node:${{ steps.meta.outputs.tag }} ${BOOTC_SRC}
echo "Bootc image digest: $(sudo podman inspect --format '{{.Digest}}' ${BOOTC_SRC})"
# Only stage to GHCR when push-node-images will actually run afterward: that's
# the sole consumer, and it only runs on push/workflow_dispatch, which are the
# only contexts guaranteed to have a writable GITHUB_TOKEN.
- name: Log in to GHCR
if: github.event_name == 'push' || inputs.push-node-images == true
run: sudo podman login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} ghcr.io
- name: Push bootc image to GHCR (staging)
if: github.event_name == 'push' || inputs.push-node-images == true
working-directory: node-images/fedora
run: |
BOOTC_SRC=$(make -s print-bootc-image KUBE_MINOR=${{ matrix.kube-minor }})
PUSH_DEST=${{ env.PUSH_REGISTRY }}/${{ env.PUSH_IMAGE }}
sudo podman tag ${BOOTC_SRC} ${PUSH_DEST}:${{ steps.meta.outputs.staging-tag }}
sudo podman push ${PUSH_DEST}:${{ steps.meta.outputs.staging-tag }}
- name: Build disk image
working-directory: node-images/fedora
run: sudo 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 }})
sudo 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: sudo 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 }})
sudo 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: Collect logs
if: failure()
run: .github/collect-logs.sh
- name: Upload logs
if: failure()
uses: actions/upload-artifact@v7
with:
name: build-logs-${{ matrix.kube-minor }}
path: /tmp/bink-logs/
integration-tests:
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
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Download node image artifact
if: needs.build-node-images.result == 'success'
uses: actions/download-artifact@v8
with:
name: node-image-${{ needs.supported-versions.outputs.default-version }}
- name: Load node image
if: needs.build-node-images.result == 'success'
run: podman load -i node-image.tar
- name: Setup bink
uses: ./.github/actions/setup-bink
with:
cache-key-prefix: integration
node-image: ${{ needs.build-node-images.result == 'skipped' && format('ghcr.io/bootc-dev/bink/node:v{0}-fedora-{1}-disk', needs.supported-versions.outputs.default-version, needs.supported-versions.outputs.fedora-version) || '' }}
- name: Run integration tests
run: make test-integration TEST_PROCS=2
timeout-minutes: 90
- 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: |
podman ps -a --filter "name=k8s-test-bink" --format '{{.Names}}' | \
xargs -r podman rm -f 2>/dev/null || true
podman volume prune -f 2>/dev/null || true
integration-tests-composefs:
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
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@v8
with:
name: node-image-composefs-${{ needs.supported-versions.outputs.default-version }}
- name: Load composefs node image
if: needs.build-node-images.result == 'success'
run: 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' && format('ghcr.io/bootc-dev/bink/node:v{0}-fedora-{1}-disk-composefs', needs.supported-versions.outputs.default-version, needs.supported-versions.outputs.fedora-version) || '' }}
- name: Run composefs integration tests
run: make test-integration-composefs
timeout-minutes: 90
env:
BINK_NODE_IMAGE: ghcr.io/bootc-dev/bink/node:v${{ needs.supported-versions.outputs.default-version }}-fedora-${{ needs.supported-versions.outputs.fedora-version }}-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: |
podman ps -a --filter "name=k8s-test-bink" --format '{{.Names}}' | \
xargs -r podman rm -f 2>/dev/null || true
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-${{ needs.supported-versions.outputs.fedora-version }}-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@v8
with:
name: node-image-${{ matrix.kube-minor }}
- name: Load node image
if: needs.build-node-images.result == 'success'
run: 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-{1}-disk', matrix.kube-minor, needs.supported-versions.outputs.fedora-version) || '' }}
- name: Run integration tests (K8s ${{ matrix.kube-minor }})
run: make test-integration GINKGO_FOCUS="should create and initialize a complete Kubernetes cluster"
timeout-minutes: 90
env:
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: |
podman ps -a --filter "name=k8s-test-bink" --format '{{.Names}}' | \
xargs -r podman rm -f 2>/dev/null || true
podman volume prune -f 2>/dev/null || true
push-node-images:
needs:
[
supported-versions,
build-node-images,
integration-tests,
integration-tests-composefs,
integration-tests-k8s-versions,
]
if: >-
needs.build-node-images.result == 'success' &&
(github.event_name == 'push' || inputs.push-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
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Download disk image artifact
uses: actions/download-artifact@v8
with:
name: node-image-${{ matrix.kube-minor }}
- name: Download composefs disk image artifact
uses: actions/download-artifact@v8
with:
name: node-image-composefs-${{ matrix.kube-minor }}
- name: Load images
run: |
sudo podman load -i node-image.tar
sudo podman load -i node-image-composefs.tar
- name: Determine image tag
id: meta
working-directory: node-images/fedora
run: |
TAG=$(make -s print-image-tag KUBE_MINOR=${{ matrix.kube-minor }})
STAGING_TAG=${{ needs.supported-versions.outputs.branch-tag }}-${TAG}
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
echo "staging-tag=${STAGING_TAG}" >> "$GITHUB_OUTPUT"
- name: Log in to GHCR
run: sudo podman login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} ghcr.io
- name: Push bootc image
working-directory: node-images/fedora
run: |
TAG=${{ steps.meta.outputs.tag }}
STAGING_TAG=${{ steps.meta.outputs.staging-tag }}
PUSH_DEST=${{ env.PUSH_REGISTRY }}/${{ env.PUSH_IMAGE }}
sudo skopeo copy docker://${PUSH_DEST}:${STAGING_TAG} docker://${PUSH_DEST}:${TAG}
if [ "${{ matrix.kube-minor }}" = "${{ needs.supported-versions.outputs.default-version }}" ]; then
sudo skopeo copy docker://${PUSH_DEST}:${STAGING_TAG} docker://${PUSH_DEST}:latest
fi
- name: Push disk image
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 }}
sudo podman tag ${DISK_SRC} ${PUSH_DEST}:${TAG}-disk
sudo podman push ${PUSH_DEST}:${TAG}-disk
if [ "${{ matrix.kube-minor }}" = "${{ needs.supported-versions.outputs.default-version }}" ]; then
sudo podman tag ${DISK_SRC} ${PUSH_DEST}:latest-disk
sudo podman push ${PUSH_DEST}:latest-disk
fi
- name: Push composefs disk image
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 }}
sudo podman tag ${DISK_SRC} ${PUSH_DEST}:${TAG}-disk-composefs
sudo podman push ${PUSH_DEST}:${TAG}-disk-composefs
if [ "${{ matrix.kube-minor }}" = "${{ needs.supported-versions.outputs.default-version }}" ]; then
sudo podman tag ${DISK_SRC} ${PUSH_DEST}:latest-disk-composefs
sudo podman push ${PUSH_DEST}:latest-disk-composefs
fi