Skip to content

Commit 2a44d65

Browse files
committed
Address review feedback on operator e2e steps
- Guard SHARED_DIR expansion with nounset-safe check - Use bash array for Ginkgo args to prevent word splitting - Add configurable OPERATOR_DEPLOYMENT_NAME for operators whose deployment name differs from the operator name
1 parent 1e93113 commit 2a44d65

3 files changed

Lines changed: 11 additions & 7 deletions

File tree

ci-operator/step-registry/rosa/operator/e2e/rosa-operator-e2e-commands.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ fi
1717

1818
# Get cluster access: prefer shared kubeconfig from provision step,
1919
# fall back to backplane for persistent clusters
20-
if [[ -f "${SHARED_DIR}/kubeconfig" ]]; then
20+
if [[ -n "${SHARED_DIR:-}" && -f "${SHARED_DIR}/kubeconfig" ]]; then
2121
log "Using kubeconfig from provision step"
2222
export KUBECONFIG="${SHARED_DIR}/kubeconfig"
2323
elif [[ -n "${OPERATOR_E2E_CLUSTER_ID:-}" ]]; then
@@ -50,14 +50,14 @@ log "Connected to cluster: $(oc whoami --show-server)"
5050

5151
# Run the operator e2e tests
5252
JUNIT_REPORT="${ARTIFACT_DIR}/junit-${OPERATOR_NAME}-e2e.xml"
53-
GINKGO_FLAGS="--ginkgo.junit-report=${JUNIT_REPORT} --ginkgo.v"
53+
GINKGO_ARGS=("--ginkgo.junit-report=${JUNIT_REPORT}" "--ginkgo.v")
5454

5555
if [[ -n "${GINKGO_LABEL_FILTER:-}" ]]; then
56-
GINKGO_FLAGS="${GINKGO_FLAGS} --ginkgo.label-filter=${GINKGO_LABEL_FILTER}"
56+
GINKGO_ARGS+=("--ginkgo.label-filter=${GINKGO_LABEL_FILTER}")
5757
fi
5858

5959
log "Running ${OPERATOR_NAME} e2e tests..."
60-
/usr/local/bin/e2e.test ${GINKGO_FLAGS} || {
60+
/usr/local/bin/e2e.test "${GINKGO_ARGS[@]}" || {
6161
log "Tests failed. JUnit report at ${JUNIT_REPORT}"
6262
exit 1
6363
}

ci-operator/step-registry/rosa/operator/install/rosa-operator-install-commands.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ log(){
1111
}
1212

1313
# Use shared kubeconfig from provision step if available
14-
if [[ -f "${SHARED_DIR}/kubeconfig" ]]; then
14+
if [[ -n "${SHARED_DIR:-}" && -f "${SHARED_DIR}/kubeconfig" ]]; then
1515
export KUBECONFIG="${SHARED_DIR}/kubeconfig"
1616
fi
1717

@@ -31,6 +31,7 @@ if [[ -z "${OPERATOR_IMAGE:-}" ]]; then
3131
fi
3232

3333
OPERATOR_NAMESPACE="${OPERATOR_NAMESPACE:-openshift-${OPERATOR_NAME}}"
34+
OPERATOR_DEPLOYMENT_NAME="${OPERATOR_DEPLOYMENT_NAME:-${OPERATOR_NAME}}"
3435

3536
log "Installing ${OPERATOR_NAME} via PKO ClusterPackage"
3637
log " PKO image: ${OPERATOR_PKO_IMAGE}"
@@ -61,8 +62,8 @@ spec:
6162
EOF
6263

6364
# Wait for the operator deployment to be available
64-
log "Waiting for ${OPERATOR_NAME} deployment to be ready..."
65-
oc wait deployment "${OPERATOR_NAME}" \
65+
log "Waiting for deployment ${OPERATOR_DEPLOYMENT_NAME} to be ready..."
66+
oc wait deployment "${OPERATOR_DEPLOYMENT_NAME}" \
6667
-n "${OPERATOR_NAMESPACE}" \
6768
--for=condition=Available \
6869
--timeout=300s

ci-operator/step-registry/rosa/operator/install/rosa-operator-install-ref.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ ref:
2121
- name: OPERATOR_NAMESPACE
2222
default: ""
2323
documentation: Namespace for the operator. Defaults to openshift-<OPERATOR_NAME>.
24+
- name: OPERATOR_DEPLOYMENT_NAME
25+
default: ""
26+
documentation: Name of the deployment to wait on. Defaults to OPERATOR_NAME.
2427
- name: OPERATOR_CRD_DIR
2528
default: ""
2629
documentation: Path to directory containing CRD manifests to pre-apply. Optional.

0 commit comments

Comments
 (0)