From 31cbe0b98a0cd802a00638706b4df8de7ec947f3 Mon Sep 17 00:00:00 2001 From: Camilla Conte Date: Tue, 27 Aug 2024 13:59:15 +0100 Subject: [PATCH 1/3] tests: add operator deployment on ephemeral cluster Enable further integration testing by deploying the operator at the beginning of the testing pipeline. Copy-pasting the sample from here: https://github.com/konflux-ci/pipeline-samples/blob/main/pipelines/integration/deploy-operator.yaml Signed-off-by: Camilla Conte --- tests/integration-tests.yaml | 147 ++++++++++++++++++++++++++++++++--- 1 file changed, 137 insertions(+), 10 deletions(-) diff --git a/tests/integration-tests.yaml b/tests/integration-tests.yaml index bb2e9f6..6ace8c3 100644 --- a/tests/integration-tests.yaml +++ b/tests/integration-tests.yaml @@ -1,23 +1,151 @@ +--- +apiVersion: tekton.dev/v1 kind: Pipeline -apiVersion: tekton.dev/v1beta1 metadata: name: trustee-operator-integration-tests spec: + description: | + An integration test which provisions an ephemeral Hypershift cluster and deploys an Operator + bundle from a Konflux snapshot. params: - - description: 'Snapshot of the application' + - description: Snapshot of the application name: SNAPSHOT default: '{"components": [{"name":"test-app", "containerImage": "quay.io/example/repo:latest"}]}' type: string - - description: 'Namespace where the application is running' + - description: Namespace where the the Operator bundle will be deployed. name: NAMESPACE - default: "default" - type: string - - description: 'Expected output' - name: EXPECTED_OUTPUT - default: "Hello World!" + default: default type: string tasks: - - name: task-1 + - name: parse-metadata + taskRef: + resolver: git + params: + - name: url + value: https://github.com/konflux-ci/integration-examples + - name: revision + value: main + - name: pathInRepo + value: tasks/test_metadata.yaml + params: + - name: SNAPSHOT + value: $(params.SNAPSHOT) + - name: provision-eaas-space + runAfter: + - parse-metadata + taskRef: + resolver: git + params: + - name: url + value: https://github.com/konflux-ci/build-definitions.git + - name: revision + value: main + - name: pathInRepo + value: task/eaas-provision-space/0.1/eaas-provision-space.yaml + params: + - name: ownerName + value: $(context.pipelineRun.name) + - name: ownerUid + value: $(context.pipelineRun.uid) + - name: provision-cluster + runAfter: + - provision-eaas-space + taskSpec: + results: + - name: clusterName + value: "$(steps.create-cluster.results.clusterName)" + steps: + - name: get-supported-versions + ref: + resolver: git + params: + - name: url + value: https://github.com/konflux-ci/build-definitions.git + - name: revision + value: main + - name: pathInRepo + value: stepactions/eaas-get-supported-ephemeral-cluster-versions/0.1/eaas-get-supported-ephemeral-cluster-versions.yaml + params: + - name: eaasSpaceSecretRef + value: $(tasks.provision-eaas-space.results.secretRef) + - name: pick-version + ref: + resolver: git + params: + - name: url + value: https://github.com/konflux-ci/build-definitions.git + - name: revision + value: main + - name: pathInRepo + value: stepactions/eaas-get-latest-openshift-version-by-prefix/0.1/eaas-get-latest-openshift-version-by-prefix.yaml + params: + - name: prefix + value: "$(steps.get-supported-versions.results.versions[0])." + - name: create-cluster + ref: + resolver: git + params: + - name: url + value: https://github.com/konflux-ci/build-definitions.git + - name: revision + value: main + - name: pathInRepo + value: stepactions/eaas-create-ephemeral-cluster-hypershift-aws/0.1/eaas-create-ephemeral-cluster-hypershift-aws.yaml + params: + - name: eaasSpaceSecretRef + value: $(tasks.provision-eaas-space.results.secretRef) + - name: version + value: "$(steps.pick-version.results.version)" + - name: deploy-operator + runAfter: + - provision-cluster + params: + - name: bundleImage + value: "$(tasks.parse-metadata.results.component-container-image)" + - name: namespace + value: "$(params.NAMESPACE)" + taskSpec: + params: + - name: bundleImage + type: string + - name: namespace + type: string + volumes: + - name: credentials + emptyDir: {} + steps: + - name: get-kubeconfig + ref: + resolver: git + params: + - name: url + value: https://github.com/konflux-ci/build-definitions.git + - name: revision + value: main + - name: pathInRepo + value: stepactions/eaas-get-ephemeral-cluster-credentials/0.1/eaas-get-ephemeral-cluster-credentials.yaml + params: + - name: eaasSpaceSecretRef + value: $(tasks.provision-eaas-space.results.secretRef) + - name: clusterName + value: "$(tasks.provision-cluster.results.clusterName)" + - name: credentials + value: credentials + - name: operator-sdk-run-bundle + image: quay.io/operator-framework/operator-sdk:latest + env: + - name: KUBECONFIG + value: "/credentials/$(steps.get-kubeconfig.results.kubeconfig)" + volumeMounts: + - name: credentials + mountPath: /credentials + args: + - run + - bundle + - --namespace + - "$(params.namespace)" + - "$(params.bundleImage)" + - name: dummy-task description: Placeholder task that prints the Snapshot and outputs standard TEST_OUTPUT params: - name: SNAPSHOT @@ -44,4 +172,3 @@ spec: TEST_OUTPUT=$(jq -rc --arg date $(date +%s) --arg RESULT "${RESULT}" --null-input \ '{result: $RESULT, timestamp: $date, failures: 0, successes: 1, warnings: 0}') echo -n "${TEST_OUTPUT}" | tee $(results.TEST_OUTPUT.path) - From 420909b3f993b4cb635299d3523cf78d061b8c1b Mon Sep 17 00:00:00 2001 From: Camilla Conte Date: Thu, 29 Aug 2024 16:01:47 +0100 Subject: [PATCH 2/3] tests: raise timeout for `run bundle` --- tests/integration-tests.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/integration-tests.yaml b/tests/integration-tests.yaml index 6ace8c3..579c30a 100644 --- a/tests/integration-tests.yaml +++ b/tests/integration-tests.yaml @@ -142,6 +142,8 @@ spec: args: - run - bundle + - --timeout + - 10m - --namespace - "$(params.namespace)" - "$(params.bundleImage)" From 6cf9b40dc1d8a0ae6a0e33316bc58f0cf30ecad8 Mon Sep 17 00:00:00 2001 From: Camilla Conte Date: Thu, 29 Aug 2024 16:55:01 +0100 Subject: [PATCH 3/3] tests: raise timeout to 2h It keeps timing out. Let's see how long it takes. --- tests/integration-tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration-tests.yaml b/tests/integration-tests.yaml index 579c30a..94964d0 100644 --- a/tests/integration-tests.yaml +++ b/tests/integration-tests.yaml @@ -143,7 +143,7 @@ spec: - run - bundle - --timeout - - 10m + - 2h - --namespace - "$(params.namespace)" - "$(params.bundleImage)"