Skip to content

test(kairos): run component canaries #169

test(kairos): run component canaries

test(kairos): run component canaries #169

---
name: Build Kairos-Fedora
on: # yamllint disable-line rule:truthy
push:
branches:
- main
paths: &kairos_paths
- .devcontainer/Containerfile
- .github/workflows/image-kairos-fedora.yml
- ansible/galaxy.yml
- ansible/requirements.txt
- ansible/roles/minikube_test/**
- images/kairos-fedora/**
- images/devcontainer-base/build_files/packages/just.sh
- justfile
- kustomization/components/**
- kustomization/tests/**
tags:
- kairos-fedora-*
pull_request:
branches:
- main
paths: *kairos_paths
jobs:
build-container:
runs-on: ubuntu-24.04
timeout-minutes: 90
permissions:
contents: read
packages: write
steps:
- name: Checkout Repo
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Login to GitHub Container Registry
uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 # v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Note: this must start with a number for the build to work correctly!
- name: Compute Version Tag
env:
BRANCH: ${{ github.ref_type == 'tag' && github.ref_name || github.event_name == 'pull_request' && format('{0}-pr', github.event.number) || format('{0}.{1}.{2}', github.run_id, github.run_number, github.run_attempt) }}
id: version_tag
run: echo "tag=$BRANCH" | sed -e 's/kairos-fedora-//' >> "$GITHUB_OUTPUT"
- name: Generate Metadata
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0
id: metadata
with:
images: ghcr.io/${{ github.repository_owner }}/kairos-fedora
- name: Build Image
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
with:
build-args: |
VERSION=${{ steps.version_tag.outputs.tag }}
context: images/kairos-fedora
file: images/kairos-fedora/Containerfile
labels: ${{ steps.metadata.outputs.labels }}
load: true
push: false
tags: ghcr.io/${{ github.repository_owner }}/kairos-fedora:${{ steps.version_tag.outputs.tag }}
- name: Install E2E Dependencies
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends --yes curl openssh-client ovmf python3-venv qemu-system-x86 qemu-utils
sudo images/devcontainer-base/build_files/packages/just.sh
python3 -m venv "${RUNNER_TEMP}/kairos-e2e-venv"
"${RUNNER_TEMP}/kairos-e2e-venv/bin/pip" install --requirement ansible/requirements.txt
"${RUNNER_TEMP}/kairos-e2e-venv/bin/ansible-galaxy" collection install --force ansible
echo "${RUNNER_TEMP}/kairos-e2e-venv/bin" >> "$GITHUB_PATH"
mkdir -p "${RUNNER_TEMP}/kustomize-bin"
kustomize_container="$(docker create registry.k8s.io/kustomize/kustomize:v5.8.1@sha256:899fcd3bc898160e62bcaf82932b0cb29ba38d16272353db2e7acbba82129429)"
trap 'docker rm --force "$kustomize_container" >/dev/null' EXIT
docker cp "${kustomize_container}:/app/kustomize" "${RUNNER_TEMP}/kustomize-bin/kustomize"
chmod 0755 "${RUNNER_TEMP}/kustomize-bin/kustomize"
echo "${RUNNER_TEMP}/kustomize-bin" >> "$GITHUB_PATH"
- name: Enable KVM Access
run: |
test -e /dev/kvm
sudo chmod a+rw /dev/kvm
test -r /dev/kvm
test -w /dev/kvm
ls -l /dev/kvm
- name: Run Kairos Fedora E2E
env:
KAIROS_IMAGE: ghcr.io/${{ github.repository_owner }}/kairos-fedora:${{ steps.version_tag.outputs.tag }}
run: just e2e-kairos-fedora priorityclass
- name: Upload E2E Logs
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: kairos-fedora-e2e
path: |
build/e2e/kairos-fedora/install-cloud-config.yaml
build/e2e/kairos-fedora/id_ed25519.pub
build/e2e/kairos-fedora/logs
if-no-files-found: ignore
- name: Push Image
if: github.ref_type == 'tag'
run: docker push ghcr.io/${{ github.repository_owner }}/kairos-fedora:${{ steps.version_tag.outputs.tag }}