From 5b445ae668ed89342b1374d355cc805d399f922b Mon Sep 17 00:00:00 2001 From: Tobias Trabelsi Date: Sun, 23 Jun 2024 00:33:29 +0200 Subject: [PATCH] still wip --- Dockerfile.test | 15 +++++++++++++++ skaffold.yaml | 17 ++++++++++++----- utils/test.sh | 26 +++++++++++++++++++++++++- 3 files changed, 52 insertions(+), 6 deletions(-) create mode 100644 Dockerfile.test mode change 100644 => 100755 utils/test.sh diff --git a/Dockerfile.test b/Dockerfile.test new file mode 100644 index 0000000..8cac039 --- /dev/null +++ b/Dockerfile.test @@ -0,0 +1,15 @@ +FROM ubuntu:22.04 + +RUN apt-get update && apt-get install -y curl + +RUN curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" \ + && mv kubectl /usr/bin/kubectl \ + && chmod +x /usr/bin/kubectl + +ADD example.yaml /example.yaml +ADD example_dockerlogin.yaml /example_dockerlogin.yaml +ADD example_template.yaml /example_template.yaml + +ADD utils/test.sh /test.sh + +ENTRYPOINT [ "/test.sh" ] \ No newline at end of file diff --git a/skaffold.yaml b/skaffold.yaml index 65d4f92..f853794 100644 --- a/skaffold.yaml +++ b/skaffold.yaml @@ -3,10 +3,15 @@ kind: Config metadata: name: bitwarden-crd-operator build: + tagPolicy: + sha256: {} artifacts: - image: ghcr.io/lerentis/bitwarden-crd-operator docker: dockerfile: Dockerfile + - image: integration-test-container + docker: + dockerfile: Dockerfile.test deploy: helm: releases: @@ -17,8 +22,10 @@ deploy: setValueTemplates: image.repository: "{{.IMAGE_REPO_ghcr_io_lerentis_bitwarden_crd_operator}}" image.tag: "{{.IMAGE_TAG_ghcr_io_lerentis_bitwarden_crd_operator}}@{{.IMAGE_DIGEST_ghcr_io_lerentis_bitwarden_crd_operator}}" -test: - - image: ghcr.io/lerentis/bitwarden-crd-operator - custom: - - command: ./utils/test.sh - timeoutSeconds: 60 +verify: + - name: integration-test-container + container: + name: integration-test-container + image: "integration-test-container:a11852f8bb9bf99553238e1fa29206421c72801df5da96ccf9f77ebd069f815f" + executionMode: + kubernetesCluster: {} diff --git a/utils/test.sh b/utils/test.sh old mode 100644 new mode 100755 index c0db713..48b47ae --- a/utils/test.sh +++ b/utils/test.sh @@ -1,4 +1,28 @@ #!/bin/bash -kubectl apply -f example* +for f in /*.yaml +do + echo "applying $f ..." + kubectl apply -f "$f" +done +kubectl get secret test-regcred +if [ $? -ne 0 ]; then + echo "Could not find secret test-regcred" + exit 1 +fi +kubectl get secret test-scope +if [ $? -ne 0 ]; then + echo "Could not find secret test-scope" + exit 1 +fi +kubectl get secret test-secret +if [ $? -ne 0 ]; then + echo "Could not find secret test-secret" + exit 1 +fi +kubectl get secret test-template +if [ $? -ne 0 ]; then + echo "Could not find secret test-template" + exit 1 +fi \ No newline at end of file