Skip to content

Commit 6da74af

Browse files
authored
fix: orchestrator install fixes - startingCSV, OLM status checks (#81)
- Replace check_operator_status with OLM label-based wait_for_operator: spec.displayName varies across channels/versions, causing empty CSV matches and operator timeouts. Uses deterministic operators.coreos.com/<package>.<namespace> label selectors instead. - Add startingCSV pinning to logic-operator.v1.37.2: Ensures the subscription installs the exact OSL version instead of whatever stable channel resolves to. - Add prepack lifecycle script: Ensures dist/ is built when the package is installed as a git dependency. Made-with: Cursor
1 parent e16ca2d commit 6da74af

3 files changed

Lines changed: 33 additions & 17 deletions

File tree

docs/changelog.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,15 @@
22

33
All notable changes to this project will be documented in this file.
44

5-
## [1.1.30] - Current
5+
## [1.1.31] - Current
6+
7+
### Fixed
8+
9+
- **Replace `check_operator_status` with OLM label-based `wait_for_operator`**: `spec.displayName` varies across channels/versions, causing empty CSV matches and operator timeouts. Uses deterministic `operators.coreos.com/<package>.<namespace>` label selectors instead.
10+
- **Add `startingCSV` pinning to `logic-operator.v1.37.2`**: Ensures the subscription installs the exact OSL version instead of whatever `stable` channel resolves to.
11+
- **Add `prepack` lifecycle script**: Ensures `dist/` is built when the package is installed as a git dependency (Yarn 3 packs from source, skipping gitignored `dist/`).
12+
13+
## [1.1.30]
614

715
### Fixed
816

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@red-hat-developer-hub/e2e-test-utils",
3-
"version": "1.1.30",
3+
"version": "1.1.31",
44
"description": "Test utilities for RHDH E2E tests",
55
"license": "Apache-2.0",
66
"repository": {

src/deployment/orchestrator/install-orchestrator.sh

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@ log::success() {
105105
# Operator subscription and status
106106
# ---------------------------------------------------------------------------
107107
install_subscription() {
108-
local name=$1 namespace=$2 channel=$3 package=$4 source_name=$5 source_namespace=$6
109-
oc apply -f - << EOD
110-
apiVersion: operators.coreos.com/v1alpha1
108+
local name=$1 namespace=$2 channel=$3 package=$4 source_name=$5 source_namespace=$6 starting_csv=${7:-}
109+
local yaml
110+
yaml="apiVersion: operators.coreos.com/v1alpha1
111111
kind: Subscription
112112
metadata:
113113
name: $name
@@ -117,30 +117,38 @@ spec:
117117
installPlanApproval: Automatic
118118
name: $package
119119
source: $source_name
120-
sourceNamespace: $source_namespace
121-
EOD
120+
sourceNamespace: $source_namespace"
121+
if [[ -n "$starting_csv" ]]; then
122+
yaml+="
123+
startingCSV: $starting_csv"
124+
fi
125+
echo "$yaml" | oc apply -f -
122126
return 0
123127
}
124128

125-
check_operator_status() {
126-
local timeout=${1:-300} namespace=$2 operator_name=$3 expected_status=${4:-Succeeded}
127-
log::info "Checking operator '${operator_name}' in '${namespace}' (timeout ${timeout}s, expected: ${expected_status})"
129+
# Wait for an operator CSV to reach a status phase.
130+
# Uses OLM label selector (operators.coreos.com/<package>.<namespace>) which is
131+
# deterministic, unlike spec.displayName which varies across channels/versions.
132+
wait_for_operator() {
133+
local timeout=${1:-300} namespace=$2 package=$3 expected_status=${4:-Succeeded}
134+
local label="operators.coreos.com/${package}.${namespace}"
135+
log::info "Waiting for operator '${package}' in '${namespace}' (label=${label}, timeout ${timeout}s, expected: ${expected_status})"
128136
timeout "${timeout}" bash -c "
129137
while true; do
130-
CURRENT_PHASE=\$(oc get csv -n '${namespace}' -o jsonpath='{.items[?(@.spec.displayName==\"${operator_name}\")].status.phase}')
131-
echo \"[check_operator_status] Phase: \${CURRENT_PHASE}\" >&2
132-
[[ \"\${CURRENT_PHASE}\" == \"${expected_status}\" ]] && echo \"[check_operator_status] Operator reached ${expected_status}\" >&2 && break
138+
CURRENT_PHASE=\$(oc get csv -n '${namespace}' -l '${label}' -o jsonpath='{.items[0].status.phase}' 2>/dev/null)
139+
echo \"[wait_for_operator] Phase: \${CURRENT_PHASE}\" >&2
140+
[[ \"\${CURRENT_PHASE}\" == \"${expected_status}\" ]] && echo \"[wait_for_operator] Operator reached ${expected_status}\" >&2 && break
133141
sleep 10
134142
done
135-
" || { log::error "Operator did not reach ${expected_status} in time."; return 1; }
143+
" || { log::error "Operator '${package}' did not reach ${expected_status} in time."; return 1; }
136144
}
137145

138146
install_serverless_logic_ocp_operator() {
139-
install_subscription logic-operator openshift-operators stable logic-operator redhat-operators openshift-marketplace
147+
install_subscription logic-operator openshift-operators stable logic-operator redhat-operators openshift-marketplace logic-operator.v1.37.2
140148
return 0
141149
}
142150
waitfor_serverless_logic_ocp_operator() {
143-
check_operator_status 500 openshift-operators "Red Hat OpenShift Serverless Logic" Succeeded
151+
wait_for_operator 500 openshift-operators logic-operator Succeeded
144152
return 0
145153
}
146154

@@ -149,7 +157,7 @@ install_serverless_ocp_operator() {
149157
return 0
150158
}
151159
waitfor_serverless_ocp_operator() {
152-
check_operator_status 300 openshift-operators "Red Hat OpenShift Serverless" Succeeded
160+
wait_for_operator 300 openshift-operators serverless-operator Succeeded
153161
return 0
154162
}
155163

0 commit comments

Comments
 (0)