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