Skip to content

Commit b98ff9d

Browse files
committed
.github/workflows: Fix the release quickstart.yaml GH action
Update the .github/workflows/quickstart.yml github action and replace the usage of `kubectl wait ...` with a function that waits until the various OLM component deployment resources are present and reporting an available status. Using `kubectl wait ...` is potentially problematic as it doesn't support waiting until the creation of that resource, so in the case the PackageServer deployment doesn't exist yet as the catalog/olm operators are still being setup, this action will fail as `kubectl wait ...` will return a non-zero exit code. Signed-off-by: timflannagan <[email protected]>
1 parent 1e7e1cc commit b98ff9d

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

.github/workflows/quickstart.yml

+21-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,24 @@ jobs:
2020
kubectl apply -f deploy/upstream/quickstart/crds.yaml
2121
kubectl wait --timeout=5m --for=condition=Established crd $(kubectl get crd --output=jsonpath='{.items[*].metadata.name}')
2222
kubectl apply -f deploy/upstream/quickstart/olm.yaml
23-
kubectl wait --timeout=5m --for=condition=Available -n olm deploy olm-operator catalog-operator packageserver
23+
24+
# Note(tflannag): `kubectl wait` does not support waiting for resource creation: https://github.com/kubernetes/kubernetes/pull/87399.
25+
wait_for_deployment() {
26+
local deployment_name=$1
27+
timeout=60
28+
i=1
29+
echo "Checking if the ${deployment_name} deployment is ready"
30+
until kubectl -n olm get deployment ${deployment_name} -o jsonpath='{.status.conditions[?(@.status=="True")].type}' | grep "Available" 2>/dev/null; do
31+
((i++))
32+
if [[ ${i} -gt ${timeout} ]]; then
33+
echo "the ${deployment_name} deployment has not become ready before the timeout period"
34+
exit 1
35+
fi
36+
echo "waiting for ${deployment_name} deployment to report a ready status"
37+
sleep 5
38+
done
39+
echo "The ${deployment_name} deployment is ready"
40+
}
41+
wait_for_deployment catalog-operator
42+
wait_for_deployment olm-operator
43+
wait_for_deployment packageserver

0 commit comments

Comments
 (0)