Skip to content

Commit 4c9ff23

Browse files
authored
Merge branch 'main' into feat/RHIDP-8270
2 parents a34b7f6 + 5f291b7 commit 4c9ff23

File tree

65 files changed

+704
-143
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+704
-143
lines changed

.cursor/rules/ci-e2e-testing.mdc

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,36 @@ e2e-tests/
4848
└── playwright-report/ # Playwright reports
4949
```
5050

51+
#### Test File Requirements
52+
53+
**Component Assignment**: Every test file (`*.spec.ts`) in the `e2e-tests` folder must have a component assigned in the `test.beforeAll` hook using the following syntax:
54+
55+
```typescript
56+
test.beforeAll(async ({ }, testInfo) => {
57+
testInfo.annotations.push({
58+
type: "component",
59+
description: "your_value",
60+
});
61+
});
62+
```
63+
64+
**Purpose**: This component annotation is used for test categorization, reporting, and CI/CD pipeline organization. It helps identify which component or feature area each test file is validating.
65+
66+
**Examples of Component Values**:
67+
- `"authentication"` - for authentication provider tests
68+
- `"rbac"` - for role-based access control tests
69+
- `"plugins"` - for plugin functionality tests
70+
- `"configuration"` - for configuration validation tests
71+
- `"audit-log"` - for audit logging tests
72+
- `"core"` - for core functionality tests
73+
- `"navigation"` - for navigation and routing tests
74+
- `"api"` - for API endpoint and integration tests
75+
- `"integration"` - for external service integration tests
76+
- `"monitoring"` - for monitoring and observability tests
77+
- `"data-management"` - for data handling and management tests
78+
79+
**Note**: The component description should be descriptive and consistent across related test files to ensure proper test organization and reporting.
80+
5181
#### Key Test Categories
5282

5383
1. **Smoke Tests** (`smoke-test.spec.ts`)
@@ -332,6 +362,21 @@ npx playwright test --project showcase-auth-providers --workers 1
332362

333363
## Key Dependencies and Common Issues
334364

365+
### System Dependencies
366+
367+
#### macOS Requirements
368+
**Important**: macOS users need to use GNU `grep` and GNU `sed` instead of the built-in BSD versions to avoid compatibility issues with scripts and CI/CD pipelines.
369+
370+
Install using Homebrew:
371+
```bash
372+
brew install grep
373+
brew install gnu-sed
374+
```
375+
376+
**Important**: Make sure to set the GNU versions as default to ensure they are used instead of the built-in macOS versions.
377+
378+
**Note**: The built-in macOS versions of these tools may cause issues when running scripts or tests that expect GNU-compatible behavior.
379+
335380
### External Services
336381

337382
#### Required Services

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,8 @@ dynamic-plugins-root/*
6666

6767
# Local Cursor rules context
6868
.cursor/rules/*.local.mdc
69+
70+
# CI/Pipeline local overrides
71+
.ibm/pipelines/shared_dir/*
72+
.ibm/pipelines/artifact_dir/*
73+
.ibm/pipelines/env_override.local.sh

.ibm/pipelines/cleanup.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
cleanup() {
4+
if [[ $? -ne 0 ]]; then
5+
6+
echo "Exited with an error, setting OVERALL_RESULT to 1"
7+
save_overall_result 1
8+
fi
9+
echo "Cleaning up before exiting"
10+
if [[ "${OPENSHIFT_CI}" == "true" ]]; then
11+
case "$JOB_NAME" in
12+
*gke*)
13+
echo "Calling cleanup_gke"
14+
cleanup_gke
15+
;;
16+
esac
17+
fi
18+
rm -rf ~/tmpbin
19+
}

.ibm/pipelines/env_variables.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,29 @@
22
# shellcheck disable=SC2034
33
set -a # Automatically export all variables
44

5+
# Define log file names and directories.
6+
LOGFILE="test-log"
7+
8+
# Populated by OpenShift CI or the initial CI scripts
9+
# Addition to JOB_NAME, TAG_NAME, SHARED_DIR, ARTIFACT_DIR
10+
# This prevents nounset errors when running locally
11+
# https://docs.ci.openshift.org/docs/architecture/step-registry/#available-environment-variables
12+
# https://docs.prow.k8s.io/docs/jobs/#job-environment-variables
13+
JOB_NAME="${JOB_NAME:-unknown-job}"
14+
TAG_NAME="${TAG_NAME:-}"
15+
OPENSHIFT_CI="${OPENSHIFT_CI:-false}"
16+
REPO_OWNER="${REPO_OWNER:-redhat-developer}"
17+
REPO_NAME="${REPO_NAME:-rhdh}"
18+
PULL_NUMBER="${PULL_NUMBER:-}"
19+
BUILD_ID="${BUILD_ID:-unknown-build}"
20+
RELEASE_BRANCH_NAME="${RELEASE_BRANCH_NAME:-main}"
21+
K8S_CLUSTER_TOKEN="${K8S_CLUSTER_TOKEN:-}"
22+
K8S_CLUSTER_URL="${K8S_CLUSTER_URL:-}"
23+
SHARED_DIR="${SHARED_DIR:-$DIR/shared_dir}"
24+
ARTIFACT_DIR="${ARTIFACT_DIR:-$DIR/artifact_dir}"
25+
mkdir -p "${SHARED_DIR}"
26+
mkdir -p "${ARTIFACT_DIR}"
27+
528
#ENVS and Vault Secrets
629
HELM_CHART_VALUE_FILE_NAME="values_showcase.yaml"
730
HELM_CHART_RBAC_VALUE_FILE_NAME="values_showcase-rbac.yaml"
@@ -162,6 +185,8 @@ KEYCLOAK_AUTH_REALM=$(cat /tmp/secrets/KEYCLOAK_AUTH_REALM)
162185
REGISTRY_REDHAT_IO_SERVICE_ACCOUNT_DOCKERCONFIGJSON=$(cat /tmp/secrets/REGISTRY_REDHAT_IO_SERVICE_ACCOUNT_DOCKERCONFIGJSON)
163186

164187
IS_OPENSHIFT=""
188+
CONTAINER_PLATFORM=""
189+
CONTAINER_PLATFORM_VERSION=""
165190

166191
GITHUB_OAUTH_APP_ID=$(cat /tmp/secrets/GITHUB_OAUTH_APP_ID)
167192
GITHUB_OAUTH_APP_SECRET=$(cat /tmp/secrets/GITHUB_OAUTH_APP_SECRET)

.ibm/pipelines/jobs/ocp-nightly.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ run_runtime_config_change_tests() {
3535
}
3636

3737
run_sanity_plugins_check() {
38-
initiate_sanity_plugin_checks_deployment "${RELEASE_NAME}" "${NAME_SPACE_SANITY_PLUGINS_CHECK}"
3938
local sanity_plugins_url="https://${RELEASE_NAME}-developer-hub-${NAME_SPACE_SANITY_PLUGINS_CHECK}.${K8S_CLUSTER_ROUTER_BASE}"
39+
initiate_sanity_plugin_checks_deployment "${RELEASE_NAME}" "${NAME_SPACE_SANITY_PLUGINS_CHECK}" "${sanity_plugins_url}"
4040
check_and_test "${RELEASE_NAME}" "${NAME_SPACE_SANITY_PLUGINS_CHECK}" "${sanity_plugins_url}"
4141
}

.ibm/pipelines/openshift-ci-tests.sh

Lines changed: 60 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,114 +1,126 @@
11
#!/bin/bash
22

3-
set -e
3+
set -o errexit
4+
set -o errtrace
5+
set -o nounset
46
export PS4='[$(date "+%Y-%m-%d %H:%M:%S")] ' # logs timestamp for every cmd.
57

6-
# Define log file names and directories.
7-
LOGFILE="test-log"
8-
export DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
9-
export CURRENT_DEPLOYMENT=0 # Counter for current deployment.
10-
export STATUS_DEPLOYMENT_NAMESPACE # Array that holds the namespaces of deployments.
11-
export STATUS_FAILED_TO_DEPLOY # Array that indicates if deployment failed. false = success, true = failure
12-
export STATUS_TEST_FAILED # Array that indicates if test run failed. false = success, true = failure
8+
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
9+
export DIR
10+
11+
export OPENSHIFT_CI="${OPENSHIFT_CI:-false}"
12+
if [[ -z "${OPENSHIFT_CI}" || "${OPENSHIFT_CI}" == "false" ]]; then
13+
# NOTE: Use this file to override the environment variables for the local testing.
14+
echo "Sourcing env_override.local.sh"
15+
# shellcheck source=.ibm/pipelines/env_override.local.sh
16+
source "${DIR}/env_override.local.sh"
17+
fi
18+
19+
echo "Sourcing env_variables.sh"
20+
# shellcheck source=.ibm/pipelines/env_variables.sh
21+
source "${DIR}/env_variables.sh"
1322

1423
echo "Sourcing reporting.sh"
1524
# shellcheck source=.ibm/pipelines/reporting.sh
1625
source "${DIR}/reporting.sh"
1726
save_overall_result 0 # Initialize overall result to 0 (success).
18-
export OVERALL_RESULT
1927

2028
# Define a cleanup function to be executed upon script exit.
21-
# shellcheck disable=SC2317
22-
cleanup() {
23-
if [[ $? -ne 0 ]]; then
24-
25-
echo "Exited with an error, setting OVERALL_RESULT to 1"
26-
save_overall_result 1
27-
fi
28-
echo "Cleaning up before exiting"
29-
if [[ "${OPENSHIFT_CI}" == "true" ]]; then
30-
case "$JOB_NAME" in
31-
*gke*)
32-
echo "Calling cleanup_gke"
33-
cleanup_gke
34-
;;
35-
esac
36-
fi
37-
rm -rf ~/tmpbin
38-
}
39-
29+
source "${DIR}/cleanup.sh"
4030
trap cleanup EXIT INT ERR
4131

42-
SCRIPTS=(
43-
"utils.sh"
44-
"env_variables.sh"
45-
"clear-database.sh"
46-
)
47-
48-
# Source explicitly specified scripts
49-
for SCRIPT in "${SCRIPTS[@]}"; do
50-
source "${DIR}/${SCRIPT}"
51-
echo "Loaded ${SCRIPT}"
52-
done
32+
echo "Sourcing utils.sh"
33+
# shellcheck source=.ibm/pipelines/utils.sh
34+
source "${DIR}/utils.sh"
5335

54-
# Source all scripts in jobs directory
55-
for SCRIPT in "${DIR}"/jobs/*.sh; do
56-
if [ -f "$SCRIPT" ]; then
57-
source "$SCRIPT"
58-
echo "Loaded ${SCRIPT}"
59-
fi
60-
done
36+
echo "Sourcing clear-database.sh"
37+
# shellcheck source=.ibm/pipelines/clear-database.sh
38+
source "${DIR}/clear-database.sh"
6139

6240
main() {
6341
echo "Log file: ${LOGFILE}"
6442
echo "JOB_NAME : $JOB_NAME"
6543

6644
CHART_VERSION=$(get_chart_version "$CHART_MAJOR_VERSION")
6745
export CHART_VERSION
68-
detect_ocp_and_set_env_var
46+
detect_ocp
47+
detect_container_platform
6948

7049
case "$JOB_NAME" in
7150
*aks-helm*)
51+
echo "Sourcing aks-helm.sh"
52+
# shellcheck source=.ibm/pipelines/jobs/aks-helm.sh
53+
source "${DIR}/jobs/aks-helm.sh"
7254
echo "Calling handle_aks_helm"
7355
handle_aks_helm
7456
;;
7557
*aks-operator*)
76-
echo "Calling handle_aks_helm"
58+
echo "Sourcing aks-operator.sh"
59+
# shellcheck source=.ibm/pipelines/jobs/aks-operator.sh
60+
source "${DIR}/jobs/aks-operator.sh"
61+
echo "Calling handle_aks_operator"
7762
handle_aks_operator
7863
;;
7964
*eks-helm*)
65+
echo "Sourcing eks-helm.sh"
66+
# shellcheck source=.ibm/pipelines/jobs/eks-helm.sh
67+
source "${DIR}/jobs/eks-helm.sh"
8068
echo "Calling handle_eks_helm"
8169
handle_eks_helm
8270
;;
8371
*eks-operator*)
72+
echo "Sourcing eks-operator.sh"
73+
# shellcheck source=.ibm/pipelines/jobs/eks-operator.sh
74+
source "${DIR}/jobs/eks-operator.sh"
8475
echo "Calling handle_eks_operator"
8576
handle_eks_operator
8677
;;
8778
*e2e-tests-auth-providers-nightly)
79+
echo "Sourcing auth-providers.sh"
80+
# shellcheck source=.ibm/pipelines/jobs/auth-providers.sh
81+
source "${DIR}/jobs/auth-providers.sh"
8882
echo "Calling handle_auth_providers"
8983
handle_auth_providers
9084
;;
9185
*gke-helm*)
86+
echo "Sourcing gke-helm.sh"
87+
# shellcheck source=.ibm/pipelines/jobs/gke-helm.sh
88+
source "${DIR}/jobs/gke-helm.sh"
9289
echo "Calling handle_gke_helm"
9390
handle_gke_helm
9491
;;
9592
*gke-operator*)
93+
echo "Sourcing gke-operator.sh"
94+
# shellcheck source=.ibm/pipelines/jobs/gke-operator.sh
95+
source "${DIR}/jobs/gke-operator.sh"
9696
echo "Calling handle_gke_operator"
9797
handle_gke_operator
9898
;;
9999
*operator*)
100+
echo "Sourcing ocp-operator.sh"
101+
# shellcheck source=.ibm/pipelines/jobs/ocp-operator.sh
102+
source "${DIR}/jobs/ocp-operator.sh"
100103
echo "Calling handle_ocp_operator"
101104
handle_ocp_operator
102105
;;
103106
*upgrade*)
107+
echo "Sourcing upgrade.sh"
108+
# shellcheck source=.ibm/pipelines/jobs/upgrade.sh
109+
source "${DIR}/jobs/upgrade.sh"
104110
echo "Calling helm upgrade"
105111
handle_ocp_helm_upgrade
106112
;;
107113
*nightly*)
114+
echo "Sourcing ocp-nightly.sh"
115+
# shellcheck source=.ibm/pipelines/jobs/ocp-nightly.sh
116+
source "${DIR}/jobs/ocp-nightly.sh"
108117
echo "Calling handle_ocp_nightly"
109118
handle_ocp_nightly
110119
;;
111120
*pull*)
121+
echo "Sourcing ocp-pull.sh"
122+
# shellcheck source=.ibm/pipelines/jobs/ocp-pull.sh
123+
source "${DIR}/jobs/ocp-pull.sh"
112124
echo "Calling handle_ocp_pull"
113125
handle_ocp_pull
114126
;;
@@ -121,7 +133,6 @@ main() {
121133

122134
echo "Main script completed with result: ${OVERALL_RESULT}"
123135
exit "${OVERALL_RESULT}"
124-
125136
}
126137

127138
main

0 commit comments

Comments
 (0)