Skip to content

Commit

Permalink
.github/workflows: Fix the release quickstart.yaml GH action
Browse files Browse the repository at this point in the history
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 <timflannagan@gmail.com>
  • Loading branch information
timflannagan committed Jul 20, 2021
1 parent 1e7e1cc commit b98ff9d
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion .github/workflows/quickstart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,24 @@ jobs:
kubectl apply -f deploy/upstream/quickstart/crds.yaml
kubectl wait --timeout=5m --for=condition=Established crd $(kubectl get crd --output=jsonpath='{.items[*].metadata.name}')
kubectl apply -f deploy/upstream/quickstart/olm.yaml
kubectl wait --timeout=5m --for=condition=Available -n olm deploy olm-operator catalog-operator packageserver
# Note(tflannag): `kubectl wait` does not support waiting for resource creation: https://github.com/kubernetes/kubernetes/pull/87399.
wait_for_deployment() {
local deployment_name=$1
timeout=60
i=1
echo "Checking if the ${deployment_name} deployment is ready"
until kubectl -n olm get deployment ${deployment_name} -o jsonpath='{.status.conditions[?(@.status=="True")].type}' | grep "Available" 2>/dev/null; do
((i++))
if [[ ${i} -gt ${timeout} ]]; then
echo "the ${deployment_name} deployment has not become ready before the timeout period"
exit 1
fi
echo "waiting for ${deployment_name} deployment to report a ready status"
sleep 5
done
echo "The ${deployment_name} deployment is ready"
}
wait_for_deployment catalog-operator
wait_for_deployment olm-operator
wait_for_deployment packageserver

0 comments on commit b98ff9d

Please sign in to comment.