Skip to content

Commit

Permalink
Merge pull request #24 from averevki/pipeline-v2
Browse files Browse the repository at this point in the history
Divide pipelines into tasks & unify pipeline results
  • Loading branch information
averevki authored Jul 3, 2024
2 parents 8e69eea + 3484904 commit 310c171
Show file tree
Hide file tree
Showing 15 changed files with 434 additions and 248 deletions.
15 changes: 5 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ This repository contains Kuadrant testsuite pipeline objects

Deployment
---
* Install the `openshift-pipelines` Openshift operator on the cluster
* Apply all pipelines and their resources `oc apply -k src/ -n ${PIPELINE_NAMESPACE}`
1. Install the `openshift-pipelines` Openshift operator on the cluster
2. Create required pipelines and their resources
* Apply main pipeline `oc apply -k main/ -n ${PIPELINE_NAMESPACE}`
* Apply nightly pipeline `oc apply -k nightly/ -n ${PIPELINE_NAMESPACE}`

Secrets
---
Expand All @@ -24,10 +26,6 @@ kubectl create secret generic rp-credentials --from-literal=RP_URL="https://repo
```shell
kubectl create cm rp-ca-bundle --from-file=tls-ca-bundle.pem=./tls-ca-bundle.pem -n ${PIPELINE_NAMESPACE}
```
- ConfigMap with testsuite settings under the `settings.local.yaml` key which is later can be used as a parameter for the pipeline run. E.g.
```shell
kubectl create cm pipeline-settings-default --from-file=settings.local.yaml=./settings.yaml -n ${PIPELINE_NAMESPACE}
```

Pipeline execution
---
Expand All @@ -47,8 +45,5 @@ Pipeline execution
Trigger nightly pipeline manually
---
```shell
# kuadrant
kubectl create job --from=cronjob/trigger-nightly-kuadrant trigger-nightly-kuadrant-$(date +%d.%m)-$(whoami)-manual -n ${PIPELINE_NAMESPACE}
# authorino-standalone
kubectl create job --from=cronjob/trigger-nightly-authorino-standalone trigger-nightly-authorino-standalone-$(date +%d.%m)-$(whoami)-manual -n ${PIPELINE_NAMESPACE}
kubectl create job --from=cronjob/trigger-nightly-pipeline trigger-nightly-pipeline-$(date +%d.%m)-$(whoami)-manual -n ${PIPELINE_NAMESPACE}
```
3 changes: 1 addition & 2 deletions src/kustomization.yaml → main/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

commonLabels:
deployment: kuadrant-qe-pipeline

resources:
- ../tasks/
- pipeline.yaml
- ../nightly/
82 changes: 82 additions & 0 deletions main/pipeline.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: testsuite-pipeline
spec:
params:
- default: 'quay.io/kuadrant/testsuite:unstable'
description: Testsuite image to run tests on
name: testsuite-image
type: string
- description: API URL of the Openshift cluster
name: kube-api
type: string
- default: kuadrant
description: Name of the Openshift project
name: project
type: string
- default: kuadrant
description: Makefile target for tests
name: make-target
type: string
- default: ""
description: Additional env for testsuite container separated with spaces (e.g. KUADRANT_CONTROL_PLANE__managedzone=gcp-mz KUADRANT_KEYCLOAK__url="https://my-sso.net")
name: additional-env
type: string
- default: pipeline
description: Prefix of the launch name saved in report portal (nightly, username, manual, etc.)
name: launch-name
type: string
- default: testsuite
description: Report Portal Project to store test results (e.g. testsuite, nightly-testsuite)
name: rp-project
type: string
tasks:
- name: kubectl-login
params:
- name: testsuite-image
value: $(params.testsuite-image)
- name: kube-api
value: $(params.kube-api)
taskRef:
kind: Task
name: kubectl-login
workspaces:
- name: shared-workspace
- name: run-tests
params:
- name: testsuite-image
value: $(params.testsuite-image)
- name: kube-api
value: $(params.kube-api)
- name: project
value: $(params.project)
- name: make-target
value: $(params.make-target)
- name: additional-env
value: $(params.additional-env)
runAfter:
- kubectl-login
taskRef:
kind: Task
name: run-tests
workspaces:
- name: shared-workspace
finally:
- name: upload-results
params:
- name: launch-name
value: $(params.launch-name)
- name: testsuite-image
value: $(params.testsuite-image)
- name: make-target
value: $(params.make-target)
- name: rp-project
value: $(params.rp-project)
taskRef:
kind: Task
name: upload-results
workspaces:
- name: shared-workspace
workspaces:
- name: shared-workspace
52 changes: 50 additions & 2 deletions nightly/eventlistener.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,54 @@ spec:
triggers:
- name: nightly-kuadrant-trigger
bindings:
- ref: nightly-trigger-binding
- name: kube-api
value: https://api.kuadrant.example.io:6443
- name: project
value: kuadrant
- name: make-target
value: all
- name: additional-env
value: ""
- name: launch-name
value: nightly
- name: rp-project
value: nightly-testsuite
template:
ref: pipeline-trigger-template
spec:
params:
- name: kube-api
- name: project
- name: make-target
- name: additional-env
- name: launch-name
- name: rp-project
resourcetemplates:
- apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
generateName: nightly-$(tt.params.make-target)-
spec:
pipelineRef:
name: nightly-pipeline
params:
- name: kube-api
value: $(tt.params.kube-api)
- name: project
value: $(tt.params.project)
- name: make-target
value: $(tt.params.make-target)
- name: additional-env
value: $(tt.params.additional-env)
- name: launch-name
value: $(tt.params.launch-name)
- name: rp-project
value: $(tt.params.rp-project)
workspaces:
- name: shared-workspace
volumeClaimTemplate:
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Mi
7 changes: 3 additions & 4 deletions nightly/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ commonLabels:
deployment: kuadrant-qe-pipeline-nightly

resources:
- triggertemplate.yaml
- triggerbinding.yaml
- eventlistener.yaml
- trigger-kuadrant-cronjob.yaml
- trigger-authorino-standalone-cronjob.yaml
- trigger-nightly-cronjob.yaml
- ../tasks/
- pipeline.yaml
120 changes: 120 additions & 0 deletions nightly/pipeline.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: nightly-pipeline
spec:
params:
- default: 'quay.io/kuadrant/testsuite:unstable'
description: Testsuite image to run tests on
name: testsuite-image
type: string
- description: API URL of the Openshift cluster
name: kube-api
type: string
- default: kuadrant
description: Name of the Openshift project
name: project
type: string
- default: all
description: Makefile target for tests (doesn't affect nightly pipeline, kept for compatibility)
name: make-target
type: string
- default: ""
description: Additional env for testsuite container separated with spaces (e.g. KUADRANT_CONTROL_PLANE__managedzone=gcp-mz KUADRANT_KEYCLOAK__url="https://my-sso.net")
name: additional-env
type: string
- default: nightly
description: Prefix of the launch name saved in report portal (nightly, username, manual, etc.)
name: launch-name
type: string
- default: nightly-testsuite
description: Report Portal Project to store test results (e.g. testsuite, nightly-testsuite)
name: rp-project
type: string
tasks:
- name: kubectl-login
params:
- name: testsuite-image
value: $(params.testsuite-image)
- name: kube-api
value: $(params.kube-api)
taskRef:
kind: Task
name: kubectl-login
workspaces:
- name: shared-workspace
- name: run-tests-kuadrant
params:
- name: testsuite-image
value: $(params.testsuite-image)
- name: kube-api
value: $(params.kube-api)
- name: project
value: $(params.project)
- name: make-target
value: kuadrant
- name: additional-env
value: $(params.additional-env)
runAfter:
- kubectl-login
taskRef:
kind: Task
name: run-tests
workspaces:
- name: shared-workspace
- name: run-tests-authorino-standalone
params:
- name: testsuite-image
value: $(params.testsuite-image)
- name: kube-api
value: $(params.kube-api)
- name: project
value: $(params.project)
- name: make-target
value: authorino-standalone
- name: additional-env
value: $(params.additional-env)
runAfter:
- run-tests-kuadrant
taskRef:
kind: Task
name: run-tests
workspaces:
- name: shared-workspace
- name: run-tests-dnstls-gcp
params:
- name: testsuite-image
value: $(params.testsuite-image)
- name: kube-api
value: $(params.kube-api)
- name: project
value: $(params.project)
- name: make-target
value: dnstls
- name: additional-env
value: "$(params.additional-env) KUADRANT_CONTROL_PLANE__managedzone=gcp-mz"
runAfter:
- run-tests-authorino-standalone
taskRef:
kind: Task
name: run-tests
workspaces:
- name: shared-workspace
finally:
- name: upload-results
params:
- name: launch-name
value: $(params.launch-name)
- name: testsuite-image
value: $(params.testsuite-image)
- name: make-target
value: all
- name: rp-project
value: $(params.rp-project)
taskRef:
kind: Task
name: upload-results
workspaces:
- name: shared-workspace
workspaces:
- name: shared-workspace
19 changes: 0 additions & 19 deletions nightly/trigger-authorino-standalone-cronjob.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: batch/v1
kind: CronJob
metadata:
name: trigger-nightly-kuadrant
name: trigger-nightly-pipeline
spec:
schedule: "0 5 * * *"
concurrencyPolicy: Forbid
Expand All @@ -12,8 +12,8 @@ spec:
spec:
serviceAccountName: pipeline
containers:
- name: trigger-nightly-kuadrant
- name: trigger-nightly-pipeline
image: quay.io/curl/curl:latest
command: ["/bin/sh", "-cx"]
args: ["curl -X POST --data '{\"make-target\": \"kuadrant\"}' el-nightly-cron-listener.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local:8080"]
args: ["curl -X POST --data {} el-nightly-cron-listener.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local:8080"]
restartPolicy: Never
16 changes: 0 additions & 16 deletions nightly/triggerbinding.yaml

This file was deleted.

Loading

0 comments on commit 310c171

Please sign in to comment.