From a426230698cb41dd614f1d72e2e883d40d982d59 Mon Sep 17 00:00:00 2001 From: Xe Iaso Date: Sat, 16 May 2026 01:53:47 -0400 Subject: [PATCH] test: start k3k provisioning Signed-off-by: Xe Iaso --- .tekton/anubis-test.yaml | 22 ++++++++++++++++++++-- test/k3k/test-cluster.yaml | 5 +++++ test/ssh-ci/Dockerfile | 2 +- 3 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 test/k3k/test-cluster.yaml diff --git a/.tekton/anubis-test.yaml b/.tekton/anubis-test.yaml index 71bfd06c..0138c563 100644 --- a/.tekton/anubis-test.yaml +++ b/.tekton/anubis-test.yaml @@ -72,7 +72,7 @@ spec: name: kaniko params: - name: IMAGE - value: registry.int.xeserv.us/xeiaso.net/site/ci:$(params.branch) + value: registry.int.xeserv.us/xeiaso.net/site/ci:$(tasks.clone-repo.results.version) - name: DOCKERFILE value: ./test/ssh-ci/Dockerfile - name: EXTRA_ARGS @@ -87,6 +87,24 @@ spec: "--snapshot-mode=redo", "--use-new-run", ] + - name: provision-test-cluster + runAfter: ["docker-build-ci"] + taskSpec: + workspaces: + - name: repo + mountPath: /src + results: + - name: cluster-name + description: "k3k cluster name object in k8s" + steps: + - name: create-cluster + image: $(tasks.docker-build-ci.results.IMAGE_URL)@$(tasks.docker-build-ci.results.IMAGE_DIGEST) + workingDir: $(workspaces.repo.path)/repo + script: | + CLUSTER_NAME=`kubectl create -f test/k3k/test-cluster.yaml -ojson | jq -r '.metadata.name'` + echo -n "${CLUSTER_NAME}" | tee "$(results.cluster-name.path)" + kubectl wait --for=condition-Ready clusters.k3k.io/"${CLUSTER_NAME}" -n ci --timout 5m + kubectl wait --for=create "secret/k3k-${CLUSTER_NAME}-kubeconfig" -n ci --timeout 5m - name: go-test runAfter: ["docker-build-ci"] taskSpec: @@ -96,7 +114,7 @@ spec: steps: - name: test image: $(tasks.docker-build-ci.results.IMAGE_URL)@$(tasks.docker-build-ci.results.IMAGE_DIGEST) - workingDir: $(workspaces.source.path)/repo + workingDir: $(workspaces.repo.path)/repo script: | npm ci npm run test diff --git a/test/k3k/test-cluster.yaml b/test/k3k/test-cluster.yaml new file mode 100644 index 00000000..c72bc8e9 --- /dev/null +++ b/test/k3k/test-cluster.yaml @@ -0,0 +1,5 @@ +apiVersion: k3k.io/v1beta1 +kind: Cluster +metadata: + generateName: anubis-test- + namespace: ci diff --git a/test/ssh-ci/Dockerfile b/test/ssh-ci/Dockerfile index c8fbe6ab..d69ba485 100644 --- a/test/ssh-ci/Dockerfile +++ b/test/ssh-ci/Dockerfile @@ -11,5 +11,5 @@ RUN CGO_ENABLED=0 go install golang.org/dl/go1.23.6@latest \ FROM alpine:${ALPINE_VERSION} COPY --from=go /app/bin/go /usr/local/bin/go -RUN apk add -U nodejs git build-base git npm bash zstd brotli gzip \ +RUN apk add -U nodejs git build-base git npm bash zstd brotli gzip jq kubectl \ && go download \ No newline at end of file