Skip to content

Commit c38e602

Browse files
committed
Migration of tekton plugin tests
1 parent a59c2cd commit c38e602

15 files changed

Lines changed: 2761 additions & 0 deletions
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodeLinker: node-modules
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { createEslintConfig } from "rhdh-e2e-test-utils/eslint";
2+
3+
export default createEslintConfig(import.meta.dirname);
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"name": "tekton-e2e-tests",
3+
"version": "1.0.0",
4+
"private": true,
5+
"type": "module",
6+
"engines": {
7+
"node": ">=22",
8+
"yarn": ">=3"
9+
},
10+
"packageManager": "yarn@3.8.7",
11+
"description": "E2E tests for Tekton plugin",
12+
"scripts": {
13+
"test": "playwright test",
14+
"report": "playwright show-report",
15+
"test:ui": "playwright test --ui",
16+
"test:headed": "playwright test --headed",
17+
"lint:check": "eslint .",
18+
"lint:fix": "eslint . --fix",
19+
"prettier:check": "prettier --check .",
20+
"prettier:fix": "prettier --write .",
21+
"tsc:check": "tsc --noEmit",
22+
"check": "tsc --noEmit && yarn lint:check && yarn prettier:check"
23+
},
24+
"devDependencies": {
25+
"@eslint/js": "^9.39.2",
26+
"@playwright/test": "1.57.0",
27+
"@types/node": "^24.10.1",
28+
"dotenv": "^16.4.7",
29+
"eslint": "^9.39.2",
30+
"eslint-plugin-check-file": "^3.3.1",
31+
"eslint-plugin-playwright": "^2.4.0",
32+
"prettier": "^3.7.4",
33+
"rhdh-e2e-test-utils": "1.1.9",
34+
"typescript": "^5.9.3",
35+
"typescript-eslint": "^8.50.0"
36+
}
37+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { defineConfig } from "rhdh-e2e-test-utils/playwright-config";
2+
import dotenv from "dotenv";
3+
4+
dotenv.config({ path: `${import.meta.dirname}/.env` });
5+
6+
export default defineConfig({
7+
projects: [
8+
{
9+
name: "tekton",
10+
},
11+
],
12+
});
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
kubernetes:
2+
clusterLocatorMethods:
3+
- clusters:
4+
- authProvider: serviceAccount
5+
name: ${K8S_CLUSTER_NAME}
6+
serviceAccountToken: ${K8S_CLUSTER_TOKEN}
7+
url: ${K8S_CLUSTER_URL}
8+
skipTLSVerify: true
9+
type: config
10+
customResources:
11+
- apiVersion: "v1beta1"
12+
group: "tekton.dev"
13+
plural: "pipelines"
14+
- apiVersion: v1beta1
15+
group: tekton.dev
16+
plural: pipelineruns
17+
- apiVersion: v1beta1
18+
group: tekton.dev
19+
plural: taskruns
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
plugins:
2+
- package: ./dynamic-plugins/dist/backstage-community-plugin-tekton
3+
disabled: false
4+
pluginConfig:
5+
dynamicPlugins:
6+
frontend:
7+
backstage-community.plugin-tekton:
8+
mountPoints:
9+
- mountPoint: entity.page.ci/cards
10+
importName: TektonCI
11+
config:
12+
layout:
13+
gridColumn: 1 / -1
14+
if:
15+
allOf:
16+
- isTektonCIAvailable
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Install Red Hat OpenShift Pipelines operator if not present
2+
operator::install_pipelines() {
3+
local display_name="Red Hat OpenShift Pipelines"
4+
5+
if oc get csv -n "${OPERATOR_NAMESPACE}" | grep -q "${display_name}"; then
6+
log::info "Red Hat OpenShift Pipelines operator is already installed."
7+
return 0
8+
fi
9+
10+
log::info "Red Hat OpenShift Pipelines operator is not installed. Installing..."
11+
operator::install_subscription openshift-pipelines-operator "${OPERATOR_NAMESPACE}" latest openshift-pipelines-operator-rh redhat-operators openshift-marketplace
12+
13+
# Wait for Tekton Pipelines CRDs to be available
14+
log::info "Waiting for Tekton Pipelines CRDs to be created..."
15+
k8s_wait::crd "tasks.tekton.dev" 300 10 || return 1
16+
k8s_wait::crd "pipelines.tekton.dev" 300 10 || return 1
17+
18+
# Note: Calling script should still wait for deployment readiness:
19+
# k8s_wait::deployment "openshift-operators" "pipelines" 30 10
20+
# k8s_wait::endpoint "tekton-pipelines-webhook" "openshift-pipelines" 30 10
21+
return 0
22+
}
23+
24+
# Install Tekton Pipelines (alternative to OpenShift Pipelines for Kubernetes)
25+
operator::install_tekton() {
26+
local display_name="tekton-pipelines-webhook"
27+
28+
if oc get pods -n "tekton-pipelines" | grep -q "${display_name}"; then
29+
log::info "Tekton Pipelines are already installed."
30+
return 0
31+
fi
32+
33+
log::info "Tekton Pipelines is not installed. Installing..."
34+
kubectl apply -f https://storage.googleapis.com/tekton-releases/pipeline/latest/release.yaml
35+
36+
# Note: Calling script should wait for deployment:
37+
# k8s_wait::deployment "tekton-pipelines" "${display_name}"
38+
# k8s_wait::endpoint "tekton-pipelines-webhook" "tekton-pipelines"
39+
return $?
40+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: operators.coreos.com/v1alpha1
2+
kind: Subscription
3+
metadata:
4+
name: openshift-pipelines-operator
5+
namespace: openshift-operators
6+
spec:
7+
channel: latest
8+
name: openshift-pipelines-operator-rh
9+
source: redhat-operators
10+
sourceNamespace: openshift-marketplace
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
apiVersion: tekton.dev/v1beta1
2+
kind: Pipeline
3+
metadata:
4+
name: hello-world-pipeline
5+
labels:
6+
backstage.io/kubernetes-id: developer-hub
7+
spec:
8+
tasks:
9+
- name: echo-hello-world
10+
taskSpec:
11+
steps:
12+
- name: echo-hello-world
13+
image: ubuntu
14+
script: |
15+
#!/usr/bin/env bash
16+
echo "Hello, World!"
17+
- name: echo-bye
18+
taskSpec:
19+
steps:
20+
- name: echo-goodbye
21+
image: ubuntu
22+
script: |
23+
#!/usr/bin/env bash
24+
echo "Good Bye!"
25+
---
26+
apiVersion: tekton.dev/v1beta1
27+
kind: PipelineRun
28+
metadata:
29+
name: hello-world-pipeline-run
30+
labels:
31+
backstage.io/kubernetes-id: developer-hub
32+
spec:
33+
pipelineRef:
34+
name: hello-world-pipeline
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: rhdh-secrets
5+
type: Opaque
6+
stringData:
7+
K8S_CLUSTER_TOKEN: "${K8S_CLUSTER_TOKEN}"
8+
K8S_CLUSTER_URL: "${K8S_CLUSTER_URL}"

0 commit comments

Comments
 (0)