From 67a0662770a1ffa8075e34faa26e34a5b6b43c3e Mon Sep 17 00:00:00 2001 From: jannfis Date: Tue, 2 Jun 2020 09:45:47 +0200 Subject: [PATCH 1/8] New workflow --- .github/workflows/release.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000000000..d210ae06cd5f7 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,19 @@ +name: Create a release +on: + push: + tags: + - 'release-v*' +jobs: + prepare-release: + name: Prepare release assets + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Create release tag + env: + SOURCE_TAG: ${{ github.ref }} + run: | + echo "Creating release tag tag ${SOURCE_TAG}" \ No newline at end of file From 4a6fe4cd3147454d9ebb03a1706d02466a3ccc5e Mon Sep 17 00:00:00 2001 From: Alexander Matyushentsev Date: Tue, 2 Jun 2020 09:37:10 -0700 Subject: [PATCH 2/8] feat: upgrade kustomize to v3.6.1 version (#3696) --- hack/installers/install-kustomize-linux.sh | 5 ----- hack/tool-versions.sh | 2 +- test/container/Dockerfile | 1 + 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/hack/installers/install-kustomize-linux.sh b/hack/installers/install-kustomize-linux.sh index 2b85cddbf683b..69b5ce625393c 100755 --- a/hack/installers/install-kustomize-linux.sh +++ b/hack/installers/install-kustomize-linux.sh @@ -13,11 +13,6 @@ KUSTOMIZE_VERSION=${KUSTOMIZE_VERSION:-$kustomize3_version} # v3.3.0 = https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v3.3.0/kustomize_v3.3.0_linux_amd64.tar.gz case $ARCHITECTURE in arm|arm64) - # Note that installing kustomize via Go is broken in version v3.5.5 - # This is fixed in v3.6.1, more details in the github issue: - # https://github.com/kubernetes-sigs/kustomize/issues/2462 - # TODO: Remove this once kustomize gets updated to v3.6.1 for linux - KUSTOMIZE_VERSION="3.6.1" BINNAME=kustomize GO111MODULE=on go get sigs.k8s.io/kustomize/kustomize/v3@v${KUSTOMIZE_VERSION} mv $GOPATH/bin/kustomize $BIN/$BINNAME diff --git a/hack/tool-versions.sh b/hack/tool-versions.sh index bccd09e76aabb..f8d0be2119e8c 100644 --- a/hack/tool-versions.sh +++ b/hack/tool-versions.sh @@ -7,7 +7,7 @@ jq_version=1.6 ksonnet_version=0.13.1 kubectl_version=1.14.0 kubectx_version=0.6.3 -kustomize3_version=3.5.5 +kustomize3_version=3.6.1 packr_version=1.21.9 protoc_version=3.7.1 swagger_version=0.19.0 diff --git a/test/container/Dockerfile b/test/container/Dockerfile index b884d1b5f5bd2..4fbf792f0b259 100644 --- a/test/container/Dockerfile +++ b/test/container/Dockerfile @@ -31,6 +31,7 @@ ENV GOROOT /usr/local/go ENV GOPATH /go # Install build and test dependencies +ADD ./hack/tool-versions.sh . ADD ./hack/install.sh . ADD ./hack/installers installers From 84bece53a32f213e7e5a292af08ca37161f08dd6 Mon Sep 17 00:00:00 2001 From: David Maciel Date: Tue, 2 Jun 2020 12:45:15 -0400 Subject: [PATCH 3/8] docs: Use official curl image instead of appropriate/curl (#3695) The appropriate/curl last update is from two years ago: ``` $ docker run -it --entrypoint /bin/ash appropriate/curl:latest $ curl --version curl 7.59.0 (x86_64-alpine-linux-musl) libcurl/7.59.0 LibreSSL/2.6.3 zlib/1.2.11 libssh2/1.8.0 Release-Date: 2018-03-14 Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp Features: AsynchDNS IPv6 Largefile NTLM NTLM_WB SSL libz UnixSockets HTTPS-proxy ``` There is already an official curl image at https://hub.docker.com/r/curlimages/curl (The link to the docker hub can be found in the official curl download page: https://curl.haxx.se/download.html) $ docker run -it --entrypoint /bin/ash curlimages/curl:latest $ curl --version curl 7.70.0-DEV (x86_64-pc-linux-musl) libcurl/7.70.0-DEV OpenSSL/1.1.1d zlib/1.2.11 libssh2/1.9.0 nghttp2/1.40.0 Release-Date: [unreleased] Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp Features: AsynchDNS HTTP2 HTTPS-proxy IPv6 Largefile libz NTLM NTLM_WB SSL TLS-SRP UnixSockets --- docs/user-guide/resource_hooks.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/user-guide/resource_hooks.md b/docs/user-guide/resource_hooks.md index 9a065c17153d1..b4196b8d5dc1d 100644 --- a/docs/user-guide/resource_hooks.md +++ b/docs/user-guide/resource_hooks.md @@ -95,7 +95,7 @@ spec: spec: containers: - name: slack-notification - image: appropriate/curl + image: curlimages/curl command: - "curl" - "-X" @@ -120,7 +120,7 @@ spec: spec: containers: - name: slack-notification - image: appropriate/curl + image: curlimages/curl command: - "curl" - "-X" From e775b8fce8a73ad5db9bf3e881a15027548eb092 Mon Sep 17 00:00:00 2001 From: Alexander Matyushentsev Date: Tue, 2 Jun 2020 11:07:06 -0700 Subject: [PATCH 4/8] chore: run intergation tests in release branches (#3697) --- .github/workflows/ci-build.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-build.yaml b/.github/workflows/ci-build.yaml index ee5097ec75924..b9a9b06dc1cac 100644 --- a/.github/workflows/ci-build.yaml +++ b/.github/workflows/ci-build.yaml @@ -2,7 +2,10 @@ name: Integration tests on: push: branches: - - 'master' + - 'master' + - 'release-*' + - '!release-1.4' + - '!release-1.5' pull_request: branches: - 'master' From 53e5c65e11b4ab9a637e6c14a687be1e243a7db4 Mon Sep 17 00:00:00 2001 From: Eder Nucci Date: Thu, 4 Jun 2020 01:25:53 -0300 Subject: [PATCH 5/8] Adding Greenpass to USERS list (#3699) --- USERS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/USERS.md b/USERS.md index c50d5cea9dec2..5434dfe4923a0 100644 --- a/USERS.md +++ b/USERS.md @@ -23,6 +23,7 @@ Currently, the following organizations are **officially** using Argo CD: 1. [Fave](https://myfave.com) 1. [Future PLC](https://www.futureplc.com/) 1. [GMETRI](https://gmetri.com/) +1. [Greenpass](https://www.greenpass.com.br/) 1. [Healy](https://www.healyworld.net) 1. [hipages](https://hipages.com.au/) 1. [Honestbank](https://honestbank.com) From 4bf6e8818943f4df547fff7c4405ce8ea11e47f4 Mon Sep 17 00:00:00 2001 From: ragarcia26 Date: Wed, 3 Jun 2020 23:26:55 -0500 Subject: [PATCH 6/8] docs: Add EA to USERS.md (#3704) * docs: Add EA to USERS.md --- USERS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/USERS.md b/USERS.md index 5434dfe4923a0..54753682820ac 100644 --- a/USERS.md +++ b/USERS.md @@ -18,6 +18,7 @@ Currently, the following organizations are **officially** using Argo CD: 1. [CyberAgent](https://www.cyberagent.co.jp/en/) 1. [Cybozu](https://cybozu-global.com) 1. [EDF Renewables](https://www.edf-re.com/) +1. [Electronic Arts Inc. ](https://www.ea.com) 1. [Elium](https://www.elium.com) 1. [END.](https://www.endclothing.com/) 1. [Fave](https://myfave.com) From 60dbf545b659349333c41d1eda1cbdf4d54b2a75 Mon Sep 17 00:00:00 2001 From: "Anna M. Kosek" Date: Thu, 4 Jun 2020 14:57:44 +0200 Subject: [PATCH 7/8] docs: updated import command in the Disaster Recovery (#3710) --- docs/operator-manual/disaster_recovery.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/operator-manual/disaster_recovery.md b/docs/operator-manual/disaster_recovery.md index bcd4f42d8eaa4..b6a17885b2345 100644 --- a/docs/operator-manual/disaster_recovery.md +++ b/docs/operator-manual/disaster_recovery.md @@ -21,7 +21,7 @@ docker run -v ~/.kube:/home/argocd/.kube --rm argoproj/argocd:$VERSION argocd-ut Import from a backup: ```bash -docker run -v ~/.kube:/home/argocd/.kube --rm argoproj/argocd:$VERSION argocd-util import - < backup.yaml +docker run -i -v ~/.kube:/home/argocd/.kube --rm argoproj/argocd:$VERSION argocd-util import - < backup.yaml ``` !!! note From 9a0db6c55294451c08b1a5cdde2b3ed9eb6a42ac Mon Sep 17 00:00:00 2001 From: jannfis Date: Thu, 4 Jun 2020 18:04:40 +0200 Subject: [PATCH 8/8] chore: Introduce release automation --- .github/workflows/release.yaml | 270 +++++++++++++++++++++++++++++- docs/developer-guide/releasing.md | 168 ++++++++++++++++++- hack/trigger-release.sh | 108 ++++++++++++ 3 files changed, 534 insertions(+), 12 deletions(-) create mode 100755 hack/trigger-release.sh diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index d210ae06cd5f7..e12b51cff4d90 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,19 +1,279 @@ -name: Create a release +name: Create ArgoCD release on: push: tags: - 'release-v*' + - '!release-v1.5*' + - '!release-v1.4*' + - '!release-v1.3*' + - '!release-v1.2*' + - '!release-v1.1*' + - '!release-v1.0*' + - '!release-v0*' jobs: prepare-release: - name: Prepare release assets + name: Perform automatic 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: jannfis + # Whether to create & push image and release assets + DRY_RUN: false + # Whether a draft release should be created, instead of public one + DRAFT_RELEASE: false + # The name of the repository containing tap formulae + TAP_REPOSITORY: jannfis/homebrew-tap + # Whether to update homebrew with this release as well + UPDATE_HOMEBREW: false steps: - name: Checkout code uses: actions/checkout@v2 with: fetch-depth: 0 - - name: Create release tag + 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#*release-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, minus the release- prefix + RELEASE_TAG="${SOURCE_TAG#*release-}" + + # Whether this is a pre-release (indicated by -rc suffix) + PRE_RELEASE=false + if echo "${RELEASE_TAG}" | egrep -- '-rc[0-9]+$'; then + PRE_RELEASE=true + fi + + # We must not have a release trigger within the same release branch, + # because that means a release for this branch is already running. + if git tag -l | grep "release-v${TARGET_VERSION%\.[0-9]*}" | grep -v "release-v${TARGET_VERSION}"; then + echo "::error::Another release for branch ${TARGET_BRANCH} is currently in progress." + exit 1 + fi + + # Ensure that release do not yet exist + if git rev-parse ${RELEASE_TAG}; then + echo "::error::Release tag ${RELEASE_TAG} already exists in repository. Refusing to continue." + exit 1 + fi + + # Make the variables available in follow-up steps + echo "::set-env name=TARGET_VERSION::${TARGET_VERSION}" + echo "::set-env name=TARGET_BRANCH::${TARGET_BRANCH}" + echo "::set-env name=RELEASE_TAG::${RELEASE_TAG}" + echo "::set-env name=PRE_RELEASE::${PRE_RELEASE}" + + - name: Check if our release tag has a correct annotation + run: | + set -ue + # Fetch all tag information as well + git fetch --prune --tags --force + + echo "=========== BEGIN COMMIT MESSAGE =============" + git show ${SOURCE_TAG} + echo "============ END COMMIT MESSAGE ==============" + + # Quite dirty hack to get the release notes from the annotated tag + # into a temporary file. + RELEASE_NOTES=$(mktemp -p /tmp release-notes.XXXXXX) + + prefix=true + begin=false + git show ${SOURCE_TAG} | while read line; do + # Whatever is in commit history for the tag, we only want that + # annotation from our tag. We discard everything else. + if test "$begin" = "false"; then + if echo $line | grep -q "tag ${SOURCE_TAG#refs/tags/}"; then begin="true"; fi + continue + fi + if test "$prefix" = "true"; then + if test -z "$line"; then prefix=false; fi + else + if echo $line | egrep -q '^commit [0-9a-f]+'; then + break + fi + echo $line >> ${RELEASE_NOTES} + fi + done + + # For debug purposes + echo "============BEGIN RELEASE NOTES=================" + cat ${RELEASE_NOTES} + echo "=============END RELEASE NOTES==================" + + # Too short release notes are suspicious. We need at least 100 bytes. + relNoteLen=$(stat -c '%s' $RELEASE_NOTES) + if test $relNoteLen -lt 100; then + echo "::error::No release notes provided in tag annotation (or tag is not annotated)" + exit 1 + fi + + # Check for magic string '## Quick Start' in head of release notes + if ! head -2 ${RELEASE_NOTES} | grep -iq '## Quick Start'; then + echo "::error::Release notes seem invalid, quick start section not found." + exit 1 + fi + + # We store path to temporary release notes file for later reading, we + # need it when creating release. + echo "::set-env name=RELEASE_NOTES::$RELEASE_NOTES" + + - name: Setup Golang + uses: actions/setup-go@v1 + with: + go-version: '1.14.2' + + - name: Setup Git author information + run: | + set -ue + git config --global user.email "jann@mistrust.net" + git config --global user.name "jannfis" + + - 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: Create VERSION information + run: | + set -ue + echo "Bumping version from $(cat VERSION) to ${TARGET_VERSION}" + echo "${TARGET_VERSION}" > VERSION + git commit -m "Bump version to ${TARGET_VERSION}" VERSION + + - name: Generate new set of manifests + run: | + set -ue + make install-codegen-tools-local + helm2 init --client-only + make manifests-local VERSION=${TARGET_VERSION} + git diff + git commit manifests/ -m "Bump version to ${TARGET_VERSION}" + + - name: Create the release tag + run: | + set -ue + echo "Creating release ${RELEASE_TAG}" + git tag ${RELEASE_TAG} + + - name: Build Docker image for release + run: | + set -ue + git clean -fd + mkdir -p dist/ + make image IMAGE_TAG="${TARGET_VERSION}" DOCKER_PUSH=false + make release-cli + chmod +x ./dist/argocd-linux-amd64 + ./dist/argocd-linux-amd64 version --client + if: ${{ env.DRY_RUN != 'true' }} + + - name: Push docker image to repository + env: + DOCKER_USERNAME: ${{ secrets.RELEASE_DOCKERHUB_USERNAME }} + DOCKER_TOKEN: ${{ secrets.RELEASE_DOCKERHUB_TOKEN }} + run: | + set -ue + docker login --username "${DOCKER_USERNAME}" --password "${DOCKER_TOKEN}" + docker push ${IMAGE_NAMESPACE}/argocd:v${TARGET_VERSION} + if: ${{ env.DRY_RUN != 'true' }} + + - name: Read release notes file + id: release-notes + uses: juliangruber/read-file-action@v1 + with: + path: ${{ env.RELEASE_NOTES }} + + - name: Push changes to release branch + run: | + set -ue + git push origin ${TARGET_BRANCH} + git push origin ${RELEASE_TAG} + + - name: Create GitHub release + uses: actions/create-release@v1 env: - SOURCE_TAG: ${{ github.ref }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + id: create_release + with: + tag_name: ${{ env.RELEASE_TAG }} + release_name: ${{ env.RELEASE_TAG }} + draft: ${{ env.DRAFT_RELEASE }} + prerelease: ${{ env.PRE_RELEASE }} + body: ${{ steps.release-notes.outputs.content }} + + - name: Upload argocd-linux-amd64 binary to release assets + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./dist/argocd-linux-amd64 + asset_name: argocd-linux-amd64 + asset_content_type: application/octet-stream + if: ${{ env.DRY_RUN != 'true' }} + + - name: Upload argocd-darwin-amd64 binary to release assets + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./dist/argocd-darwin-amd64 + asset_name: argocd-darwin-amd64 + asset_content_type: application/octet-stream + if: ${{ env.DRY_RUN != 'true' }} + + - name: Upload argocd-windows-amd64 binary to release assets + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./dist/argocd-windows-amd64.exe + asset_name: argocd-windows-amd64.exe + asset_content_type: application/octet-stream + if: ${{ env.DRY_RUN != 'true' }} + + - name: Check out homebrew tap repository + uses: actions/checkout@v2 + with: + repository: ${{ env.TAP_REPOSITORY }} + path: homebrew-tap + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + if: ${{ env.UPDATE_HOMEBREW == 'true' }} + + - name: Update homebrew tap formulae + run: | + set -ue + cd homebrew-tap + ./update.sh argocd ${TARGET_VERSION} + git commit -am "Update argocd to ${TARGET_VERSION}" + git push + cd .. + rm -rf homebrew-tap + if: ${{ env.UPDATE_HOMEBREW == 'true' }} + + - name: Delete original request tag from repository run: | - echo "Creating release tag tag ${SOURCE_TAG}" \ No newline at end of file + set -ue + git push --delete origin ${SOURCE_TAG} + if: ${{ always() }} \ No newline at end of file diff --git a/docs/developer-guide/releasing.md b/docs/developer-guide/releasing.md index eb8b4e80e8e11..70ac060f2d3a0 100644 --- a/docs/developer-guide/releasing.md +++ b/docs/developer-guide/releasing.md @@ -1,5 +1,155 @@ # Releasing +## Automated release procedure + +Starting from `release-1.6` branch, ArgoCD can be released in automatic fashion +using GitHub actions. The release process takes about 20 minutes, sometimes a +little less, depending on the performance of GitHub actions runners. + +The target release branch must already exist in GitHub repository. If you for +example want to create a release `v1.7.0`, the corresponding release branch +`release-1.7` needs to exist, otherwise the release cannot be build. Also, +the trigger tag should always be created in the release branch, checked out +in your local repository clone. + +Before triggering the release automation, the `CHANGELOG.md` should be updated +with the latest information, and this change should be commited and pushed to +the GitHub repository to the release branch. Afterwards, the automation can be +triggered. + +**Manual steps before release creation:** + +* Update `CHANGELOG.md` with changes for this release +* Commit & push changes to `CHANGELOG.md` +* Prepare release notes (save to some file, or copy from Changelog) + +**The automation will perform the following steps:** + +* Update `VERSION` file in release branch +* Update manifests with image tags of new version in release branch +* Build the Docker image and push to Docker Hub +* Create release tag in the GitHub repository +* Create GitHub release and attach the required assets to it (CLI binaries, ...) + +Finally, it will the remove trigger tag from repository again. + +Automation supports both, GA and pre-releases. The automation is triggered by +pushing a tag to the repository. The tag must be in one of the following formats +to trigger the GH workflow: + +* GA: `release-v..` +* Pre-release: `release-v..-rc` + +The tag must be an annotated tag, and it must contain the release notes in the +commit message. Please note that Markdown uses `#` character for formatting, but +Git uses it as comment char. To solve this, temporarily switch Git comment char +to something else, the `;` character is recommended. + +For example, considering you have configured the Git remote for repository to +`github.com/argoproj/argo-cd` to be named `upstream` and are in your locally +checked out repo: + +```shell +git config core.commentChar ';' +git tag -a -F /path/to/release-notes.txt release-v1.6.0-rc2 +git push upstream release-v1.6.0-rc2 +git tag -d release-v1.6.0-rc2 +git config core.commentChar '#' + +``` + +For convenience, there is a shell script in the tree that ensures all the +pre-requisites are met and that the trigger is well-formed before pushing +it to the GitHub repo. + +In summary, the modifications it does are: + +* Create annotated trigger tag in your local repository +* Push tag to GitHub repository to trigger workflow +* Remove trigger tag from your local repository + +The script can be found at `hacks/trigger-release.sh` and is used as follows: + +```shell +./hacks/trigger-release.sh [] +``` + +The `` identifier needs to be specified **without** the `release-` +prefix, so just specify it as `v1.6.0-rc2` for example. The `` +specifies the name of the remote used to push to the GitHub repository. + +If you omit the ``, an editor will pop-up asking you to +enter the tag's annotation so you can paste the release notes, save and exit. +It will also take care of temporarily configuring the `core.commentChar` and +setting it back to its original state. + +!!!note + It is strongly recommended to use this script to trigger the workflow + instead of manually pushing a tag to the repository. + +Once the trigger tag is pushed to the repo, the GitHub workflow will start +execution. You can follow its progress under `Actions` tab, the name of the +action is `Create release`. Don't get confused by the name of the running +workflow, it will be the commit message of the latest commit to `master` +branch, this is a limitation of GH actions. + +The workflow performs necessary checks so that the release can be sucessfully +build before the build actually starts. It will error when one of the +prerequisites is not met, or if the release cannot be build (i.e. already +exists, release notes invalid, etc etc). You can see a summary of what has +failed in the job's overview page, and more detailed errors in the output +of the step that has failed. + +!!!note + You cannot perform more than one release on the same release branch at the + same time. For example, both `v1.6.0` and `v1.6.1` would operate on the + `release-1.6` branch. If you submit `v1.6.1` while `v1.6.0` is still + executing, the release automation will not execute. You have to either + cancel `v1.6.0` before submitting `v1.6.1` or wait until it has finished. + You can execute releases on different release branches simultaneously, for + example `v1.6.0` and `v1.7.0-rc1`, without problems. + +### Verifying automated release + +After the automatic release creation has finished, you should perform manual +checks to see if the release came out correctly: + +* Check status & output of the GitHub action +* Check [https://github.com/argoproj/argo-cd/releases](https://github.com/argoproj/argo-cd/releases) + to see if release has been correctly created, and if all required assets + are attached. +* Check whether the image has been published on DockerHub correctly + +### If something went wrong + +If something went wrong, damage should be limited. Depending on the steps that +have been performed, you will need to manually clean up. + +* Delete release tag (i.e. `v1.6.0-rc2`) created on GitHub repository. This + will immediately set release (if created) to `draft` status, invisible for + general public. +* Delete the draft release (if created) from `Releases` page on GitHub +* If Docker image has been pushed to DockerHub, delete it +* If commits have been performed to the release branch, revert them. Paths that could have been commited to are: + * `VERSION` + * `manifests/*` + +### Post-process manual steps + +For now, the only manual steps left are to + +* update brew formulae for ArgoCD CLI on Mac if release is GA +* update stable tag in GitHub repository to point to new release (if appropriate) + +These will be automated as well in the future. + +## Manual releasing + +Automatic release process does not interfere with manual release process, since +the trigger tag does not match a normal release tag. If you prefer to perform, +manual release or if automatic release is for some reason broken, these are the +steps: + Make sure you are logged into Docker Hub: ```bash @@ -42,18 +192,14 @@ git push $REPO $BRANCH git push $REPO $VERSION ``` -If GA, update `stable` tag: - -```bash -git tag stable --force && git push $REPO stable --force -``` - Update [Github releases](https://github.com/argoproj/argo-cd/releases) with: * Getting started (copy from previous release) * Changelog * Binaries (e.g. `dist/argocd-darwin-amd64`). +## Update brew formulae (manual) + If GA, update Brew formula: ```bash @@ -64,7 +210,15 @@ git commit -am "Update argocd to $VERSION" git push ``` -### Verify +## Update stable tag (manual) + +If GA, update `stable` tag: + +```bash +git tag stable --force && git push $REPO stable --force +``` + +## Verify release Locally: diff --git a/hack/trigger-release.sh b/hack/trigger-release.sh new file mode 100755 index 0000000000000..7ff6a6293cc50 --- /dev/null +++ b/hack/trigger-release.sh @@ -0,0 +1,108 @@ +#!/usr/bin/env bash + +# This script requires bash shell - sorry. + +NEW_TAG="${1}" +GIT_REMOTE="${2}" +COMMIT_MSG="${3}" +origToken="" + +set -ue + +restoreToken() { + if test "$origToken" != ""; then + echo ">> Restoring original Git comment char" + git config core.commentChar "$origToken" + fi +} + +cleanLocalTriggerTag() { + if test "$TRIGGER_TAG" != ""; then + echo ">> Remove trigger tag '${TRIGGER_TAG}' from local repository." + git tag -d $TRIGGER_TAG + fi +} + +cleanup() { + restoreToken + cleanLocalTriggerTag +} + +if test "${NEW_TAG}" = "" -o "${GIT_REMOTE}" = ""; then + echo "!! Usage: $0 [path to release notes file]" >&2 + exit 1 +fi + +# Target (version) tag must match version scheme vMAJOR.MINOR.PATCH with an +# optional pre-release tag. +if ! echo "${NEW_TAG}" | egrep -q '^v[0-9]+\.[0-9]+\.[0-9]+(-rc[0-9]+)*$'; then + echo "!! Malformed version tag: '${NEW_TAG}', must match 'vMAJOR.MINOR.PATCH(-rcX)'" >&2 + exit 1 +fi + +TRIGGER_TAG="release-${NEW_TAG}" + +# Check whether we are in correct branch of local repository +RELEASE_BRANCH="${NEW_TAG%\.[0-9]*}" +RELEASE_BRANCH="release-${RELEASE_BRANCH#*v}" + +currentBranch=$(git branch --show-current) +if test "$currentBranch" != "${RELEASE_BRANCH}"; then + echo "!! Please checkout branch '${RELEASE_BRANCH}' (currently in branch: '${currentBranch}')" >&2 + exit 1 +fi + +echo ">> Working in release branch '${RELEASE_BRANCH}'" + +# Check for trigger tag existing in local repo +if git tag -l | grep -q "${TRIGGER_TAG}"; then + echo "!! Release tag '${TRIGGER_TAG}' already exists in local repository" >&2 + exit 1 +fi + +# Check for trigger tag existing in remote repo +if git ls-remote ${GIT_REMOTE} refs/tags/${TRIGGER_TAG} | grep -q ${NEW_TAG}; then + echo "!! Target trigger tag '${TRIGGER_TAG}' already exists in remote '${GIT_REMOTE}'" >&2 + echo "!! Another operation currently in progress?" >&2 + exit 1 +fi + +# Check for target (version) tag in local repo +if git tag -l | grep -q "${NEW_TAG}"; then + echo "!! Target version tag '${NEW_TAG}' already exists in local repository" >&2 + exit 1 +fi + +# Check for target (version) tag in remote repo +if git ls-remote ${GIT_REMOTE} refs/tags/${NEW_TAG} | grep -q ${NEW_TAG}; then + echo "!! Target version tag '${NEW_TAG}' already exists in remote '${GIT_REMOTE}'" >&2 + exit 1 +fi + +echo ">> Creating new release '${NEW_TAG}' by pushing '${TRIGGER_TAG}' to '${GIT_REMOTE}'" + +GIT_ARGS="" +if test "${COMMIT_MSG}" != ""; then + if ! test -f "${COMMIT_MSG}"; then + echo "!! Release notes at '${COMMIT_MSG}' do not exist or are not readable." >&2 + exit 1 + fi + GIT_ARGS="-F ${COMMIT_MSG}" +fi + +# We need different git comment char than '#', because markdown makes extensive +# use of '#' - we chose ';' for our operation. +origToken=$(git config core.commentChar) +echo ">> Saving original Git comment char '${origToken}' and setting it to ';' for this run" +if ! git config core.commentChar ';'; then + echo "!! Could not set git config commentChar ';'" >&2 + exit 1 +fi + +trap cleanup SIGINT EXIT + +# Create trigger tag in local repository +git tag -a ${GIT_ARGS} ${TRIGGER_TAG} + +# Push the trigger tag to remote repository +git push ${GIT_REMOTE} ${TRIGGER_TAG}