Skip to content
Closed
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
104 changes: 104 additions & 0 deletions .github/workflows/publish-multiarch-image.yaml
Original file line number Diff line number Diff line change
@@ -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-<major>.<minor>'
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' }}

2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/", "."]

Expand Down