From 31b574e3f2a7b9c2125743b91d1768689a843e40 Mon Sep 17 00:00:00 2001 From: Subhash Khileri Date: Thu, 12 Dec 2024 15:09:34 +0530 Subject: [PATCH] chore(ci): fix sensitive logging and deployment checks (#2101) * fix e2e tests * fix e2e tests * fix e2e tests * fix logging issue * fix logging issue * fix sensitive logging and deployment checks * fix sensitive logging and deployment checks * fix sensitive logging and deployment checks * fix sensitive logging and deployment checks * fix sensitive logging and deployment checks * fix sensitive logging and deployment checks * fix sensitive logging and deployment checks * fix sensitive logging and deployment checks * fix sensitive logging and deployment checks --- .ibm/pipelines/cluster/aks/deployment.sh | 6 ++-- .ibm/pipelines/cluster/gke/deployment.sh | 6 ++-- .ibm/pipelines/env_variables.sh | 16 +++------ .ibm/pipelines/jobs/aks.sh | 5 ++- .ibm/pipelines/jobs/gke.sh | 5 ++- .ibm/pipelines/jobs/main.sh | 5 +-- .ibm/pipelines/jobs/periodic.sh | 21 ++++++------ .ibm/pipelines/ocp-cluster-claim-login.sh | 2 ++ .ibm/pipelines/openshift-ci-tests.sh | 4 +-- .../cluster-role-binding-ocm.yaml | 28 --------------- .ibm/pipelines/utils.sh | 34 ++++++------------- e2e-tests/package.json | 2 -- ...s-config-with-external-postgres-db.spec.ts | 8 +++-- 13 files changed, 47 insertions(+), 95 deletions(-) diff --git a/.ibm/pipelines/cluster/aks/deployment.sh b/.ibm/pipelines/cluster/aks/deployment.sh index 245ebe1106..0722c9bb81 100644 --- a/.ibm/pipelines/cluster/aks/deployment.sh +++ b/.ibm/pipelines/cluster/aks/deployment.sh @@ -6,7 +6,8 @@ initiate_aks_deployment() { # install_tekton_pipelines uninstall_helmchart "${NAME_SPACE_K8S}" "${RELEASE_NAME}" cd "${DIR}" - apply_yaml_files "${DIR}" "${NAME_SPACE_K8S}" + local rhdh_base_url="https://${K8S_CLUSTER_ROUTER_BASE}" + apply_yaml_files "${DIR}" "${NAME_SPACE_K8S}" "${rhdh_base_url}" yq_merge_value_files "${DIR}/value_files/${HELM_CHART_VALUE_FILE_NAME}" "${DIR}/value_files/${HELM_CHART_AKS_DIFF_VALUE_FILE_NAME}" "/tmp/${HELM_CHART_K8S_MERGED_VALUE_FILE_NAME}" mkdir -p "${ARTIFACT_DIR}/${NAME_SPACE_K8S}" cp -a "/tmp/${HELM_CHART_K8S_MERGED_VALUE_FILE_NAME}" "${ARTIFACT_DIR}/${NAME_SPACE_K8S}/" # Save the final value-file into the artifacts directory. @@ -26,7 +27,8 @@ initiate_rbac_aks_deployment() { # install_tekton_pipelines uninstall_helmchart "${NAME_SPACE_RBAC_K8S}" "${RELEASE_NAME_RBAC}" cd "${DIR}" - apply_yaml_files "${DIR}" "${NAME_SPACE_RBAC_K8S}" + local rbac_rhdh_base_url="https://${K8S_CLUSTER_ROUTER_BASE}" + apply_yaml_files "${DIR}" "${NAME_SPACE_RBAC_K8S}" "${rbac_rhdh_base_url}" yq_merge_value_files "${DIR}/value_files/${HELM_CHART_RBAC_VALUE_FILE_NAME}" "${DIR}/value_files/${HELM_CHART_RBAC_AKS_DIFF_VALUE_FILE_NAME}" "/tmp/${HELM_CHART_RBAC_K8S_MERGED_VALUE_FILE_NAME}" mkdir -p "${ARTIFACT_DIR}/${NAME_SPACE_RBAC_K8S}" cp -a "/tmp/${HELM_CHART_RBAC_K8S_MERGED_VALUE_FILE_NAME}" "${ARTIFACT_DIR}/${NAME_SPACE_RBAC_K8S}/" # Save the final value-file into the artifacts directory. diff --git a/.ibm/pipelines/cluster/gke/deployment.sh b/.ibm/pipelines/cluster/gke/deployment.sh index 99c910fd81..d01dea7566 100644 --- a/.ibm/pipelines/cluster/gke/deployment.sh +++ b/.ibm/pipelines/cluster/gke/deployment.sh @@ -7,7 +7,8 @@ initiate_gke_deployment() { # install_tekton_pipelines uninstall_helmchart "${NAME_SPACE_K8S}" "${RELEASE_NAME}" cd "${DIR}" - apply_yaml_files "${DIR}" "${NAME_SPACE_K8S}" + local rhdh_base_url="https://${K8S_CLUSTER_ROUTER_BASE}" + apply_yaml_files "${DIR}" "${NAME_SPACE_K8S}" "${rhdh_base_url}" oc apply -f "${DIR}/cluster/gke/frontend-config.yaml" --namespace="${project}" yq_merge_value_files "${DIR}/value_files/${HELM_CHART_VALUE_FILE_NAME}" "${DIR}/value_files/${HELM_CHART_GKE_DIFF_VALUE_FILE_NAME}" "/tmp/${HELM_CHART_K8S_MERGED_VALUE_FILE_NAME}" mkdir -p "${ARTIFACT_DIR}/${NAME_SPACE_K8S}" @@ -30,7 +31,8 @@ initiate_rbac_gke_deployment() { # install_tekton_pipelines uninstall_helmchart "${NAME_SPACE_RBAC_K8S}" "${RELEASE_NAME_RBAC}" cd "${DIR}" - apply_yaml_files "${DIR}" "${NAME_SPACE_RBAC_K8S}" + local rbac_rhdh_base_url="https://${K8S_CLUSTER_ROUTER_BASE}" + apply_yaml_files "${DIR}" "${NAME_SPACE_RBAC_K8S}" "${rbac_rhdh_base_url}" yq_merge_value_files "${DIR}/value_files/${HELM_CHART_RBAC_VALUE_FILE_NAME}" "${DIR}/value_files/${HELM_CHART_RBAC_GKE_DIFF_VALUE_FILE_NAME}" "/tmp/${HELM_CHART_RBAC_K8S_MERGED_VALUE_FILE_NAME}" mkdir -p "${ARTIFACT_DIR}/${NAME_SPACE_RBAC_K8S}" cp -a "/tmp/${HELM_CHART_RBAC_K8S_MERGED_VALUE_FILE_NAME}" "${ARTIFACT_DIR}/${NAME_SPACE_RBAC_K8S}/" # Save the final value-file into the artifacts directory. diff --git a/.ibm/pipelines/env_variables.sh b/.ibm/pipelines/env_variables.sh index 6815aa1a16..fa2248d32d 100755 --- a/.ibm/pipelines/env_variables.sh +++ b/.ibm/pipelines/env_variables.sh @@ -24,18 +24,10 @@ NAME_SPACE_RUNTIME="${NAME_SPACE_RUNTIME:-showcase-runtime}" NAME_SPACE_POSTGRES_DB="${NAME_SPACE_POSTGRES_DB:-postgress-external-db}" NAME_SPACE_RDS="showcase-rds-nightly" CHART_VERSION="2.15.2" -GITHUB_APP_APP_ID=$(cat /tmp/secrets/GITHUB_APP_APP_ID) -GITHUB_APP_CLIENT_ID=$(cat /tmp/secrets/GITHUB_APP_CLIENT_ID) -GITHUB_APP_PRIVATE_KEY=$(cat /tmp/secrets/GITHUB_APP_PRIVATE_KEY) -GITHUB_APP_CLIENT_SECRET=$(cat /tmp/secrets/GITHUB_APP_CLIENT_SECRET) -GITHUB_APP_2_APP_ID=$(cat /tmp/secrets/GITHUB_APP_2_APP_ID) -GITHUB_APP_2_CLIENT_ID=$(cat /tmp/secrets/GITHUB_APP_2_CLIENT_ID) -GITHUB_APP_2_PRIVATE_KEY=$(cat /tmp/secrets/GITHUB_APP_2_PRIVATE_KEY) -GITHUB_APP_2_CLIENT_SECRET=$(cat /tmp/secrets/GITHUB_APP_2_CLIENT_SECRET) -GITHUB_APP_3_APP_ID=$(cat /tmp/secrets/GITHUB_APP_3_APP_ID) -GITHUB_APP_3_CLIENT_ID=$(cat /tmp/secrets/GITHUB_APP_3_CLIENT_ID) -GITHUB_APP_3_PRIVATE_KEY=$(cat /tmp/secrets/GITHUB_APP_3_PRIVATE_KEY) -GITHUB_APP_3_CLIENT_SECRET=$(cat /tmp/secrets/GITHUB_APP_3_CLIENT_SECRET) +GITHUB_APP_APP_ID=$(cat /tmp/secrets/GITHUB_APP_3_APP_ID) +GITHUB_APP_CLIENT_ID=$(cat /tmp/secrets/GITHUB_APP_3_CLIENT_ID) +GITHUB_APP_PRIVATE_KEY=$(cat /tmp/secrets/GITHUB_APP_3_PRIVATE_KEY) +GITHUB_APP_CLIENT_SECRET=$(cat /tmp/secrets/GITHUB_APP_3_CLIENT_SECRET) GITHUB_APP_JANUS_TEST_APP_ID=OTE3NjM5 GITHUB_APP_JANUS_TEST_CLIENT_ID=SXYyM2xpSEdtU1l6SUFEbHFIakw= GITHUB_APP_JANUS_TEST_PRIVATE_KEY=$(cat /tmp/secrets/GITHUB_APP_JANUS_TEST_PRIVATE_KEY) diff --git a/.ibm/pipelines/jobs/aks.sh b/.ibm/pipelines/jobs/aks.sh index ddf4d33c56..e6c934d264 100644 --- a/.ibm/pipelines/jobs/aks.sh +++ b/.ibm/pipelines/jobs/aks.sh @@ -17,13 +17,12 @@ handle_aks() { az_aks_approuting_enable "${AKS_NIGHTLY_CLUSTER_NAME}" "${AKS_NIGHTLY_CLUSTER_RESOURCEGROUP}" az_aks_get_credentials "${AKS_NIGHTLY_CLUSTER_NAME}" "${AKS_NIGHTLY_CLUSTER_RESOURCEGROUP}" - set_github_app_3_credentials - initiate_aks_deployment check_and_test "${RELEASE_NAME}" "${NAME_SPACE_K8S}" "${url}" delete_namespace "${NAME_SPACE_K8S}" initiate_rbac_aks_deployment - check_and_test "${RELEASE_NAME_RBAC}" "${NAME_SPACE_RBAC_K8S}" + local rbac_rhdh_base_url="https://${K8S_CLUSTER_ROUTER_BASE}" + check_and_test "${RELEASE_NAME_RBAC}" "${NAME_SPACE_RBAC_K8S}" "${rbac_rhdh_base_url}" delete_namespace "${NAME_SPACE_RBAC_K8S}" } diff --git a/.ibm/pipelines/jobs/gke.sh b/.ibm/pipelines/jobs/gke.sh index 71e8de697c..8fe93a782a 100644 --- a/.ibm/pipelines/jobs/gke.sh +++ b/.ibm/pipelines/jobs/gke.sh @@ -12,13 +12,12 @@ handle_gke() { gcloud_auth "${GKE_SERVICE_ACCOUNT_NAME}" "/tmp/secrets/GKE_SERVICE_ACCOUNT_KEY" gcloud_gke_get_credentials "${GKE_CLUSTER_NAME}" "${GKE_CLUSTER_REGION}" "${GOOGLE_CLOUD_PROJECT}" - set_github_app_3_credentials - initiate_gke_deployment check_and_test "${RELEASE_NAME}" "${NAME_SPACE_K8S}" "${url}" delete_namespace "${NAME_SPACE_K8S}" initiate_rbac_gke_deployment - check_and_test "${RELEASE_NAME_RBAC}" "${NAME_SPACE_RBAC_K8S}" + local rbac_rhdh_base_url="https://${K8S_CLUSTER_ROUTER_BASE}" + check_and_test "${RELEASE_NAME_RBAC}" "${NAME_SPACE_RBAC_K8S}" "${rbac_rhdh_base_url}" delete_namespace "${NAME_SPACE_RBAC_K8S}" } diff --git a/.ibm/pipelines/jobs/main.sh b/.ibm/pipelines/jobs/main.sh index 9d4db8133e..f37b47e367 100644 --- a/.ibm/pipelines/jobs/main.sh +++ b/.ibm/pipelines/jobs/main.sh @@ -6,10 +6,11 @@ handle_main() { echo "OCP version: $(oc version)" export K8S_CLUSTER_ROUTER_BASE=$(oc get route console -n openshift-console -o=jsonpath='{.spec.host}' | sed 's/^[^.]*\.//') - local url="https://${RELEASE_NAME}-backstage-${NAME_SPACE}.${K8S_CLUSTER_ROUTER_BASE}" cluster_setup initiate_deployments deploy_test_backstage_provider "${NAME_SPACE}" + local url="https://${RELEASE_NAME}-backstage-${NAME_SPACE}.${K8S_CLUSTER_ROUTER_BASE}" check_and_test "${RELEASE_NAME}" "${NAME_SPACE}" "${url}" - check_and_test "${RELEASE_NAME_RBAC}" "${NAME_SPACE_RBAC}" "${url}" + local rbac_url="https://${RELEASE_NAME_RBAC}-backstage-${NAME_SPACE_RBAC}.${K8S_CLUSTER_ROUTER_BASE}" + check_and_test "${RELEASE_NAME_RBAC}" "${NAME_SPACE_RBAC}" "${rbac_url}" } diff --git a/.ibm/pipelines/jobs/periodic.sh b/.ibm/pipelines/jobs/periodic.sh index 30ddc9dcfc..99ab74d95e 100644 --- a/.ibm/pipelines/jobs/periodic.sh +++ b/.ibm/pipelines/jobs/periodic.sh @@ -1,33 +1,32 @@ #!/bin/sh handle_nightly() { - export NAME_SPACE="showcase-ci-nightly" - export NAME_SPACE_RBAC="showcase-rbac-nightly" - export NAME_SPACE_POSTGRES_DB="postgress-external-db-nightly" - export NAME_SPACE_K8S="showcase-k8s-ci-nightly" - export NAME_SPACE_RBAC_K8S="showcase-rbac-k8s-ci-nightly" - oc_login export K8S_CLUSTER_ROUTER_BASE=$(oc get route console -n openshift-console -o=jsonpath='{.spec.host}' | sed 's/^[^.]*\.//') configure_namespace "${NAME_SPACE}" deploy_test_backstage_provider "${NAME_SPACE}" - local url="https://${RELEASE_NAME}-backstage-${NAME_SPACE}.${K8S_CLUSTER_ROUTER_BASE}" cluster_setup initiate_deployments + local url="https://${RELEASE_NAME}-backstage-${NAME_SPACE}.${K8S_CLUSTER_ROUTER_BASE}" check_and_test "${RELEASE_NAME}" "${NAME_SPACE}" "${url}" - check_and_test "${RELEASE_NAME_RBAC}" "${NAME_SPACE_RBAC}" "${url}" + local rbac_url="https://${RELEASE_NAME_RBAC}-backstage-${NAME_SPACE_RBAC}.${K8S_CLUSTER_ROUTER_BASE}" + check_and_test "${RELEASE_NAME_RBAC}" "${NAME_SPACE_RBAC}" "${rbac_url}" # Only test TLS config with RDS and Change configuration at runtime in nightly jobs initiate_rds_deployment "${RELEASE_NAME}" "${NAME_SPACE_RDS}" - check_and_test "${RELEASE_NAME}" "${NAME_SPACE_RDS}" "${url}" + local rds_url="https://${RELEASE_NAME}-backstage-${NAME_SPACE_RDS}.${K8S_CLUSTER_ROUTER_BASE}" + check_and_test "${RELEASE_NAME}" "${NAME_SPACE_RDS}" "${rds_url}" # Deploy `showcase-runtime` to run tests that require configuration changes at runtime configure_namespace "${NAME_SPACE_RUNTIME}" uninstall_helmchart "${NAME_SPACE_RUNTIME}" "${RELEASE_NAME}" oc apply -f "$DIR/resources/redis-cache/redis-deployment.yaml" --namespace="${NAME_SPACE_RUNTIME}" - apply_yaml_files "${DIR}" "${NAME_SPACE_RUNTIME}" "${RELEASE_NAME}" + + local runtime_url="https://${RELEASE_NAME}-backstage-${NAME_SPACE_RUNTIME}.${K8S_CLUSTER_ROUTER_BASE}" + + apply_yaml_files "${DIR}" "${NAME_SPACE_RUNTIME}" "${runtime_url}" helm upgrade -i "${RELEASE_NAME}" -n "${NAME_SPACE_RUNTIME}" "${HELM_REPO_NAME}/${HELM_IMAGE_NAME}" --version "${CHART_VERSION}" -f "${DIR}/value_files/${HELM_CHART_VALUE_FILE_NAME}" --set global.clusterRouterBase="${K8S_CLUSTER_ROUTER_BASE}" --set upstream.backstage.image.repository="${QUAY_REPO}" --set upstream.backstage.image.tag="${TAG_NAME}" - check_and_test "${RELEASE_NAME}" "${NAME_SPACE_RUNTIME}" "${url}" + check_and_test "${RELEASE_NAME}" "${NAME_SPACE_RUNTIME}" "${runtime_url}" } diff --git a/.ibm/pipelines/ocp-cluster-claim-login.sh b/.ibm/pipelines/ocp-cluster-claim-login.sh index e42ae1af03..9f54d2a572 100755 --- a/.ibm/pipelines/ocp-cluster-claim-login.sh +++ b/.ibm/pipelines/ocp-cluster-claim-login.sh @@ -60,6 +60,8 @@ if [[ "$open_console" == "y" || "$open_console" == "Y" ]]; then echo "Use bellow user and password to login into web console:" echo "Username: kubeadmin" echo "Password: $password" + echo "Password copied to clipboard" + echo $password | pbcopy sleep 3 # Attempt to open the web console in the default browser diff --git a/.ibm/pipelines/openshift-ci-tests.sh b/.ibm/pipelines/openshift-ci-tests.sh index 9759706a42..0c4c9a3c48 100755 --- a/.ibm/pipelines/openshift-ci-tests.sh +++ b/.ibm/pipelines/openshift-ci-tests.sh @@ -1,11 +1,10 @@ #!/bin/sh -set -xe +set -e export PS4='[$(date "+%Y-%m-%d %H:%M:%S")] ' # logs timestamp for every cmd. LOGFILE="test-log" export DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -secret_name="rhdh-k8s-plugin-secret" OVERALL_RESULT=0 cleanup() { @@ -61,7 +60,6 @@ main() { ;; esac -echo "K8S_CLUSTER_ROUTER_BASE : $K8S_CLUSTER_ROUTER_BASE" echo "Main script completed with result: ${OVERALL_RESULT}" exit "${OVERALL_RESULT}" diff --git a/.ibm/pipelines/resources/cluster_role_binding/cluster-role-binding-ocm.yaml b/.ibm/pipelines/resources/cluster_role_binding/cluster-role-binding-ocm.yaml index cb8631b32c..8cd8b1525d 100644 --- a/.ibm/pipelines/resources/cluster_role_binding/cluster-role-binding-ocm.yaml +++ b/.ibm/pipelines/resources/cluster_role_binding/cluster-role-binding-ocm.yaml @@ -10,34 +10,6 @@ subjects: - kind: ServiceAccount name: rhdh-k8s-plugin namespace: showcase - - kind: ServiceAccount - name: rhdh-k8s-plugin - namespace: showcase-rbac - kind: ServiceAccount name: rhdh-k8s-plugin namespace: showcase-ci-nightly - - kind: ServiceAccount - name: rhdh-k8s-plugin - namespace: showcase-rbac-nightly - - kind: ServiceAccount - name: rhdh-k8s-plugin - namespace: showcase-1-2-x - - kind: ServiceAccount - name: rhdh-k8s-plugin - namespace: showcase-rbac-1-2-x - - kind: ServiceAccount - name: rhdh-k8s-plugin - namespace: showcase-1-3-x - - kind: ServiceAccount - name: rhdh-k8s-plugin - namespace: showcase-rbac-1-3-x - - kind: ServiceAccount - name: rhdh-k8s-plugin - namespace: showcase-pr-1 - - kind: ServiceAccount - name: rhdh-k8s-plugin - namespace: showcase-pr-2 - - kind: ServiceAccount - name: rhdh-k8s-plugin - namespace: showcase-pr-3 - diff --git a/.ibm/pipelines/utils.sh b/.ibm/pipelines/utils.sh index adc81983dc..0794e677c5 100755 --- a/.ibm/pipelines/utils.sh +++ b/.ibm/pipelines/utils.sh @@ -11,8 +11,7 @@ retrieve_pod_logs() { save_all_pod_logs(){ set +e local namespace=$1 - namespace=${namespace%-pr-*} # remove -pr- suffix if any. - mkdir -p pod_logs + rm -rf pod_logs && mkdir -p pod_logs # Get all pod names in the namespace pod_names=$(kubectl get pods -n $namespace -o jsonpath='{.items[*].metadata.name}') @@ -384,23 +383,10 @@ configure_external_postgres_db() { oc apply -f "${DIR}/resources/postgres-db/postgres-cred.yaml" --namespace="${project}" } -set_github_app_3_credentials() { - GITHUB_APP_APP_ID=$GITHUB_APP_3_APP_ID - GITHUB_APP_CLIENT_ID=$GITHUB_APP_3_CLIENT_ID - GITHUB_APP_PRIVATE_KEY=$GITHUB_APP_3_PRIVATE_KEY - GITHUB_APP_CLIENT_SECRET=$GITHUB_APP_3_CLIENT_SECRET - - export GITHUB_APP_APP_ID - export GITHUB_APP_CLIENT_ID - export GITHUB_APP_PRIVATE_KEY - export GITHUB_APP_CLIENT_SECRET - echo "GitHub App 3 credentials set for current job." -} - apply_yaml_files() { local dir=$1 local project=$2 - local release_name=$3 + local rhdh_base_url=$3 echo "Applying YAML files to namespace ${project}" oc config set-context --current --namespace="${project}" @@ -418,10 +404,8 @@ apply_yaml_files() { done DH_TARGET_URL=$(echo -n "test-backstage-customization-provider-${project}.${K8S_CLUSTER_ROUTER_BASE}" | base64 -w 0) - local RHDH_BASE_URL=$(echo -n "https://${release_name}-backstage-${project}.${K8S_CLUSTER_ROUTER_BASE}" | base64 | tr -d '\n') - if [[ "$JOB_NAME" == *aks* || "$JOB_NAME" == *gke* ]]; then - RHDH_BASE_URL=$(echo -n "https://${K8S_CLUSTER_ROUTER_BASE}" | base64 | tr -d '\n') - fi + local RHDH_BASE_URL=$(echo -n "$rhdh_base_url" | base64 | tr -d '\n') + for key in GITHUB_APP_APP_ID GITHUB_APP_CLIENT_ID GITHUB_APP_PRIVATE_KEY GITHUB_APP_CLIENT_SECRET GITHUB_APP_JANUS_TEST_APP_ID GITHUB_APP_JANUS_TEST_CLIENT_ID GITHUB_APP_JANUS_TEST_CLIENT_SECRET GITHUB_APP_JANUS_TEST_PRIVATE_KEY GITHUB_APP_WEBHOOK_URL GITHUB_APP_WEBHOOK_SECRET KEYCLOAK_CLIENT_SECRET ACR_SECRET GOOGLE_CLIENT_ID GOOGLE_CLIENT_SECRET K8S_CLUSTER_TOKEN_ENCODED OCM_CLUSTER_URL GITLAB_TOKEN KEYCLOAK_AUTH_BASE_URL KEYCLOAK_AUTH_CLIENTID KEYCLOAK_AUTH_CLIENT_SECRET KEYCLOAK_AUTH_LOGIN_REALM KEYCLOAK_AUTH_REALM RHDH_BASE_URL; do sed -i "s|${key}:.*|${key}: ${!key}|g" "$dir/auth/secrets-rhdh-secrets.yaml" done @@ -439,7 +423,7 @@ apply_yaml_files() { sed -i "s/K8S_CLUSTER_NAME:.*/K8S_CLUSTER_NAME: ${ENCODED_CLUSTER_NAME}/g" "$dir/auth/secrets-rhdh-secrets.yaml" - token=$(oc get secret "${secret_name}" -n "${project}" -o=jsonpath='{.data.token}') + token=$(oc get secret rhdh-k8s-plugin-secret -n "${project}" -o=jsonpath='{.data.token}') sed -i "s/OCM_CLUSTER_TOKEN: .*/OCM_CLUSTER_TOKEN: ${token}/" "$dir/auth/secrets-rhdh-secrets.yaml" # Select the configuration file based on the namespace or job @@ -523,7 +507,7 @@ create_app_config_map_k8s() { run_tests() { local release_name=$1 local project=$2 - project=${project%-pr-*} # Remove -pr- suffix if any set for main branchs pr's. + project=${project} cd "${DIR}/../../e2e-tests" yarn install yarn playwright install chromium @@ -660,7 +644,8 @@ initiate_deployments() { oc apply -f "$DIR/resources/redis-cache/redis-deployment.yaml" --namespace="${NAME_SPACE}" cd "${DIR}" - apply_yaml_files "${DIR}" "${NAME_SPACE}" "${RELEASE_NAME}" "${RELEASE_NAME}" + local rhdh_base_url="https://${RELEASE_NAME}-backstage-${NAME_SPACE}.${K8S_CLUSTER_ROUTER_BASE}" + apply_yaml_files "${DIR}" "${NAME_SPACE}" "${rhdh_base_url}" echo "Deploying image from repository: ${QUAY_REPO}, TAG_NAME: ${TAG_NAME}, in NAME_SPACE: ${NAME_SPACE}" helm upgrade -i "${RELEASE_NAME}" -n "${NAME_SPACE}" "${HELM_REPO_NAME}/${HELM_IMAGE_NAME}" --version "${CHART_VERSION}" -f "${DIR}/value_files/${HELM_CHART_VALUE_FILE_NAME}" --set global.clusterRouterBase="${K8S_CLUSTER_ROUTER_BASE}" --set upstream.backstage.image.repository="${QUAY_REPO}" --set upstream.backstage.image.tag="${TAG_NAME}" @@ -669,7 +654,8 @@ initiate_deployments() { configure_external_postgres_db "${NAME_SPACE_RBAC}" # Initiate rbac instace deployment. - apply_yaml_files "${DIR}" "${NAME_SPACE_RBAC}" "${RELEASE_NAME_RBAC}" + local rbac_rhdh_base_url="https://${RELEASE_NAME_RBAC}-backstage-${NAME_SPACE_RBAC}.${K8S_CLUSTER_ROUTER_BASE}" + apply_yaml_files "${DIR}" "${NAME_SPACE_RBAC}" "${rbac_rhdh_base_url}" echo "Deploying image from repository: ${QUAY_REPO}, TAG_NAME: ${TAG_NAME}, in NAME_SPACE: ${RELEASE_NAME_RBAC}" helm upgrade -i "${RELEASE_NAME_RBAC}" -n "${NAME_SPACE_RBAC}" "${HELM_REPO_NAME}/${HELM_IMAGE_NAME}" --version "${CHART_VERSION}" -f "${DIR}/value_files/${HELM_CHART_RBAC_VALUE_FILE_NAME}" --set global.clusterRouterBase="${K8S_CLUSTER_ROUTER_BASE}" --set upstream.backstage.image.repository="${QUAY_REPO}" --set upstream.backstage.image.tag="${TAG_NAME}" } diff --git a/e2e-tests/package.json b/e2e-tests/package.json index cc6c16e537..ba130b9e6a 100644 --- a/e2e-tests/package.json +++ b/e2e-tests/package.json @@ -10,8 +10,6 @@ "scripts": { "showcase": "playwright test --project=showcase", "showcase-rbac": "playwright test --project=showcase-rbac", - "showcase-1-2-x": "playwright test --project=showcase", - "showcase-rbac-1-2-x": "playwright test --project=showcase-rbac", "showcase-ci-nightly": "playwright test --project=showcase", "showcase-rbac-nightly": "playwright test --project=showcase-rbac", "showcase-k8s-ci-nightly": "playwright test --project=showcase-k8s", diff --git a/e2e-tests/playwright/e2e/verify-tls-config-with-external-postgres-db.spec.ts b/e2e-tests/playwright/e2e/verify-tls-config-with-external-postgres-db.spec.ts index 6a1b7ba9ce..d8bb60fb41 100644 --- a/e2e-tests/playwright/e2e/verify-tls-config-with-external-postgres-db.spec.ts +++ b/e2e-tests/playwright/e2e/verify-tls-config-with-external-postgres-db.spec.ts @@ -3,15 +3,17 @@ import { UIhelper } from "../utils/ui-helper"; import { Common } from "../utils/common"; test.describe("Verify TLS configuration with external Postgres DB", () => { - test("Verify successful DB connection and display of expected entities in the Catalog", async ({ + test("Verify successful DB connection and display of expected entities in the Home Page and Catalog", async ({ page, }) => { const uiHelper = new UIhelper(page); const common = new Common(page); await common.loginAsKeycloakUser(); - await page.goto("/catalog"); + await uiHelper.verifyHeading("Welcome back!"); + await uiHelper.verifyText("Quick Access"); + await page.getByLabel("Catalog").click(); await uiHelper.selectMuiBox("Kind", "Component"); await uiHelper.clickByDataTestId("user-picker-all"); - await uiHelper.verifyRowsInTable(["Backstage Showcase"]); + await uiHelper.verifyRowsInTable(["test-rhdh-qe-2-team-owned"]); }); });