Skip to content

Commit e46aa3b

Browse files
committed
fix topology-rbac and kubernetes-rbac tests in k8s jobs
1 parent 48954ea commit e46aa3b

5 files changed

Lines changed: 34 additions & 59 deletions

File tree

.ci/pipelines/lib/operators.sh

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -112,19 +112,20 @@ operator::install_pipelines() {
112112
# Install Tekton Pipelines (alternative to OpenShift Pipelines for Kubernetes)
113113
operator::install_tekton() {
114114
local display_name="tekton-pipelines-webhook"
115+
local ns="tekton-pipelines"
115116

116-
if oc get pods -n "tekton-pipelines" | grep -q "${display_name}"; then
117-
log::info "Tekton Pipelines are already installed."
118-
return 0
117+
if ! kubectl get namespace "${ns}" &> /dev/null; then
118+
log::info "Tekton Pipelines is not installed. Installing..."
119+
kubectl apply -f https://storage.googleapis.com/tekton-releases/pipeline/latest/release.yaml
120+
else
121+
log::info "Tekton Pipelines namespace exists; ensuring webhook is ready before continuing."
119122
fi
120123

121-
log::info "Tekton Pipelines is not installed. Installing..."
122-
kubectl apply -f https://storage.googleapis.com/tekton-releases/pipeline/latest/release.yaml
123-
124-
# Note: Calling script should wait for deployment:
125-
# k8s_wait::deployment "tekton-pipelines" "${display_name}"
126-
# k8s_wait::endpoint "tekton-pipelines-webhook" "tekton-pipelines"
127-
return $?
124+
log::info "Waiting for Tekton Pipeline CRD and webhook (required before applying Pipeline manifests)..."
125+
k8s_wait::crd "pipelines.tekton.dev" 120 5 || return 1
126+
k8s_wait::deployment "${ns}" "${display_name}" 30 10 || return 1
127+
k8s_wait::endpoint "${display_name}" "${ns}" 1800 10 || return 1
128+
return 0
128129
}
129130

130131
# Delete Tekton Pipelines installation

.ci/pipelines/utils.sh

Lines changed: 22 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -345,23 +345,26 @@ apply_yaml_files() {
345345
common::create_configmap_from_file "dynamic-global-header-config" "$project" \
346346
"dynamic-global-header-config.yaml" "$dir/resources/config_map/dynamic-global-header-config.yaml"
347347

348-
# Skip Tekton and Topology resources for K8s deployments (AKS/EKS/GKE)
348+
# Skip Tekton resources for K8s deployments (AKS/EKS/GKE)
349349
# Tekton tests are not executed in showcase-k8s or showcase-rbac-k8s projects
350350
if [[ "$JOB_NAME" != *"aks"* && "$JOB_NAME" != *"eks"* && "$JOB_NAME" != *"gke"* ]]; then
351351
# Create Pipeline run for tekton test case.
352352
oc apply -f "$dir/resources/pipeline-run/hello-world-pipeline.yaml"
353353
oc apply -f "$dir/resources/pipeline-run/hello-world-pipeline-run.yaml"
354354

355-
# Create Deployment and Pipeline for Topology test.
356-
oc apply -f "$dir/resources/topology_test/topology-test.yaml"
357-
if [[ -z "${IS_OPENSHIFT}" || "${IS_OPENSHIFT}" == "false" ]]; then
358-
kubectl apply -f "$dir/resources/topology_test/topology-test-ingress.yaml"
359-
else
360-
oc apply -f "$dir/resources/topology_test/topology-test-route.yaml"
361-
fi
362355
else
363-
log::info "Skipping Tekton Pipeline and Topology resources for K8s deployment (${JOB_NAME})"
356+
log::info "Skipping Tekton Pipeline resources for K8s deployment (${JOB_NAME})"
357+
fi
358+
359+
# Create Deployment and Pipeline for Topology test.
360+
oc apply -f "$dir/resources/topology_test/topology-test.yaml"
361+
362+
if [[ -z "${IS_OPENSHIFT}" || "${IS_OPENSHIFT}" == "false" ]]; then
363+
kubectl apply -f "$dir/resources/topology_test/topology-test-ingress.yaml"
364+
else
365+
oc apply -f "$dir/resources/topology_test/topology-test-route.yaml"
364366
fi
367+
365368
}
366369

367370
deploy_test_backstage_customization_provider() {
@@ -408,11 +411,8 @@ install_pipelines_operator() {
408411
fi
409412
# Wait for Tekton Pipeline CRD to be registered before proceeding
410413
k8s_wait::crd "pipelines.tekton.dev" 120 5 || return 1
411-
}
412-
413-
waitfor_pipelines_operator() {
414-
k8s_wait::deployment "openshift-operators" "pipelines"
415-
k8s_wait::endpoint "tekton-pipelines-webhook" "openshift-pipelines"
414+
k8s_wait::deployment "openshift-operators" "pipelines" 30 10 || return 1
415+
k8s_wait::endpoint "${TEKTON_PIPELINES_WEBHOOK}" "openshift-pipelines" 1800 10 || return 1
416416
}
417417

418418
# Installs the Tekton Pipelines if not already installed (alternative of OpenShift Pipelines for Kubernetes clusters)
@@ -424,16 +424,12 @@ install_tekton_pipelines() {
424424
else
425425
log::info "Tekton Pipelines is not installed. Installing..."
426426
kubectl apply -f https://storage.googleapis.com/tekton-releases/pipeline/latest/release.yaml
427+
k8s_wait::deployment "tekton-pipelines" "tekton-pipelines-webhook" 30 10 || return 1
428+
k8s_wait::endpoint "tekton-pipelines-webhook" "tekton-pipelines" 1800 10 || return 1
429+
k8s_wait::crd "pipelines.tekton.dev" 120 5 || return 1
427430
fi
428431
}
429432

430-
waitfor_tekton_pipelines() {
431-
local display_name="tekton-pipelines-webhook"
432-
k8s_wait::deployment "tekton-pipelines" "${display_name}"
433-
k8s_wait::endpoint "tekton-pipelines-webhook" "tekton-pipelines"
434-
k8s_wait::crd "pipelines.tekton.dev" 120 5 || return 1
435-
}
436-
437433
delete_tekton_pipelines() {
438434
log::info "Checking for Tekton Pipelines installation..."
439435
if ! kubectl get namespace tekton-pipelines &> /dev/null; then
@@ -483,12 +479,6 @@ enable_orchestrator_plugins_op() {
483479

484480
cluster_setup_ocp_helm() {
485481
operator::install_pipelines
486-
487-
# Wait for OpenShift Pipelines to be ready before proceeding
488-
log::info "Waiting for OpenShift Pipelines to be ready..."
489-
k8s_wait::deployment "${OPERATOR_NAMESPACE}" "pipelines" 30 10 || return 1
490-
k8s_wait::endpoint "${TEKTON_PIPELINES_WEBHOOK}" "openshift-pipelines" 1800 10 || return 1
491-
492482
operator::install_postgres_ocp
493483

494484
# Skip orchestrator infra installation based on job type (see should_skip_orchestrator)
@@ -501,31 +491,23 @@ cluster_setup_ocp_helm() {
501491

502492
cluster_setup_ocp_operator() {
503493
operator::install_pipelines
504-
505-
# Wait for OpenShift Pipelines to be ready before proceeding
506-
log::info "Waiting for OpenShift Pipelines to be ready..."
507-
k8s_wait::deployment "${OPERATOR_NAMESPACE}" "pipelines" 30 10 || return 1
508-
k8s_wait::endpoint "${TEKTON_PIPELINES_WEBHOOK}" "openshift-pipelines" 1800 10 || return 1
509-
510494
operator::install_postgres_ocp
511495
operator::install_serverless
512496
operator::install_serverless_logic
513497
}
514498

515499
cluster_setup_k8s_operator() {
516500
operator::install_olm
517-
# Tekton not installed for K8s deployments (AKS/EKS/GKE)
518-
# Tekton tests are not executed in showcase-k8s or showcase-rbac-k8s projects
519-
# operator::install_tekton
501+
# Install Tekton Pipelines for K8s deployments (AKS/EKS/GKE) for topology tests to work
502+
operator::install_tekton
520503
# operator::install_postgres_k8s # Works with K8s but disabled in values file
521504
}
522505

523506
cluster_setup_k8s_helm() {
524-
# Tekton not installed for K8s deployments (AKS/EKS/GKE)
525-
# Tekton tests are not executed in showcase-k8s or showcase-rbac-k8s projects
526-
log::info "Skipping Tekton installation for K8s Helm deployment"
507+
# Install Tekton Pipelines for K8s deployments (AKS/EKS/GKE) for topology tests to work
508+
log::info "Installing Tekton Pipelines for K8s Helm deployment"
527509
# operator::install_olm
528-
# operator::install_tekton
510+
operator::install_tekton
529511
# operator::install_postgres_k8s # Works with K8s but disabled in values file
530512
}
531513

e2e-tests/playwright/e2e/plugins/kubernetes/kubernetes-rbac.spec.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ import { KUBERNETES_COMPONENTS } from "../../../support/page-objects/page-obj";
66
import { KubernetesPage } from "../../../support/pages/kubernetes";
77

88
test.describe("Test Kubernetes Plugin", () => {
9-
// TODO: https://issues.redhat.com/browse/RHDHBUGS-2817
10-
test.fixme(() => process.env.IS_OPENSHIFT === "false");
11-
129
let common: Common;
1310
let uiHelper: UIhelper;
1411
let catalog: Catalog;

e2e-tests/playwright/e2e/plugins/topology/topology-rbac.spec.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ import { Catalog } from "../../../support/pages/catalog";
55
import { Topology } from "../../../support/pages/topology";
66

77
test.describe("Test Topology Plugin with RBAC", () => {
8-
// TODO: https://issues.redhat.com/browse/RHDHBUGS-2817
9-
test.fixme(() => process.env.IS_OPENSHIFT === "false");
10-
118
let common: Common;
129
let uiHelper: UIhelper;
1310
let catalog: Catalog;

e2e-tests/playwright/e2e/plugins/topology/topology.spec.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,7 @@ async function testIngressResources(page: Page, uiHelper: UIhelper) {
119119
.first(),
120120
).toBeVisible();
121121
// Verify code block is visible (pre element containing configuration)
122-
await expect(
123-
page.getByText(/apiVersion:|kind:|metadata:/).first(),
124-
).toBeVisible();
122+
await expect(page.getByText(/rules:/).first()).toBeVisible();
125123
}
126124

127125
async function testRouteResources(page: Page, uiHelper: UIhelper) {

0 commit comments

Comments
 (0)