Skip to content

Commit

Permalink
fix ocp CI lane
Browse files Browse the repository at this point in the history
some time there is a registry push error so we just implement a retry

Signed-off-by: Sebastian Sch <[email protected]>
  • Loading branch information
SchSeba committed Jan 25, 2024
1 parent ede5182 commit a16a0d7
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions hack/run-e2e-conformance-virtual-ocp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,30 @@ internal_registry="image-registry.openshift-image-registry.svc:5000"
pass=$( jq .\"$internal_registry\".password registry-login.conf )
podman login -u serviceaccount -p ${pass:1:-1} $registry --tls-verify=false

podman push --tls-verify=false "${SRIOV_NETWORK_OPERATOR_IMAGE}"
MAX_RETRIES=20
DELAY_SECONDS=10
retry_push() {
local command="podman push --tls-verify=false $@"
local retries=0

until [ $retries -ge $MAX_RETRIES ]; do
$command && break
retries=$((retries+1))
echo "Command failed. Retrying... (Attempt $retries/$MAX_RETRIES)"
sleep $DELAY_SECONDS
done

if [ $retries -eq $MAX_RETRIES ]; then
echo "Max retries reached. Exiting..."
exit 1
fi
}

retry_push "${SRIOV_NETWORK_OPERATOR_IMAGE}"
podman rmi -fi ${SRIOV_NETWORK_OPERATOR_IMAGE}
podman push --tls-verify=false "${SRIOV_NETWORK_CONFIG_DAEMON_IMAGE}"
retry_push "${SRIOV_NETWORK_CONFIG_DAEMON_IMAGE}"
podman rmi -fi ${SRIOV_NETWORK_CONFIG_DAEMON_IMAGE}
podman push --tls-verify=false "${SRIOV_NETWORK_WEBHOOK_IMAGE}"
retry_push "${SRIOV_NETWORK_WEBHOOK_IMAGE}"
podman rmi -fi ${SRIOV_NETWORK_WEBHOOK_IMAGE}

podman logout $registry
Expand Down

0 comments on commit a16a0d7

Please sign in to comment.