diff --git a/.github/workflows/publish-multiarch-image.yaml b/.github/workflows/publish-multiarch-image.yaml new file mode 100644 index 0000000000000..8003b88cd0055 --- /dev/null +++ b/.github/workflows/publish-multiarch-image.yaml @@ -0,0 +1,104 @@ +name: Publish ArgoCD multiarch image + +on: + push: + tags: + - 'v*' + +jobs: + publish-multiarch-image: + name: Perform automatic multiarch release on trigger ${{ github.ref }} + runs-on: ubuntu-latest + env: + # The name of the tag as supplied by the GitHub event + SOURCE_TAG: ${{ github.ref }} + # The image namespace where Docker image will be published to + IMAGE_NAMESPACE: quay.io/argoproj + # Whether to create & push image and release assets + DRY_RUN: false + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Check if the published tag is well formed and setup vars + run: | + set -xue + # Target version must match major.minor.patch and optional -rcX suffix + # where X must be a number. + TARGET_VERSION=${SOURCE_TAG#refs/tags/v} + if ! echo "${TARGET_VERSION}" | egrep '^[0-9]+\.[0-9]+\.[0-9]+(-rc[0-9]+)*$'; then + echo "::error::Target version '${TARGET_VERSION}' is malformed, refusing to continue." >&2 + exit 1 + fi + + # Target branch is the release branch we're going to operate on + # Its name is 'release-.' + TARGET_BRANCH="release-${TARGET_VERSION%\.[0-9]*}" + + # The release tag is the source tag + RELEASE_TAG="${SOURCE_TAG#refs/tags/}" + + # Make the variables available in follow-up steps + echo "TARGET_VERSION=${TARGET_VERSION}" >> $GITHUB_ENV + echo "TARGET_BRANCH=${TARGET_BRANCH}" >> $GITHUB_ENV + echo "RELEASE_TAG=${RELEASE_TAG}" >> $GITHUB_ENV + + - name: Checkout corresponding release branch + run: | + set -ue + echo "Switching to release branch '${TARGET_BRANCH}'" + if ! git checkout ${TARGET_BRANCH}; then + echo "::error::Checking out release branch '${TARGET_BRANCH}' for target version '${TARGET_VERSION}' (tagged '${RELEASE_TAG}') failed. Does it exist in repo?" + exit 1 + fi + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + with: + platforms: arm64 + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v1 + + - name: Build arm64 Docker image for release + uses: docker/build-push-action@v2 + with: + context: . + file: Dockerfile + platforms: linux/arm64 + tags: | + ${{ env.IMAGE_NAMESPACE }}/argocd:${{ env.RELEASE_TAG }}-arm64 + argoproj/argocd:${{ env.RELEASE_TAG }}-arm64 + build-args: | + BUILD_ALL_CLIS=false + load: true + if: ${{ env.DRY_RUN != 'true' }} + + - name: Push docker image to repository + env: + DOCKER_USERNAME: ${{ secrets.RELEASE_DOCKERHUB_USERNAME }} + DOCKER_TOKEN: ${{ secrets.RELEASE_DOCKERHUB_TOKEN }} + QUAY_USERNAME: ${{ secrets.RELEASE_QUAY_USERNAME }} + QUAY_TOKEN: ${{ secrets.RELEASE_QUAY_TOKEN }} + run: | + set -ue + docker login quay.io --username "${QUAY_USERNAME}" --password "${QUAY_TOKEN}" + docker push ${IMAGE_NAMESPACE}/argocd:${RELEASE_TAG}-arm64 + # Create docker multi-arch manifest + docker manifest create ${IMAGE_NAMESPACE}/argocd:${RELEASE_TAG}-multiarch \ + --amend ${IMAGE_NAMESPACE}/argocd:${RELEASE_TAG} \ + --amend ${IMAGE_NAMESPACE}/argocd:${RELEASE_TAG}-arm64 + docker manifest push ${IMAGE_NAMESPACE}/argocd:${RELEASE_TAG}-multiarch + # Remove the following when Docker Hub is gone + docker login --username "${DOCKER_USERNAME}" --password "${DOCKER_TOKEN}" + docker push argoproj/argocd:${RELEASE_TAG}-arm64 + docker manifest create argoproj/argocd:${RELEASE_TAG}-multiarch \ + --amend argoproj/argocd:${RELEASE_TAG} \ + --amend argoproj/argocd:${RELEASE_TAG}-arm64 + docker manifest push argoproj/argocd:${RELEASE_TAG}-multiarch + if: ${{ env.DRY_RUN != 'true' }} + diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index e3a9891a39012..23035e25786a4 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -40,7 +40,7 @@ jobs: uses: actions/checkout@v2 with: fetch-depth: 0 - token: ${{ secrets.GITHUB_TOKEN }} + token: ${{ secrets.ARGOBOT_PERSONAL_TOKEN }} - name: Check if the published tag is well formed and setup vars run: | diff --git a/Dockerfile b/Dockerfile index 6a10f1f144560..4e2b56c678484 100644 --- a/Dockerfile +++ b/Dockerfile @@ -90,7 +90,7 @@ FROM docker.io/library/node:12.18.4 as argocd-ui WORKDIR /src ADD ["ui/package.json", "ui/yarn.lock", "./"] -RUN yarn install +RUN yarn install --network-timeout 100000 ADD ["ui/", "."]