Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: add operator deployment on ephemeral cluster #40

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
149 changes: 139 additions & 10 deletions tests/integration-tests.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,153 @@
---
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
- --timeout
- 2h
- --namespace
- "$(params.namespace)"
- "$(params.bundleImage)"
- name: dummy-task
description: Placeholder task that prints the Snapshot and outputs standard TEST_OUTPUT
params:
- name: SNAPSHOT
Expand All @@ -44,4 +174,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)