Skip to content

Commit 11e2e12

Browse files
authored
Merge pull request #294 from spinframework/refactor-node-installer
node-installer: refactor the integration tests
2 parents a722522 + 32e56d6 commit 11e2e12

File tree

5 files changed

+20
-54
lines changed

5 files changed

+20
-54
lines changed

node-installer/Makefile

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
11
SPIN_VERSION = v2
22
IMAGE_NAME ?= ghcr.io/spinkube/containerd-shim-spin/node-installer
3-
PLATFORM ?= linux/amd64
4-
ARCH ?= x86_64
3+
4+
# we only support x86_64 and aarch64 on Linux
5+
UNAME := $(shell uname -m)
6+
ifeq ($(UNAME),x86_64)
7+
PLATFORM ?= linux/amd64
8+
ARCH ?= x86_64
9+
else ifeq ($(UNAME),aarch64)
10+
PLATFORM ?= linux/arm64
11+
ARCH ?= aarch64
12+
else ifeq ($(UNAME),arm64)
13+
PLATFORM ?= linux/arm64
14+
ARCH ?= aarch64
15+
else
16+
$(error Unsupported platform: $(UNAME))
17+
endif
18+
519
TARGET ?= $(ARCH)-unknown-linux-musl
620
BINARY := ./.tmp/$(PLATFORM)/containerd-shim-spin-$(SPIN_VERSION)
721

node-installer/tests/integration-test-k3s.sh

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,7 @@ kubectl apply -f ./tests/workloads/runtime.yaml
2121
echo "=== Step 3: Build and deploy the KWasm node installer ==="
2222
if ! docker image inspect $IMAGE_NAME >/dev/null 2>&1; then
2323
echo "Building node installer image..."
24-
PLATFORM=$(uname -m)
25-
if [ "$PLATFORM" = "x86_64" ]; then
26-
PLATFORM="linux/amd64"
27-
ARCH="x86_64"
28-
elif [ "$PLATFORM" = "aarch64" ] || [ "$PLATFORM" = "arm64" ]; then
29-
PLATFORM="linux/arm64"
30-
ARCH="aarch64"
31-
else
32-
echo "Unsupported platform: $PLATFORM"
33-
exit 1
34-
fi
35-
36-
PLATFORM=$PLATFORM ARCH=$ARCH IMAGE_NAME=$IMAGE_NAME make build-dev-installer-image
24+
IMAGE_NAME=$IMAGE_NAME make build-dev-installer-image
3725
fi
3826

3927
echo "Loading node installer image into K3s..."

node-installer/tests/integration-test-kind.sh

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,7 @@ kubectl --context=kind-spin-test apply -f ./tests/workloads/runtime.yaml
3030
echo "=== Step 3: Build and deploy the KWasm node installer ==="
3131
if ! docker image inspect $IMAGE_NAME >/dev/null 2>&1; then
3232
echo "Building node installer image..."
33-
PLATFORM=$(uname -m)
34-
if [ "$PLATFORM" = "x86_64" ]; then
35-
PLATFORM="linux/amd64"
36-
ARCH="x86_64"
37-
elif [ "$PLATFORM" = "aarch64" ] || [ "$PLATFORM" = "arm64" ]; then
38-
PLATFORM="linux/arm64"
39-
ARCH="aarch64"
40-
else
41-
echo "Unsupported platform: $PLATFORM"
42-
exit 1
43-
fi
44-
45-
PLATFORM=$PLATFORM ARCH=$ARCH IMAGE_NAME=$IMAGE_NAME make build-dev-installer-image
33+
IMAGE_NAME=$IMAGE_NAME make build-dev-installer-image
4634
fi
4735

4836
echo "Loading node installer image into kind..."

node-installer/tests/integration-test-microk8s.sh

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,7 @@ kubectl apply -f ./tests/workloads/runtime.yaml
3030
echo "=== Step 3: Build and deploy the KWasm node installer ==="
3131
if ! docker image inspect $IMAGE_NAME >/dev/null 2>&1; then
3232
echo "Building node installer image..."
33-
PLATFORM=$(uname -m)
34-
if [ "$PLATFORM" = "x86_64" ]; then
35-
PLATFORM="linux/amd64"
36-
ARCH="x86_64"
37-
elif [ "$PLATFORM" = "aarch64" ] || [ "$PLATFORM" = "arm64" ]; then
38-
PLATFORM="linux/arm64"
39-
ARCH="aarch64"
40-
else
41-
echo "Unsupported platform: $PLATFORM"
42-
exit 1
43-
fi
44-
45-
PLATFORM=$PLATFORM ARCH=$ARCH IMAGE_NAME=$IMAGE_NAME make build-dev-installer-image
33+
IMAGE_NAME=$IMAGE_NAME make build-dev-installer-image
4634
fi
4735

4836
echo "Loading node installer image into MicroK8s..."

node-installer/tests/integration-test-minikube.sh

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,7 @@ kubectl apply -f ./tests/workloads/runtime.yaml
1414
echo "=== Step 3: Build and deploy the KWasm node installer ==="
1515
if ! docker image inspect $IMAGE_NAME >/dev/null 2>&1; then
1616
echo "Building node installer image..."
17-
PLATFORM=$(uname -m)
18-
if [ "$PLATFORM" = "x86_64" ]; then
19-
PLATFORM="linux/amd64"
20-
ARCH="x86_64"
21-
elif [ "$PLATFORM" = "aarch64" ] || [ "$PLATFORM" = "arm64" ]; then
22-
PLATFORM="linux/arm64"
23-
ARCH="aarch64"
24-
else
25-
echo "Unsupported platform: $PLATFORM"
26-
exit 1
27-
fi
28-
29-
PLATFORM=$PLATFORM ARCH=$ARCH IMAGE_NAME=$IMAGE_NAME make build-dev-installer-image
17+
IMAGE_NAME=$IMAGE_NAME make build-dev-installer-image
3018
fi
3119

3220
echo "Loading node installer image into MiniKube..."

0 commit comments

Comments
 (0)