Skip to content

Wait for docker build #6013

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Dec 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions .github/actions/calculate-docker-image/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ runs:
DOCKER_IMAGE: ${{ steps.calculate-image.outputs.docker-image }}
DOCKER_TAG: ${{ steps.calculate-image.outputs.docker-tag }}
DOCKER_REGISTRY: ${{ inputs.docker-registry }}
DOCKER_PUSH: ${{ inputs.push }}
run: |
set +e
set -x
Expand All @@ -101,10 +102,25 @@ runs:
retry login "${DOCKER_REGISTRY}"
# Check if image already exists, if it does then skip building it
if docker manifest inspect "${DOCKER_IMAGE}"; then
exit 0
fi
START_TIME=$(date +%s)
# Wait up to 90 minutes
while [[ $(( $(date +%s) - 5400 )) -lt $START_TIME ]]; do
# Check if image already exists, if it does then skip building it
if docker manifest inspect "${DOCKER_IMAGE}"; then
exit 0
fi
# NB: This flag is used by Docker build workflow to push the image to ECR, so we can
# use this to differentiate between the Docker build and regular build jobs. For the
# latter, it will wait for the Docker images to become available before continuing
if [ "${DOCKER_PUSH:-false}" == "true" ]; then
# It's a Docker build job, let's build the image
break
else
# It's a regular build job, wait for the image to become available
sleep 300
fi
done
# NB: This part requires a full checkout. Otherwise, the merge base will
# be empty. The default action would be to continue rebuild the image
Expand Down
Loading