Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 0 additions & 5 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@ jobs:

- uses: actions/checkout@v4

- name: Install skopeo
run: |
sudo apt-get update
sudo apt-get install -y skopeo

# this should avoid ERROR: failed to build: failed to read GITHUB_EVENT_PATH "/home/runner/work/_temp/_github_workflow/event.json"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
Expand Down
17 changes: 12 additions & 5 deletions Makefile.core.mk
Original file line number Diff line number Diff line change
Expand Up @@ -318,17 +318,24 @@ endif
docker-buildx: build-all ## Build and push docker image with cross-platform support.
ifeq ($(PREVENT_IMAGE_OVERWRITE),true)
@echo "Checking if image ${IMAGE} already exists..."
@if command -v skopeo >/dev/null 2>&1; then \
if skopeo inspect docker://${IMAGE} >/dev/null 2>&1; then \
@if command -v crane >/dev/null 2>&1; then \
set +e; \
OUTPUT=$$(crane manifest ${IMAGE} 2>&1); \
EXIT_CODE=$$?; \
set -e; \
if echo "$$OUTPUT" | grep -q "MANIFEST_UNKNOWN"; then \
echo "Image tag ${IMAGE} does not exist. Proceeding with build and push."; \
elif [ $$EXIT_CODE -eq 0 ]; then \
echo "ERROR: Image tag ${IMAGE} already exists in the registry!"; \
echo "Please ensure you are releasing a new version."; \
exit 1; \
else \
echo "Image tag ${IMAGE} does not exist. Proceeding with build and push."; \
echo "ERROR: Failed to check if image exists: $$OUTPUT"; \
exit 1; \
fi; \
else \
echo "ERROR: skopeo is not installed. Cannot verify if image already exists."; \
echo "Install skopeo or set PREVENT_IMAGE_OVERWRITE=false to skip this check."; \
echo "ERROR: crane is not installed. Cannot verify if image already exists."; \
echo "Install crane or set PREVENT_IMAGE_OVERWRITE=false to skip this check."; \
exit 1; \
fi
endif
Expand Down
Loading