-
Notifications
You must be signed in to change notification settings - Fork 0
112 lines (107 loc) · 4.46 KB
/
Copy pathimage-kairos-fedora.yml
File metadata and controls
112 lines (107 loc) · 4.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
---
name: Build Kairos-Fedora
on: # yamllint disable-line rule:truthy
push:
branches:
- main
paths:
- .devcontainer/**
- .github/workflows/image-kairos-fedora.yml
- ansible/**
- images/kairos-fedora/**
- justfile
- kustomization/**
tags:
- kairos-fedora-*
pull_request:
branches:
- main
paths:
- .devcontainer/**
- .github/workflows/image-kairos-fedora.yml
- ansible/**
- images/kairos-fedora/**
- justfile
- kustomization/**
jobs:
build-container:
name: E2E (${{ matrix.component }})
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
component: ${{ github.ref_type == 'tag' && fromJSON('["priorityclass"]') || fromJSON('["kube-vip", "priorityclass"]') }}
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
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:
E2E_KUSTOMIZATION_TEST: ${{ matrix.component }}
KAIROS_IMAGE: ghcr.io/${{ github.repository_owner }}/kairos-fedora:${{ steps.version_tag.outputs.tag }}
run: bash images/kairos-fedora/e2e.sh
- name: Upload E2E Logs
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: kairos-fedora-e2e-${{ matrix.component }}
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 }}