Skip to content

Commit 8edd11d

Browse files
Use test image in non-release node-installer tests
Signed-off-by: Kate Goldenring <[email protected]>
1 parent e86630e commit 8edd11d

File tree

4 files changed

+24
-0
lines changed

4 files changed

+24
-0
lines changed

.github/workflows/action-node-installer.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ on:
77
description: 'the git ref for the associated workflow'
88
type: string
99
required: true
10+
test:
11+
description: 'Is this a test run?'
12+
type: boolean
13+
required: true
1014

1115
jobs:
1216
build-and-test:
@@ -77,6 +81,13 @@ jobs:
7781
sudo chown $(id -u):$(id -g) $HOME/.kube/config
7882
until sudo microk8s status --wait-ready; do sleep 5s; echo "Try again"; done
7983
84+
- name: Update workload tag for test images
85+
if: ${{ inputs.test }}
86+
run: make update-workload-tag
87+
env:
88+
WORKLOAD_TAG: "test"
89+
working-directory: node-installer
90+
8091
- name: Run KIND test
8192
if: matrix.distribution == 'kind'
8293
run: make test-kind

.github/workflows/ci.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ jobs:
2828
if: ${{ ! github.event.pull_request.head.repo.fork }}
2929
with:
3030
ref: ${{ github.ref }}
31+
test: true
3132
test:
3233
needs: build
3334
uses: ./.github/workflows/action-test.yml

.github/workflows/release.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ jobs:
1919
needs: build
2020
with:
2121
ref: ${{ github.ref }}
22+
test: false
2223

2324
release:
2425
permissions:

node-installer/Makefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
SPIN_VERSION = v2
22
IMAGE_NAME ?= ghcr.io/spinkube/containerd-shim-spin/node-installer
3+
WORKLOAD_TAG ?= ""
34

45
# we only support x86_64 and aarch64 on Linux
56
UNAME := $(shell uname -m)
@@ -33,6 +34,16 @@ build-multi-installer-image: $(BINARY)
3334
build-dev-installer-image: $(BINARY)
3435
docker buildx build -t $(IMAGE_NAME) --load --platform $(PLATFORM) .
3536

37+
# Updates the tag of the test application image to be the value set in `WORKLOAD_TAG`. Used for testing non-release builds.
38+
update-workload-tag:
39+
@VERSION=v$$(sed -n 's/^version = "\([^"]*\)"/\1/p' ../Cargo.toml); \
40+
if [ -n "$(WORKLOAD_TAG)" ]; then \
41+
sed -i "s/$$VERSION/$(WORKLOAD_TAG)/g" ../deployments/workloads/workload.yaml; \
42+
echo "Replaced version $$VERSION with $(WORKLOAD_TAG) in ../deployments/workloads/workload.yaml"; \
43+
else \
44+
echo "WORKLOAD_TAG is not set. No replacements made."; \
45+
fi
46+
3647
test-kind:
3748
./tests/integration-test-kind.sh
3849

0 commit comments

Comments
 (0)