55 pull_request :
66 branches :
77 - main
8+ paths-ignore :
9+ - ' charts/**'
810 push :
911 branches :
1012 - main
13+ paths-ignore :
14+ - ' charts/**'
1115
1216permissions :
1317 contents : read
@@ -22,39 +26,38 @@ jobs:
2226 with :
2327 # needed for git describe --tags
2428 fetch-depth : 0
25- - uses : actions/setup-go@v6
26- with :
27- go-version-file : ' go.mod'
2829 - uses : docker/setup-buildx-action@v4
2930 - uses : docker/login-action@v4
3031 with :
3132 registry : ghcr.io
3233 username : ${{ github.actor }}
3334 password : ${{ secrets.GITHUB_TOKEN }}
34- - name : Build images
35- run : |
36- set -x
37- tag="$(git describe --tags)"
38-
39- echo "Building controller image"
40- go mod vendor
41- docker build \
42- --cache-from type=gha \
43- --cache-to type=gha,mode=max \
44- -t "ghcr.io/kilnfi/carina:controller-${tag}" .
45-
46- echo "Building scheduler image"
47- cd scheduler
48- go mod vendor
49- docker build \
50- --cache-from type=gha \
51- --cache-to type=gha,mode=max \
52- -t "ghcr.io/kilnfi/carina:scheduler-${tag}" .
53- # # Interactive debug
54- # - name: Setup tmate session
55- # uses: mxschmitt/action-tmate@v3
56- # with:
57- # detached: true
35+ - name : Compute tag
36+ id : tag
37+ run : echo "value=$(git describe --tags)" >> "$GITHUB_OUTPUT"
38+ - name : Build and push controller image
39+ uses : docker/build-push-action@v6
40+ with :
41+ context : .
42+ load : true
43+ push : ${{ github.ref_name == 'main' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') }}
44+ tags : ghcr.io/kilnfi/carina:controller-${{ steps.tag.outputs.value }}
45+ cache-from : type=gha,scope=controller
46+ cache-to : type=gha,mode=max,scope=controller
47+ - name : Build and push scheduler image
48+ uses : docker/build-push-action@v6
49+ with :
50+ context : ./scheduler
51+ load : true
52+ push : ${{ github.ref_name == 'main' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') }}
53+ tags : ghcr.io/kilnfi/carina:scheduler-${{ steps.tag.outputs.value }}
54+ cache-from : type=gha,scope=scheduler
55+ cache-to : type=gha,mode=max,scope=scheduler
56+ # Interactive debug
57+ - name : Setup tmate session
58+ uses : mxschmitt/action-tmate@v3
59+ with :
60+ detached : true
5861 - name : Create KinD cluster
5962 if : github.ref_name != 'main'
6063 uses : helm/kind-action@v1
@@ -63,57 +66,16 @@ jobs:
6366 - name : Test Kubernetes
6467 if : github.ref_name != 'main'
6568 run : |
66- set -x
67- tag="$(git describe --tags) "
69+ set -eu -o pipefail - x
70+ tag="${{ steps.tag.outputs.value }} "
6871 kind load docker-image "ghcr.io/kilnfi/carina:controller-${tag}" "ghcr.io/kilnfi/carina:scheduler-${tag}"
6972
70- # Install carina without a device first — we need the carina-node
71- # daemonset running to create a fake block device inside it.
72- sed -i -e "s/__TAG__/${tag}/" .github/kiln-values.yaml
73- helm upgrade --install --create-namespace -n carina -f .github/kiln-values.yaml --wait carina-csi-driver charts/
73+ helm install --create-namespace -n carina --set carina-scheduler.tag="${tag}" --set image.carina.tag="${tag}" --hide-notes --wait carina-csi-driver charts/
7474
75- # Create a 50G loopback device inside carina-node to simulate a disk,
76- # then re-install with the device configured and initialize LVM on it.
75+ # Create a 50G loopback device inside carina-node to simulate a disk
7776 kubectl wait pod -n carina -l app=csi-carina-node --for=condition=ready --timeout=120s
78- device="$(kubectl exec -t -n carina ds/csi-carina-node -c csi-carina-node -- \
79- sh -c 'truncate -s 50G /tmp/disk.device; losetup --show -f /tmp/disk.device')"
80- sed -i -e "s/__DEVICE__/${device#/dev/}/" .github/kiln-values.yaml
81- kubectl exec -t -n carina ds/csi-carina-node -c csi-carina-node -- \
82- sh -c "pvcreate ${device}"
83- helm upgrade --install -n carina --hide-notes -f .github/kiln-values.yaml --wait carina-csi-driver charts/
77+ kubectl exec -t -n carina -c csi-carina-node ds/csi-carina-node -- sh -c "truncate -s 50G /tmp/disk.device && losetup /dev/loop2 /tmp/disk.device && pvcreate /dev/loop2"
78+ sleep 30s
8479
8580 # Run the helm test — creates a PVC and a pod that uses carina storage.
8681 helm test -n carina --hide-notes carina-csi-driver
87- - name : Push image
88- if : github.ref_name == 'main' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
89- run : |
90- set -x
91- tag="$(git describe --tags)"
92-
93- docker push "ghcr.io/kilnfi/carina:controller-${tag}"
94- docker push "ghcr.io/kilnfi/carina:scheduler-${tag}"
95-
96- helm :
97- name : Helm chart
98- runs-on : ubuntu-latest
99- steps :
100- - name : Checkout
101- uses : actions/checkout@v6
102- with :
103- # needed for git describe --tags
104- fetch-depth : 0
105- - name : Login to GitHub Container Registry
106- uses : docker/login-action@v4
107- with :
108- registry : ghcr.io
109- username : ${{ github.actor }}
110- password : ${{ secrets.GITHUB_TOKEN }}
111- - name : Push chart
112- if : github.ref_name == 'main' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
113- run : |
114- set -x
115- tag="$(git describe --tags)"
116-
117- sed -i -r "s/^(appV|v)ersion *:.*$/\1ersion: $tag/" charts/Chart.yaml
118- helm package charts --version "${tag}"
119- HELM_EXPERIMENTAL_OCI=1 helm push "carina-csi-driver-${tag}.tgz" "oci://ghcr.io/kilnfi/helm-charts"
0 commit comments