From 76102fe5c979db1abf52cf0fdafd612066562e45 Mon Sep 17 00:00:00 2001 From: mickkael <19755421+mickkael@users.noreply.github.com> Date: Thu, 13 May 2021 10:32:19 +0800 Subject: [PATCH 01/14] Dockerfile compatible with all Architecture builds Signed-off-by: mickkael <19755421+mickkael@users.noreply.github.com> --- Dockerfile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9e5721f6e7..ac9115bfbd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,19 @@ +ARG ARCH=amd64 #################################################################################################### # base #################################################################################################### FROM alpine:3.12.3 as base +ARG ARCH RUN apk update && apk upgrade && \ apk add ca-certificates && \ apk --no-cache add tzdata ENV ARGO_VERSION=v3.0.2 -RUN wget -q https://github.com/argoproj/argo/releases/download/${ARGO_VERSION}/argo-linux-amd64.gz -RUN gunzip argo-linux-amd64.gz -RUN chmod +x argo-linux-amd64 -RUN mv ./argo-linux-amd64 /usr/local/bin/argo +RUN wget -q https://github.com/argoproj/argo/releases/download/${ARGO_VERSION}/argo-linux-${ARCH}.gz +RUN gunzip argo-linux-${ARCH}.gz +RUN chmod +x argo-linux-${ARCH} +RUN mv ./argo-linux-${ARCH} /usr/local/bin/argo RUN argo version #################################################################################################### From 5170f392e4ed5b4850de626d29db4c0f7cbd2a18 Mon Sep 17 00:00:00 2001 From: mickkael <19755421+mickkael@users.noreply.github.com> Date: Mon, 17 May 2021 23:05:54 +0800 Subject: [PATCH 02/14] release workflow multi-arch Signed-off-by: mickkael <19755421+mickkael@users.noreply.github.com> --- .github/workflows/release.yml | 163 +++++++++++++++++++++++++++++++--- Dockerfile | 4 +- Makefile | 21 +++-- 3 files changed, 171 insertions(+), 17 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e098dd84b0..c4522c7da0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,9 +7,14 @@ on: branches: - master +defaults: + run: + shell: bash + jobs: - release: - runs-on: ubuntu-latest + build-binaries: + runs-on: ubuntu-20.04 + name: Build binaries steps: - name: Checkout uses: actions/checkout@v2 @@ -23,29 +28,167 @@ jobs: run: | make build chmod -R +x dist - zip -r release.zip dist + - name: Make checksums + run: make checksums + - name: store artifacts + uses: actions/upload-artifact@v2 + with: + name: binaries + path: dist - - name: Release binaries - uses: softprops/action-gh-release@v1 - if: startsWith(github.ref, 'refs/tags/') + build-push-linux-arm64: + name: Build & push linux/arm64 + needs: [ build-binaries ] + runs-on: ubuntu-20.04 + strategy: + matrix: + platform: [ linux/arm64 ] + target: [ argo-events ] + steps: + - uses: actions/checkout@v2 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + with: + platforms: arm64 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Download binaries + uses: actions/download-artifact@v2 with: - files: release.zip + name: binaries + path: dist/ + + - name: Docker Login + uses: docker/login-action@v1 + with: + registry: quay.io + username: ${{ secrets.QUAYIO_USERNAME }} + password: ${{ secrets.QUAYIO_PASSWORD }} + + - name: Docker Buildx env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + QUAYIO_ORG: ${{ secrets.QUAYIO_ORG }} + PLATFORM: ${{ matrix.platform }} + TARGET: ${{ matrix.target }} + run: | + tag=$(basename $GITHUB_REF) + if [ $tag = "master" ]; then + tag="latest" + fi + + tag_suffix=$(echo $PLATFORM | sed -r "s/\//-/g") + image_name="${QUAYIO_ORG}/${TARGET}:${tag}-${tag_suffix}" + + docker buildx build \ + --output "type=image,push=true" \ + --platform="${PLATFORM}" \ + --build-arg "ARCH=arm64" \ + --target $TARGET \ + --tag quay.io/$image_name . + + build-push-linux-amd64: + name: Build & push linux/amd64 + needs: [ build-binaries ] + runs-on: ubuntu-20.04 + strategy: + matrix: + platform: [ linux/amd64 ] + target: [ argo-events ] + steps: + - uses: actions/checkout@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Download binaries + uses: actions/download-artifact@v2 + with: + name: binaries + path: dist/ - name: Docker Login + uses: docker/login-action@v1 + with: + registry: quay.io + username: ${{ secrets.QUAYIO_USERNAME }} + password: ${{ secrets.QUAYIO_PASSWORD }} + + - name: Docker Buildx + env: + QUAYIO_ORG: ${{ secrets.QUAYIO_ORG }} + PLATFORM: ${{ matrix.platform }} + TARGET: ${{ matrix.target }} + run: | + tag=$(basename $GITHUB_REF) + if [ $tag = "master" ]; then + tag="latest" + fi + + tag_suffix=$(echo $PLATFORM | sed -r "s/\//-/g") + image_name="${QUAYIO_ORG}/${TARGET}:${tag}-${tag_suffix}" + + docker buildx build \ + --output "type=image,push=true" \ + --platform="${PLATFORM}" \ + --build-arg "ARCH=amd64" \ + --target $TARGET \ + --tag quay.io/$image_name . + + push-images-multi-manifest: + name: Push manifest with all images + runs-on: ubuntu-20.04 + needs: [ build-push-linux-arm64, build-push-linux-amd64 ] + steps: + - uses: actions/checkout@v2 + + - name: Login to Quay uses: Azure/docker-login@v1 with: login-server: quay.io username: ${{ secrets.QUAYIO_USERNAME }} password: ${{ secrets.QUAYIO_PASSWORD }} - - name: Build & Push Linux Docker Images + - name: Push Multiarch Image env: QUAYIO_ORG: ${{ secrets.QUAYIO_ORG }} run: | + echo $(jq -c '. + { "experimental": "enabled" }' ${DOCKER_CONFIG}/config.json) > ${DOCKER_CONFIG}/config.json + + quay_org=$QUAYIO_ORG + tag=$(basename $GITHUB_REF) if [ $tag = "master" ]; then tag="latest" fi - make image IMAGE_TAG=${tag} IMAGE_NAMESPACE=${QUAYIO_ORG} DOCKER_PUSH=true + + targets="argo-events" + for target in $targets; do + image_name="${quay_org}/${target}:${tag}" + + docker manifest create quay.io/$image_name quay.io/${image_name}-linux-arm64 quay.io/${image_name}-linux-amd64 + + docker manifest push quay.io/$image_name + done + + release: + runs-on: ubuntu-latest + needs: [ push-images-multi-manifest ] + steps: + - name: Download binaries + uses: actions/download-artifact@v2 + with: + name: binaries + path: dist/ + + - name: Release binaries + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: | + dist/*.gz + dist/*.gz.sha256 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/Dockerfile b/Dockerfile index ac9115bfbd..b597ab1a6a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,9 +20,9 @@ RUN argo version # argo-events #################################################################################################### FROM scratch as argo-events +ARG ARCH COPY --from=base /usr/share/zoneinfo /usr/share/zoneinfo COPY --from=base /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt COPY --from=base /usr/local/bin/argo /usr/local/bin/argo -COPY dist/argo-events /bin/argo-events +COPY dist/argo-events-linux-${ARCH} /bin/argo-events ENTRYPOINT [ "/bin/argo-events" ] - diff --git a/Makefile b/Makefile index 59121b93e7..307fc85590 100644 --- a/Makefile +++ b/Makefile @@ -39,11 +39,15 @@ endif # build .PHONY: build -build: dist/$(BINARY_NAME)-linux-amd64 +build: dist/$(BINARY_NAME)-linux-amd64.gz dist/$(BINARY_NAME)-linux-arm64.gz dist/$(BINARY_NAME)-linux-arm.gz dist/$(BINARY_NAME)-linux-ppc64le.gz dist/$(BINARY_NAME)-linux-s390x.gz + +dist/$(BINARY_NAME)-%.gz: dist/$(BINARY_NAME)-% + gzip --force --keep dist/$(BINARY_NAME)-$* dist/$(BINARY_NAME): GOARGS = GOOS= GOARCH= dist/$(BINARY_NAME)-linux-amd64: GOARGS = GOOS=linux GOARCH=amd64 dist/$(BINARY_NAME)-linux-arm64: GOARGS = GOOS=linux GOARCH=arm64 +dist/$(BINARY_NAME)-linux-arm: GOARGS = GOOS=linux GOARCH=arm dist/$(BINARY_NAME)-linux-ppc64le: GOARGS = GOOS=linux GOARCH=ppc64le dist/$(BINARY_NAME)-linux-s390x: GOARGS = GOOS=linux GOARCH=s390x @@ -51,12 +55,16 @@ dist/$(BINARY_NAME): go build -v -ldflags '${LDFLAGS}' -o ${DIST_DIR}/$(BINARY_NAME) ./cmd dist/$(BINARY_NAME)-%: - CGO_ENABLED=0 $(GOARGS) go build -v -ldflags '${LDFLAGS}' -o ${DIST_DIR}/$(BINARY_NAME) ./cmd + CGO_ENABLED=0 $(GOARGS) go build -v -ldflags '${LDFLAGS}' -o ${DIST_DIR}/$(BINARY_NAME)-$* ./cmd .PHONY: build -image: dist/$(BINARY_NAME)-linux-amd64 - DOCKER_BUILDKIT=1 docker build -t $(IMAGE_NAMESPACE)/$(BINARY_NAME):$(VERSION) --target argo-events -f $(DOCKERFILE) . - @if [ "$(DOCKER_PUSH)" = "true" ]; then docker push $(IMAGE_NAMESPACE)/$(BINARY_NAME):$(VERSION); fi +image: image-linux-amd64 +image-linux-amd64: dist/$(BINARY_NAME)-linux-amd64 + DOCKER_BUILDKIT=1 docker build -t $(IMAGE_NAMESPACE)/$(BINARY_NAME):$(VERSION)-linux-amd64 --target $(BINARY_NAME) -f $(DOCKERFILE) . + @if [ "$(DOCKER_PUSH)" = "true" ]; then docker push $(IMAGE_NAMESPACE)/$(BINARY_NAME):$(VERSION)-linux-amd64; fi +image-linux-arm64: dist/$(BINARY_NAME)-linux-arm64 + DOCKER_BUILDKIT=1 docker build -t $(IMAGE_NAMESPACE)/$(BINARY_NAME):$(VERSION)-linux-arm64 --target $(BINARY_NAME) -f $(DOCKERFILE) . + @if [ "$(DOCKER_PUSH)" = "true" ]; then docker push $(IMAGE_NAMESPACE)/$(BINARY_NAME):$(VERSION)-linux-arm64; fi test: go test $(shell go list ./... | grep -v /vendor/ | grep -v /test/e2e/) -race -short -v @@ -149,3 +157,6 @@ update-manifests-version: cat Makefile | sed 's/^VERSION?=.*/VERSION?=$(VERSION)/' | sed 's/^BASE_VERSION:=.*/BASE_VERSION:=$(VERSION)/' > /tmp/ae_makefile mv /tmp/ae_makefile Makefile +.PHONY: checksums +checksums: + for f in ./dist/$(BINARY_NAME)-*.gz; do openssl dgst -sha256 "$$f" | awk ' { print $$2 }' > "$$f".sha256 ; done From 550ecad29db5b4808e3071d6f1e6973efa2a6045 Mon Sep 17 00:00:00 2001 From: mickkael <19755421+mickkael@users.noreply.github.com> Date: Tue, 18 May 2021 17:39:08 +0800 Subject: [PATCH 03/14] fix image command in makefile Signed-off-by: mickkael <19755421+mickkael@users.noreply.github.com> --- Makefile | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 307fc85590..95e60ccc05 100644 --- a/Makefile +++ b/Makefile @@ -58,12 +58,20 @@ dist/$(BINARY_NAME)-%: CGO_ENABLED=0 $(GOARGS) go build -v -ldflags '${LDFLAGS}' -o ${DIST_DIR}/$(BINARY_NAME)-$* ./cmd .PHONY: build -image: image-linux-amd64 +image: dist/$(BINARY_NAME)-linux-amd64 + DOCKER_BUILDKIT=1 docker build -t $(IMAGE_NAMESPACE)/$(BINARY_NAME):$(VERSION) --target $(BINARY_NAME) -f $(DOCKERFILE) . + @if [ "$(DOCKER_PUSH)" = "true" ]; then docker push $(IMAGE_NAMESPACE)/$(BINARY_NAME):$(VERSION); fi + +## the command "argo version" has to be removed from dockerfile for this to work +image-linux-multi: image-linux-amd64 image-linux-arm64 + echo $(jq -c '. + { "experimental": "enabled" }' ${HOME}/.docker/config.json) > ${HOME}/.docker/config.json + docker manifest create $(IMAGE_NAMESPACE)/$(BINARY_NAME):$(VERSION) $(IMAGE_NAMESPACE)/$(BINARY_NAME):$(VERSION)-linux-arm64 $(IMAGE_NAMESPACE)/$(BINARY_NAME):$(VERSION)-linux-amd64 + @if [ "$(DOCKER_PUSH)" = "true" ]; then docker manifest push $(IMAGE_NAMESPACE)/$(BINARY_NAME):$(VERSION); fi image-linux-amd64: dist/$(BINARY_NAME)-linux-amd64 DOCKER_BUILDKIT=1 docker build -t $(IMAGE_NAMESPACE)/$(BINARY_NAME):$(VERSION)-linux-amd64 --target $(BINARY_NAME) -f $(DOCKERFILE) . @if [ "$(DOCKER_PUSH)" = "true" ]; then docker push $(IMAGE_NAMESPACE)/$(BINARY_NAME):$(VERSION)-linux-amd64; fi image-linux-arm64: dist/$(BINARY_NAME)-linux-arm64 - DOCKER_BUILDKIT=1 docker build -t $(IMAGE_NAMESPACE)/$(BINARY_NAME):$(VERSION)-linux-arm64 --target $(BINARY_NAME) -f $(DOCKERFILE) . + DOCKER_BUILDKIT=1 docker build --build-arg "ARCH=arm64" -t $(IMAGE_NAMESPACE)/$(BINARY_NAME):$(VERSION)-linux-arm64 --target $(BINARY_NAME) -f $(DOCKERFILE) . @if [ "$(DOCKER_PUSH)" = "true" ]; then docker push $(IMAGE_NAMESPACE)/$(BINARY_NAME):$(VERSION)-linux-arm64; fi test: From a7ca361ca81a3c2817c6bf1b5528ec5dce5d845b Mon Sep 17 00:00:00 2001 From: mickkael <19755421+mickkael@users.noreply.github.com> Date: Wed, 26 May 2021 22:20:51 +0800 Subject: [PATCH 04/14] Simplify code Signed-off-by: mickkael <19755421+mickkael@users.noreply.github.com> --- .github/workflows/release.yml | 117 ++++++---------------------------- Dockerfile | 3 +- Makefile | 16 ++--- 3 files changed, 25 insertions(+), 111 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c4522c7da0..03440fccfc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -36,13 +36,12 @@ jobs: name: binaries path: dist - build-push-linux-arm64: - name: Build & push linux/arm64 + build-push-linux-multi: + name: Build & push linux/amd64 and linux/arm64 needs: [ build-binaries ] runs-on: ubuntu-20.04 strategy: matrix: - platform: [ linux/arm64 ] target: [ argo-events ] steps: - uses: actions/checkout@v2 @@ -50,8 +49,8 @@ jobs: - name: Set up QEMU uses: docker/setup-qemu-action@v1 with: - platforms: arm64 - + platforms: amd64,arm64 + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 @@ -61,121 +60,41 @@ jobs: name: binaries path: dist/ - - name: Docker Login + - name: Registry Login uses: docker/login-action@v1 with: registry: quay.io username: ${{ secrets.QUAYIO_USERNAME }} password: ${{ secrets.QUAYIO_PASSWORD }} - - name: Docker Buildx + - name: set tag csv value + id: tag env: QUAYIO_ORG: ${{ secrets.QUAYIO_ORG }} - PLATFORM: ${{ matrix.platform }} TARGET: ${{ matrix.target }} run: | tag=$(basename $GITHUB_REF) if [ $tag = "master" ]; then tag="latest" fi + image_name="${QUAYIO_ORG}/${TARGET}:${tag}" + echo "::set-output name=TAG_LIST::$image_name" - tag_suffix=$(echo $PLATFORM | sed -r "s/\//-/g") - image_name="${QUAYIO_ORG}/${TARGET}:${tag}-${tag_suffix}" - - docker buildx build \ - --output "type=image,push=true" \ - --platform="${PLATFORM}" \ - --build-arg "ARCH=arm64" \ - --target $TARGET \ - --tag quay.io/$image_name . - - build-push-linux-amd64: - name: Build & push linux/amd64 - needs: [ build-binaries ] - runs-on: ubuntu-20.04 - strategy: - matrix: - platform: [ linux/amd64 ] - target: [ argo-events ] - steps: - - uses: actions/checkout@v2 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - - name: Download binaries - uses: actions/download-artifact@v2 - with: - name: binaries - path: dist/ - - - name: Docker Login - uses: docker/login-action@v1 - with: - registry: quay.io - username: ${{ secrets.QUAYIO_USERNAME }} - password: ${{ secrets.QUAYIO_PASSWORD }} - - - name: Docker Buildx + - name: Container build and push + uses: docker/build-push-action@v2 env: QUAYIO_ORG: ${{ secrets.QUAYIO_ORG }} - PLATFORM: ${{ matrix.platform }} - TARGET: ${{ matrix.target }} - run: | - tag=$(basename $GITHUB_REF) - if [ $tag = "master" ]; then - tag="latest" - fi - - tag_suffix=$(echo $PLATFORM | sed -r "s/\//-/g") - image_name="${QUAYIO_ORG}/${TARGET}:${tag}-${tag_suffix}" - - docker buildx build \ - --output "type=image,push=true" \ - --platform="${PLATFORM}" \ - --build-arg "ARCH=amd64" \ - --target $TARGET \ - --tag quay.io/$image_name . - - push-images-multi-manifest: - name: Push manifest with all images - runs-on: ubuntu-20.04 - needs: [ build-push-linux-arm64, build-push-linux-amd64 ] - steps: - - uses: actions/checkout@v2 - - - name: Login to Quay - uses: Azure/docker-login@v1 with: - login-server: quay.io - username: ${{ secrets.QUAYIO_USERNAME }} - password: ${{ secrets.QUAYIO_PASSWORD }} - - - name: Push Multiarch Image - env: - QUAYIO_ORG: ${{ secrets.QUAYIO_ORG }} - run: | - echo $(jq -c '. + { "experimental": "enabled" }' ${DOCKER_CONFIG}/config.json) > ${DOCKER_CONFIG}/config.json - - quay_org=$QUAYIO_ORG - - tag=$(basename $GITHUB_REF) - if [ $tag = "master" ]; then - tag="latest" - fi - - targets="argo-events" - for target in $targets; do - image_name="${quay_org}/${target}:${tag}" - - docker manifest create quay.io/$image_name quay.io/${image_name}-linux-arm64 quay.io/${image_name}-linux-amd64 - - docker manifest push quay.io/$image_name - done + context: . + file: ./Dockerfile + platforms: linux/amd64,linux/arm64 + push: "true" + tags: ${{ steps.tag.outputs.TAG_LIST }} + target: ${{ matrix.target }} release: runs-on: ubuntu-latest - needs: [ push-images-multi-manifest ] + needs: [ build-push-linux-multi ] steps: - name: Download binaries uses: actions/download-artifact@v2 diff --git a/Dockerfile b/Dockerfile index b597ab1a6a..d641c4823f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -ARG ARCH=amd64 +ARG ARCH=$TARGETARCH #################################################################################################### # base #################################################################################################### @@ -14,7 +14,6 @@ RUN wget -q https://github.com/argoproj/argo/releases/download/${ARGO_VERSION}/a RUN gunzip argo-linux-${ARCH}.gz RUN chmod +x argo-linux-${ARCH} RUN mv ./argo-linux-${ARCH} /usr/local/bin/argo -RUN argo version #################################################################################################### # argo-events diff --git a/Makefile b/Makefile index 95e60ccc05..483a2704b3 100644 --- a/Makefile +++ b/Makefile @@ -62,17 +62,13 @@ image: dist/$(BINARY_NAME)-linux-amd64 DOCKER_BUILDKIT=1 docker build -t $(IMAGE_NAMESPACE)/$(BINARY_NAME):$(VERSION) --target $(BINARY_NAME) -f $(DOCKERFILE) . @if [ "$(DOCKER_PUSH)" = "true" ]; then docker push $(IMAGE_NAMESPACE)/$(BINARY_NAME):$(VERSION); fi -## the command "argo version" has to be removed from dockerfile for this to work -image-linux-multi: image-linux-amd64 image-linux-arm64 - echo $(jq -c '. + { "experimental": "enabled" }' ${HOME}/.docker/config.json) > ${HOME}/.docker/config.json - docker manifest create $(IMAGE_NAMESPACE)/$(BINARY_NAME):$(VERSION) $(IMAGE_NAMESPACE)/$(BINARY_NAME):$(VERSION)-linux-arm64 $(IMAGE_NAMESPACE)/$(BINARY_NAME):$(VERSION)-linux-amd64 +image-linux-%: dist/$(BINARY_NAME)-linux-$* + DOCKER_BUILDKIT=1 docker build --build-arg "ARCH=$*" -t $(IMAGE_NAMESPACE)/$(BINARY_NAME):$(VERSION)-linux-$* --platform "linux/$*" --target $(BINARY_NAME) -f $(DOCKERFILE) . + @if [ "$(DOCKER_PUSH)" = "true" ]; then docker push $(IMAGE_NAMESPACE)/$(BINARY_NAME):$(VERSION)-linux-$*; fi + +image-multi: image-linux-amd64 image-linux-arm64 + DOCKER_CLI_EXPERIMENTAL=enabled docker manifest create $(IMAGE_NAMESPACE)/$(BINARY_NAME):$(VERSION) $(IMAGE_NAMESPACE)/$(BINARY_NAME):$(VERSION)-linux-arm64 $(IMAGE_NAMESPACE)/$(BINARY_NAME):$(VERSION)-linux-amd64 @if [ "$(DOCKER_PUSH)" = "true" ]; then docker manifest push $(IMAGE_NAMESPACE)/$(BINARY_NAME):$(VERSION); fi -image-linux-amd64: dist/$(BINARY_NAME)-linux-amd64 - DOCKER_BUILDKIT=1 docker build -t $(IMAGE_NAMESPACE)/$(BINARY_NAME):$(VERSION)-linux-amd64 --target $(BINARY_NAME) -f $(DOCKERFILE) . - @if [ "$(DOCKER_PUSH)" = "true" ]; then docker push $(IMAGE_NAMESPACE)/$(BINARY_NAME):$(VERSION)-linux-amd64; fi -image-linux-arm64: dist/$(BINARY_NAME)-linux-arm64 - DOCKER_BUILDKIT=1 docker build --build-arg "ARCH=arm64" -t $(IMAGE_NAMESPACE)/$(BINARY_NAME):$(VERSION)-linux-arm64 --target $(BINARY_NAME) -f $(DOCKERFILE) . - @if [ "$(DOCKER_PUSH)" = "true" ]; then docker push $(IMAGE_NAMESPACE)/$(BINARY_NAME):$(VERSION)-linux-arm64; fi test: go test $(shell go list ./... | grep -v /vendor/ | grep -v /test/e2e/) -race -short -v From 5a2d79bcfd1c42af800483e07a588c6a13ca3d98 Mon Sep 17 00:00:00 2001 From: mickkael <19755421+mickkael@users.noreply.github.com> Date: Thu, 27 May 2021 10:16:15 +0800 Subject: [PATCH 05/14] with DOCKER_PUSH to true Signed-off-by: mickkael <19755421+mickkael@users.noreply.github.com> --- .github/workflows/release.yml | 57 +++++++++++++++++++++-------------- Makefile | 11 +++++-- 2 files changed, 42 insertions(+), 26 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 03440fccfc..5ee38f9faa 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -46,10 +46,10 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - with: - platforms: amd64,arm64 +# - name: Set up QEMU +# uses: docker/setup-qemu-action@v1 +# with: +# platforms: amd64,arm64 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 @@ -66,31 +66,42 @@ jobs: registry: quay.io username: ${{ secrets.QUAYIO_USERNAME }} password: ${{ secrets.QUAYIO_PASSWORD }} - - - name: set tag csv value - id: tag - env: - QUAYIO_ORG: ${{ secrets.QUAYIO_ORG }} - TARGET: ${{ matrix.target }} + + - name: set Version + id: version run: | tag=$(basename $GITHUB_REF) if [ $tag = "master" ]; then tag="latest" fi - image_name="${QUAYIO_ORG}/${TARGET}:${tag}" - echo "::set-output name=TAG_LIST::$image_name" + echo "::set-output name=VERSION::$tag" - - name: Container build and push - uses: docker/build-push-action@v2 - env: - QUAYIO_ORG: ${{ secrets.QUAYIO_ORG }} - with: - context: . - file: ./Dockerfile - platforms: linux/amd64,linux/arm64 - push: "true" - tags: ${{ steps.tag.outputs.TAG_LIST }} - target: ${{ matrix.target }} + - name: Container build and push with arm64/amd64 + run: | + VERSION=${{ steps.version.outputs.VERSION }} DO_BUILD=false DOCKER_PUSH=true make image-multi + +# - name: set tag csv value +# id: tag +# env: +# QUAYIO_ORG: ${{ secrets.QUAYIO_ORG }} +# TARGET: ${{ matrix.target }} +# run: | +# tag=$(basename $GITHUB_REF) +# if [ $tag = "master" ]; then +# tag="latest" +# fi +# image_name="quay.io/${QUAYIO_ORG}/${TARGET}:${tag}" +# echo "::set-output name=TAG_LIST::$image_name" +# +# - name: Container build and push +# uses: docker/build-push-action@v2 +# with: +# context: . +# file: ./Dockerfile +# platforms: linux/amd64,linux/arm64 +# push: "true" +# tags: ${{ steps.tag.outputs.TAG_LIST }} +# target: ${{ matrix.target }} release: runs-on: ubuntu-latest diff --git a/Makefile b/Makefile index 483a2704b3..f240b5ec31 100644 --- a/Makefile +++ b/Makefile @@ -17,6 +17,7 @@ DOCKER_PUSH?=false IMAGE_NAMESPACE?=quay.io/argoproj VERSION?=latest BASE_VERSION:=latest +DO_BUILD?=true override LDFLAGS += \ -X ${PACKAGE}.version=${VERSION} \ @@ -25,6 +26,7 @@ override LDFLAGS += \ -X ${PACKAGE}.gitTreeState=${GIT_TREE_STATE} ifeq (${DOCKER_PUSH},true) +PUSH_OPTION="--push" ifndef IMAGE_NAMESPACE $(error IMAGE_NAMESPACE must be set to push images (e.g. IMAGE_NAMESPACE=quay.io/argoproj)) endif @@ -66,9 +68,12 @@ image-linux-%: dist/$(BINARY_NAME)-linux-$* DOCKER_BUILDKIT=1 docker build --build-arg "ARCH=$*" -t $(IMAGE_NAMESPACE)/$(BINARY_NAME):$(VERSION)-linux-$* --platform "linux/$*" --target $(BINARY_NAME) -f $(DOCKERFILE) . @if [ "$(DOCKER_PUSH)" = "true" ]; then docker push $(IMAGE_NAMESPACE)/$(BINARY_NAME):$(VERSION)-linux-$*; fi -image-multi: image-linux-amd64 image-linux-arm64 - DOCKER_CLI_EXPERIMENTAL=enabled docker manifest create $(IMAGE_NAMESPACE)/$(BINARY_NAME):$(VERSION) $(IMAGE_NAMESPACE)/$(BINARY_NAME):$(VERSION)-linux-arm64 $(IMAGE_NAMESPACE)/$(BINARY_NAME):$(VERSION)-linux-amd64 - @if [ "$(DOCKER_PUSH)" = "true" ]; then docker manifest push $(IMAGE_NAMESPACE)/$(BINARY_NAME):$(VERSION); fi +image-multi: set-qemu $(if $(DO_BUILD), dist/$(BINARY_NAME)-linux-arm64 dist/$(BINARY_NAME)-linux-amd64) + docker buildx build --tag $(IMAGE_NAMESPACE)/$(BINARY_NAME):$(VERSION) --target $(BINARY_NAME) --platform linux/amd64,linux/arm64 --file ./Dockerfile ${PUSH_OPTION} . + +set-qemu: + docker pull tonistiigi/binfmt:latest + docker run --rm --privileged tonistiigi/binfmt:latest --install amd64,arm64 test: go test $(shell go list ./... | grep -v /vendor/ | grep -v /test/e2e/) -race -short -v From 4a46d02e843bed684317461110d285d2d0d00cc4 Mon Sep 17 00:00:00 2001 From: mickkael <19755421+mickkael@users.noreply.github.com> Date: Sat, 29 May 2021 11:31:09 +0800 Subject: [PATCH 06/14] fix release wf for non argoproj namespace build Signed-off-by: mickkael <19755421+mickkael@users.noreply.github.com> --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5ee38f9faa..4db47d8325 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -78,7 +78,7 @@ jobs: - name: Container build and push with arm64/amd64 run: | - VERSION=${{ steps.version.outputs.VERSION }} DO_BUILD=false DOCKER_PUSH=true make image-multi + IMAGE_NAMESPACE=quay.io/${{ secrets.QUAYIO_USERNAME }} VERSION=${{ steps.version.outputs.VERSION }} DO_BUILD=false DOCKER_PUSH=true make image-multi # - name: set tag csv value # id: tag From 262bd8b926a4dfd7cf8f674197b68c75ece8c654 Mon Sep 17 00:00:00 2001 From: mickkael <19755421+mickkael@users.noreply.github.com> Date: Sat, 5 Jun 2021 12:32:45 +0800 Subject: [PATCH 07/14] clean up Signed-off-by: mickkael <19755421+mickkael@users.noreply.github.com> --- .github/workflows/release.yml | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4db47d8325..d01aa16794 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -45,11 +45,6 @@ jobs: target: [ argo-events ] steps: - uses: actions/checkout@v2 - -# - name: Set up QEMU -# uses: docker/setup-qemu-action@v1 -# with: -# platforms: amd64,arm64 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 @@ -79,29 +74,6 @@ jobs: - name: Container build and push with arm64/amd64 run: | IMAGE_NAMESPACE=quay.io/${{ secrets.QUAYIO_USERNAME }} VERSION=${{ steps.version.outputs.VERSION }} DO_BUILD=false DOCKER_PUSH=true make image-multi - -# - name: set tag csv value -# id: tag -# env: -# QUAYIO_ORG: ${{ secrets.QUAYIO_ORG }} -# TARGET: ${{ matrix.target }} -# run: | -# tag=$(basename $GITHUB_REF) -# if [ $tag = "master" ]; then -# tag="latest" -# fi -# image_name="quay.io/${QUAYIO_ORG}/${TARGET}:${tag}" -# echo "::set-output name=TAG_LIST::$image_name" -# -# - name: Container build and push -# uses: docker/build-push-action@v2 -# with: -# context: . -# file: ./Dockerfile -# platforms: linux/amd64,linux/arm64 -# push: "true" -# tags: ${{ steps.tag.outputs.TAG_LIST }} -# target: ${{ matrix.target }} release: runs-on: ubuntu-latest From a107c2298a098087942c4d805b63b7f461227625 Mon Sep 17 00:00:00 2001 From: mickkael <19755421+mickkael@users.noreply.github.com> Date: Wed, 9 Jun 2021 10:56:33 +0800 Subject: [PATCH 08/14] rem DO_BUILD add set-buildx Signed-off-by: mickkael <19755421+mickkael@users.noreply.github.com> --- Makefile | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index f240b5ec31..2e6bb0e1e2 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,7 @@ GIT_COMMIT=$(shell git rev-parse HEAD) GIT_BRANCH=$(shell git rev-parse --symbolic-full-name --verify --quiet --abbrev-ref HEAD) GIT_TAG=$(shell if [ -z "`git status --porcelain`" ]; then git describe --exact-match --tags HEAD 2>/dev/null; fi) GIT_TREE_STATE=$(shell if [ -z "`git status --porcelain`" ]; then echo "clean" ; else echo "dirty"; fi) +BUILDX_BINARY_URL="https://github.com/docker/buildx/releases/download/v0.5.1/buildx-v0.5.1.linux-amd64" # docker image publishing options DOCKER_PUSH?=false @@ -44,7 +45,7 @@ endif build: dist/$(BINARY_NAME)-linux-amd64.gz dist/$(BINARY_NAME)-linux-arm64.gz dist/$(BINARY_NAME)-linux-arm.gz dist/$(BINARY_NAME)-linux-ppc64le.gz dist/$(BINARY_NAME)-linux-s390x.gz dist/$(BINARY_NAME)-%.gz: dist/$(BINARY_NAME)-% - gzip --force --keep dist/$(BINARY_NAME)-$* + gzip -k dist/$(BINARY_NAME)-$* dist/$(BINARY_NAME): GOARGS = GOOS= GOARCH= dist/$(BINARY_NAME)-linux-amd64: GOARGS = GOOS=linux GOARCH=amd64 @@ -68,13 +69,22 @@ image-linux-%: dist/$(BINARY_NAME)-linux-$* DOCKER_BUILDKIT=1 docker build --build-arg "ARCH=$*" -t $(IMAGE_NAMESPACE)/$(BINARY_NAME):$(VERSION)-linux-$* --platform "linux/$*" --target $(BINARY_NAME) -f $(DOCKERFILE) . @if [ "$(DOCKER_PUSH)" = "true" ]; then docker push $(IMAGE_NAMESPACE)/$(BINARY_NAME):$(VERSION)-linux-$*; fi -image-multi: set-qemu $(if $(DO_BUILD), dist/$(BINARY_NAME)-linux-arm64 dist/$(BINARY_NAME)-linux-amd64) +image-multi: set-buildx set-qemu dist/$(BINARY_NAME)-linux-arm64.gz dist/$(BINARY_NAME)-linux-amd64.gz docker buildx build --tag $(IMAGE_NAMESPACE)/$(BINARY_NAME):$(VERSION) --target $(BINARY_NAME) --platform linux/amd64,linux/arm64 --file ./Dockerfile ${PUSH_OPTION} . set-qemu: docker pull tonistiigi/binfmt:latest docker run --rm --privileged tonistiigi/binfmt:latest --install amd64,arm64 +set-buildx: + curl --output docker-buildx --silent --show-error --location --fail --retry 3 "${BUILDX_BINARY_URL}" + mkdir -p ~/.docker/cli-plugins + mv docker-buildx ~/.docker/cli-plugins/ + chmod a+x ~/.docker/cli-plugins/docker-buildx + docker buildx install + docker buildx rm + docker buildx create --name mybuilder-argo-events --use + test: go test $(shell go list ./... | grep -v /vendor/ | grep -v /test/e2e/) -race -short -v From 2a87086814cd4baa13ec499a4864fb342e008001 Mon Sep 17 00:00:00 2001 From: mickkael <19755421+mickkael@users.noreply.github.com> Date: Wed, 9 Jun 2021 11:40:52 +0800 Subject: [PATCH 09/14] improve buildx to not reinstall and check exec Signed-off-by: mickkael <19755421+mickkael@users.noreply.github.com> --- Makefile | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 2e6bb0e1e2..652e2c9a65 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,7 @@ GIT_BRANCH=$(shell git rev-parse --symbolic-full-name --verify --quiet --abbrev- GIT_TAG=$(shell if [ -z "`git status --porcelain`" ]; then git describe --exact-match --tags HEAD 2>/dev/null; fi) GIT_TREE_STATE=$(shell if [ -z "`git status --porcelain`" ]; then echo "clean" ; else echo "dirty"; fi) BUILDX_BINARY_URL="https://github.com/docker/buildx/releases/download/v0.5.1/buildx-v0.5.1.linux-amd64" +EXECUTABLES = curl docker gzip go # docker image publishing options DOCKER_PUSH?=false @@ -38,6 +39,8 @@ VERSION=$(GIT_TAG) override LDFLAGS += -X ${PACKAGE}.gitTag=${GIT_TAG} endif +K := $(foreach exec,$(EXECUTABLES), $(if $(shell which $(exec)),some string,$(error "No $(exec) in PATH"))) + .PHONY: build image clean test # build @@ -77,13 +80,8 @@ set-qemu: docker run --rm --privileged tonistiigi/binfmt:latest --install amd64,arm64 set-buildx: - curl --output docker-buildx --silent --show-error --location --fail --retry 3 "${BUILDX_BINARY_URL}" - mkdir -p ~/.docker/cli-plugins - mv docker-buildx ~/.docker/cli-plugins/ - chmod a+x ~/.docker/cli-plugins/docker-buildx - docker buildx install - docker buildx rm - docker buildx create --name mybuilder-argo-events --use + docker buildx version || (curl --output docker-buildx --silent --show-error --location --fail --retry 3 "${BUILDX_BINARY_URL}"; mkdir -p ~/.docker/cli-plugins; mv docker-buildx ~/.docker/cli-plugins/; chmod a+x ~/.docker/cli-plugins/docker-buildx; docker buildx install) + docker buildx create --name mybuilder-argo-events --use || (echo "Existing builder, keep"; exit 0) test: go test $(shell go list ./... | grep -v /vendor/ | grep -v /test/e2e/) -race -short -v From 441e8ddbf923753f0a86024e5cbfeb89e841a8d2 Mon Sep 17 00:00:00 2001 From: mickkael <19755421+mickkael@users.noreply.github.com> Date: Wed, 9 Jun 2021 12:18:31 +0800 Subject: [PATCH 10/14] fix bug if gzipped binaries exists already Signed-off-by: mickkael <19755421+mickkael@users.noreply.github.com> --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 652e2c9a65..86ac08d64c 100644 --- a/Makefile +++ b/Makefile @@ -48,7 +48,7 @@ K := $(foreach exec,$(EXECUTABLES), $(if $(shell which $(exec)),some string,$(er build: dist/$(BINARY_NAME)-linux-amd64.gz dist/$(BINARY_NAME)-linux-arm64.gz dist/$(BINARY_NAME)-linux-arm.gz dist/$(BINARY_NAME)-linux-ppc64le.gz dist/$(BINARY_NAME)-linux-s390x.gz dist/$(BINARY_NAME)-%.gz: dist/$(BINARY_NAME)-% - gzip -k dist/$(BINARY_NAME)-$* + yes n | gzip -k dist/$(BINARY_NAME)-$* dist/$(BINARY_NAME): GOARGS = GOOS= GOARCH= dist/$(BINARY_NAME)-linux-amd64: GOARGS = GOOS=linux GOARCH=amd64 From c22b71f6591cc9ec7f8ae87b7824ff3403d9e920 Mon Sep 17 00:00:00 2001 From: mickkael <19755421+mickkael@users.noreply.github.com> Date: Wed, 9 Jun 2021 14:23:59 +0800 Subject: [PATCH 11/14] small bug Signed-off-by: mickkael <19755421+mickkael@users.noreply.github.com> --- .github/workflows/release.yml | 2 +- Makefile | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d01aa16794..a6621b0bf3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -73,7 +73,7 @@ jobs: - name: Container build and push with arm64/amd64 run: | - IMAGE_NAMESPACE=quay.io/${{ secrets.QUAYIO_USERNAME }} VERSION=${{ steps.version.outputs.VERSION }} DO_BUILD=false DOCKER_PUSH=true make image-multi + IMAGE_NAMESPACE=quay.io/${{ secrets.QUAYIO_USERNAME }} VERSION=${{ steps.version.outputs.VERSION }} DOCKER_PUSH=true make image-multi release: runs-on: ubuntu-latest diff --git a/Makefile b/Makefile index 86ac08d64c..0db5dedfa7 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,6 @@ DOCKER_PUSH?=false IMAGE_NAMESPACE?=quay.io/argoproj VERSION?=latest BASE_VERSION:=latest -DO_BUILD?=true override LDFLAGS += \ -X ${PACKAGE}.version=${VERSION} \ @@ -39,6 +38,7 @@ VERSION=$(GIT_TAG) override LDFLAGS += -X ${PACKAGE}.gitTag=${GIT_TAG} endif +# Check that the needed executables are available, else exit before the build K := $(foreach exec,$(EXECUTABLES), $(if $(shell which $(exec)),some string,$(error "No $(exec) in PATH"))) .PHONY: build image clean test @@ -48,7 +48,7 @@ K := $(foreach exec,$(EXECUTABLES), $(if $(shell which $(exec)),some string,$(er build: dist/$(BINARY_NAME)-linux-amd64.gz dist/$(BINARY_NAME)-linux-arm64.gz dist/$(BINARY_NAME)-linux-arm.gz dist/$(BINARY_NAME)-linux-ppc64le.gz dist/$(BINARY_NAME)-linux-s390x.gz dist/$(BINARY_NAME)-%.gz: dist/$(BINARY_NAME)-% - yes n | gzip -k dist/$(BINARY_NAME)-$* + [[ -e dist/$(BINARY_NAME)-$*.gz} ]] || gzip -k dist/$(BINARY_NAME)-$* dist/$(BINARY_NAME): GOARGS = GOOS= GOARCH= dist/$(BINARY_NAME)-linux-amd64: GOARGS = GOOS=linux GOARCH=amd64 From eca5cb897560f8349e07f340e74d9221df3948da Mon Sep 17 00:00:00 2001 From: mickkael <19755421+mickkael@users.noreply.github.com> Date: Wed, 9 Jun 2021 14:33:57 +0800 Subject: [PATCH 12/14] improve reliability Signed-off-by: mickkael <19755421+mickkael@users.noreply.github.com> --- Dockerfile | 2 +- Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index d641c4823f..327ea6cf5f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,7 @@ RUN apk update && apk upgrade && \ ENV ARGO_VERSION=v3.0.2 RUN wget -q https://github.com/argoproj/argo/releases/download/${ARGO_VERSION}/argo-linux-${ARCH}.gz -RUN gunzip argo-linux-${ARCH}.gz +RUN gunzip -f argo-linux-${ARCH}.gz RUN chmod +x argo-linux-${ARCH} RUN mv ./argo-linux-${ARCH} /usr/local/bin/argo diff --git a/Makefile b/Makefile index 0db5dedfa7..a0a394bacf 100644 --- a/Makefile +++ b/Makefile @@ -48,7 +48,7 @@ K := $(foreach exec,$(EXECUTABLES), $(if $(shell which $(exec)),some string,$(er build: dist/$(BINARY_NAME)-linux-amd64.gz dist/$(BINARY_NAME)-linux-arm64.gz dist/$(BINARY_NAME)-linux-arm.gz dist/$(BINARY_NAME)-linux-ppc64le.gz dist/$(BINARY_NAME)-linux-s390x.gz dist/$(BINARY_NAME)-%.gz: dist/$(BINARY_NAME)-% - [[ -e dist/$(BINARY_NAME)-$*.gz} ]] || gzip -k dist/$(BINARY_NAME)-$* + [[ -e dist/$(BINARY_NAME)-$*.gz ]] || gzip -k dist/$(BINARY_NAME)-$* dist/$(BINARY_NAME): GOARGS = GOOS= GOARCH= dist/$(BINARY_NAME)-linux-amd64: GOARGS = GOOS=linux GOARCH=amd64 From 5e1fd77db11734cb5eb2c2e11fbc19331f510d99 Mon Sep 17 00:00:00 2001 From: mickkael <19755421+mickkael@users.noreply.github.com> Date: Wed, 9 Jun 2021 15:03:39 +0800 Subject: [PATCH 13/14] test compatible with sh instead of bash Signed-off-by: mickkael <19755421+mickkael@users.noreply.github.com> --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index a0a394bacf..2e99ea7033 100644 --- a/Makefile +++ b/Makefile @@ -48,7 +48,7 @@ K := $(foreach exec,$(EXECUTABLES), $(if $(shell which $(exec)),some string,$(er build: dist/$(BINARY_NAME)-linux-amd64.gz dist/$(BINARY_NAME)-linux-arm64.gz dist/$(BINARY_NAME)-linux-arm.gz dist/$(BINARY_NAME)-linux-ppc64le.gz dist/$(BINARY_NAME)-linux-s390x.gz dist/$(BINARY_NAME)-%.gz: dist/$(BINARY_NAME)-% - [[ -e dist/$(BINARY_NAME)-$*.gz ]] || gzip -k dist/$(BINARY_NAME)-$* + @[ -e dist/$(BINARY_NAME)-$*.gz ] || gzip -k dist/$(BINARY_NAME)-$* dist/$(BINARY_NAME): GOARGS = GOOS= GOARCH= dist/$(BINARY_NAME)-linux-amd64: GOARGS = GOOS=linux GOARCH=amd64 From 1f0d66f836d562bd0b3844059b817ba0e9ec129c Mon Sep 17 00:00:00 2001 From: mickkael <19755421+mickkael@users.noreply.github.com> Date: Sat, 12 Jun 2021 09:43:58 +0800 Subject: [PATCH 14/14] remove set-buildx Signed-off-by: mickkael <19755421+mickkael@users.noreply.github.com> --- Makefile | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 2e99ea7033..aab3b53a0c 100644 --- a/Makefile +++ b/Makefile @@ -72,17 +72,13 @@ image-linux-%: dist/$(BINARY_NAME)-linux-$* DOCKER_BUILDKIT=1 docker build --build-arg "ARCH=$*" -t $(IMAGE_NAMESPACE)/$(BINARY_NAME):$(VERSION)-linux-$* --platform "linux/$*" --target $(BINARY_NAME) -f $(DOCKERFILE) . @if [ "$(DOCKER_PUSH)" = "true" ]; then docker push $(IMAGE_NAMESPACE)/$(BINARY_NAME):$(VERSION)-linux-$*; fi -image-multi: set-buildx set-qemu dist/$(BINARY_NAME)-linux-arm64.gz dist/$(BINARY_NAME)-linux-amd64.gz +image-multi: set-qemu dist/$(BINARY_NAME)-linux-arm64.gz dist/$(BINARY_NAME)-linux-amd64.gz docker buildx build --tag $(IMAGE_NAMESPACE)/$(BINARY_NAME):$(VERSION) --target $(BINARY_NAME) --platform linux/amd64,linux/arm64 --file ./Dockerfile ${PUSH_OPTION} . set-qemu: docker pull tonistiigi/binfmt:latest docker run --rm --privileged tonistiigi/binfmt:latest --install amd64,arm64 -set-buildx: - docker buildx version || (curl --output docker-buildx --silent --show-error --location --fail --retry 3 "${BUILDX_BINARY_URL}"; mkdir -p ~/.docker/cli-plugins; mv docker-buildx ~/.docker/cli-plugins/; chmod a+x ~/.docker/cli-plugins/docker-buildx; docker buildx install) - docker buildx create --name mybuilder-argo-events --use || (echo "Existing builder, keep"; exit 0) - test: go test $(shell go list ./... | grep -v /vendor/ | grep -v /test/e2e/) -race -short -v