Skip to content

Commit

Permalink
fix: push images properly (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
deansheather authored Aug 29, 2023
1 parent 576cd8e commit 3bccbf9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 19 deletions.
18 changes: 1 addition & 17 deletions .github/workflows/enterprise-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,27 +79,11 @@ jobs:
make -j \
enterprise/build/exectrace_"$version"_linux_{amd64,arm64,armv7}.tag.pushed
# Tag as latest and push
for arch in amd64 arm64 armv7; do
versioned_tag=$(cat enterprise/build/exectrace_"$version"_linux_"$arch".tag)
latest_tag=$(./enterprise/scripts/image_tag.sh --arch "$arch" --version latest)
docker tag "$versioned_tag" "$latest_tag"
docker push "$latest_tag"
done
- name: Build and push multi-arch Docker image
if: ${{ !github.event.inputs.snapshot && !github.event.inputs.dry_run }}
run: |
set -euxo pipefail
version=$(./ci/scripts/version.sh)
make -j \
enterprise/build/exectrace_"$version"_linux.tag.pushed
# Tag as latest and push
versioned_tag=$(cat enterprise/build/exectrace_"$version"_linux.tag)
latest_tag=$(./enterprise/scripts/image_tag.sh --version latest)
docker tag "$versioned_tag" "$latest_tag"
docker push "$latest_tag"
enterprise/build/exectrace_{"$version",latest}_linux.tag.pushed
15 changes: 13 additions & 2 deletions Makefile.enterprise
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ IMAGES_VERSIONLESS := $(foreach arch, $(ARCHES), $(ENTERPRISE_BUILD)/exectrace
MAIN_IMAGE := $(ENTERPRISE_BUILD)/exectrace_$(VERSION)_linux.tag
MAIN_IMAGE_PUSHED := $(MAIN_IMAGE).pushed

MAIN_IMAGE_LATEST := $(ENTERPRISE_BUILD)/exectrace_latest_linux.tag
MAIN_IMAGE_LATEST_PUSHED := $(MAIN_IMAGE_LATEST).pushed

.PHONY: clean-enterprise
clean-enterprise:
rm -rf "$(ENTERPRISE_BUILD)"
Expand Down Expand Up @@ -85,8 +88,12 @@ $(IMAGES_PUSHED): $(ENTERPRISE_BUILD)/exectrace_$(VERSION)_linux_%.tag.pushed: $

# Creating a docker manifest requires the images to be pushed, so this job
# depends on IMAGES_PUSHED instead of IMAGES.
$(MAIN_IMAGE): $(IMAGES_PUSHED)
image_tag="$$(./enterprise/scripts/image_tag.sh --version "$(VERSION)")"
$(MAIN_IMAGE) $(MAIN_IMAGE_LATEST): $(IMAGES_PUSHED)
version="$(VERSION)"
if [[ "$@" == "$(MAIN_IMAGE_LATEST)" ]]; then
version="latest"
fi
image_tag="$$(./enterprise/scripts/image_tag.sh --version "$${version}")"
docker manifest create \
"$${image_tag}" \
$(foreach image, $(IMAGES), "$$(cat "$(image)")")
Expand All @@ -96,3 +103,7 @@ $(MAIN_IMAGE): $(IMAGES_PUSHED)
$(MAIN_IMAGE_PUSHED): $(MAIN_IMAGE)
docker manifest push "$$(cat "$<")"
cat "$<" > "$@"

$(MAIN_IMAGE_LATEST_PUSHED): $(MAIN_IMAGE_LATEST)
docker manifest push "$$(cat "$<")"
cat "$<" > "$@"

0 comments on commit 3bccbf9

Please sign in to comment.