Skip to content

Commit b400b25

Browse files
Merge pull request #27 from cloud-native-toolkit/dls-reorder-cp4d
Add container registry checker
2 parents 013b28a + e923203 commit b400b25

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

9.0.x/pipeline.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,34 @@ spec:
163163
# get and echo the pipeline the mas installer created
164164
oc patch configmap/pipeline-output -p '{"data":{"Status":"Deployment Pipeline completed to install mas core."}}'
165165
tasks:
166+
- name: check-container-registry
167+
params:
168+
- name: SCRIPT
169+
value: |
170+
status=$(oc get config -o jsonpath='{.items[0].status.conditions[?(@.type=="Available")].reason}')
171+
172+
TIMEOUT_SECONDS=300
173+
while [[ "$status" != "Ready" ]] && [[ $SECONDS -lt $TIMEOUT_SECONDS ]]; do
174+
echo "OpenShift Container Registry is not ready. Current status: $status"
175+
176+
# Apply the patch commands
177+
oc patch config.imageregistry.operator.openshift.io/cluster --type=merge -p '{"spec":{"storage":{"emptyDir":{}}}}'
178+
oc patch config.imageregistry.operator.openshift.io/cluster --type=merge -p '{"spec":{"managementState":"Managed"}}'
179+
180+
# Check status after a short delay to avoid overwhelming the server
181+
sleep 10
182+
183+
# Update status
184+
status=$(oc get config -o jsonpath='{.items[0].status.conditions[?(@.type=="Available")].reason}')
185+
done
186+
187+
if [[ "$status" == "Ready" ]]; then
188+
echo "OpenShift Container Registry is ready"
189+
exit 0
190+
else
191+
echo "OpenShift Container Registry failed to become ready after $TIMEOUT_SECONDS seconds." >&2
192+
exit 1
193+
fi
166194
- name: get-ibm-entitlement-key
167195
when:
168196
- input: "$(params.ibm-entitlement-key)"
@@ -316,6 +344,7 @@ spec:
316344
timeout: "12h"
317345
runAfter:
318346
- get-tls-certs
347+
- check-container-registry
319348
workspaces:
320349
- name: ws
321350
params:

0 commit comments

Comments
 (0)