From 276037fa49e7ddef1ee58995d52c1c8ff8eede74 Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Sun, 14 Jun 2020 22:12:44 +0300 Subject: [PATCH 1/5] build(gha): Add automated CalVer releases --- .env | 1 + .github/workflows/release.yml | 12 +++++++++++- docker-compose.yml | 8 ++++---- scripts/bump-version.sh | 12 +++++++++--- 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/.env b/.env index b4f5273538b..aec59cb371a 100644 --- a/.env +++ b/.env @@ -1,3 +1,4 @@ COMPOSE_PROJECT_NAME=sentry_onpremise SENTRY_EVENT_RETENTION_DAYS=90 SENTRY_VERSION=latest +SYMBOLICATOR_VERSION=latest diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1fb717d6a65..b9d2f97204f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,14 +1,24 @@ on: repository_dispatch: types: [release] + schedule: + - cron: '0 0 15 * *' jobs: release: runs-on: ubuntu-latest name: "Release a new version" steps: + - id: calver + if: ${{ !github.event.client_payload.version }} + run: echo "::set-output name=version::$(date +'%y.%-m.0')" - uses: actions/checkout@v2 - uses: getsentry/craft-action@master with: action: prepare - version: ${{ github.event.client_payload.version }} + version: ${{ github.event.client_payload.version || steps.calver.outputs.version }} + dry_run: ${{ github.event.client_payload.dry_run }} + - uses: getsentry/craft-action@master + with: + action: publish + version: ${{ github.event.client_payload.version || steps.calver.outputs.version }} dry_run: ${{ github.event.client_payload.dry_run }} diff --git a/docker-compose.yml b/docker-compose.yml index c10665a45d4..c27cdbf71e6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -133,7 +133,7 @@ services: command: '"*/5 * * * * gosu snuba snuba cleanup --dry-run False"' symbolicator: << : *restart_policy - image: 'getsentry/symbolicator:latest' + image: 'getsentry/symbolicator:$SYMBOLICATOR_VERSION' volumes: - 'sentry-symbolicator:/data' command: run @@ -143,7 +143,7 @@ services: build: context: ./cron args: - BASE_IMAGE: 'getsentry/symbolicator:latest' + BASE_IMAGE: 'getsentry/symbolicator:$SYMBOLICATOR_VERSION' command: '"55 23 * * * gosu symbolicator symbolicator cleanup"' volumes: - 'sentry-symbolicator:/data' @@ -174,7 +174,7 @@ services: << : *restart_policy ports: - '9000:80/tcp' - image: "nginx:1.16" + image: 'nginx:1.16' volumes: - type: bind read_only: true @@ -185,7 +185,7 @@ services: - relay relay: << : *restart_policy - image: "getsentry/relay:$SENTRY_VERSION" + image: 'getsentry/relay:$SENTRY_VERSION' volumes: - type: bind read_only: true diff --git a/scripts/bump-version.sh b/scripts/bump-version.sh index 2a197d8f97d..081af99794a 100644 --- a/scripts/bump-version.sh +++ b/scripts/bump-version.sh @@ -1,5 +1,5 @@ #!/bin/bash -set -eux +set -eu SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" cd $SCRIPT_DIR/.. @@ -7,5 +7,11 @@ cd $SCRIPT_DIR/.. OLD_VERSION="$1" NEW_VERSION="$2" -VERSION=$2 -echo "New version: $VERSION" +SYMBOLICATOR_VERSION=$(curl -sSL 'https://api.github.com/repos/getsentry/symbolicator/git/refs/heads/master' | grep -Po '(?<=\"sha\": \")([a-f0-9]{5,40})(?=\",?)') + +sed -i -e "s/^SYMBOLICATOR_VERSION=.*\$/SYMBOLICATOR_VERSION=$SYMBOLICATOR_VERSION/" .env +sed -i -e "s/^SENTRY_VERSION=.*\$/SENTRY_VERSION=$NEW_VERSION/" .env +sed -i -e "s/^\# Sentry .* On-Premise/# Sentry $NEW_VERSION On-Premise/" README.md + +echo "New version: $NEW_VERSION" +echo "New Symbolicator version: $SYMBOLICATOR_VERSION" From 173f7a97716d4e476f1e85518878659440915aa9 Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Mon, 15 Jun 2020 12:03:08 +0300 Subject: [PATCH 2/5] Move release time to 10am PT --- .github/workflows/release.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b9d2f97204f..a611c1f64b0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,7 +2,10 @@ on: repository_dispatch: types: [release] schedule: - - cron: '0 0 15 * *' + # We want the release to be at 10 or 11am Pacific Time + # We also make this an hour after all others such as Sentry, + # Snuba, and Relay to make sure their releases finish. + - cron: '0 18 15 * *' jobs: release: runs-on: ubuntu-latest From 66a06b3369347d19c71fbc5de53f95006e127cd8 Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Mon, 15 Jun 2020 12:03:33 +0300 Subject: [PATCH 3/5] Set release branch name to `releases` --- .craft.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.craft.yml b/.craft.yml index ff71152a9c7..ad41cd872f6 100644 --- a/.craft.yml +++ b/.craft.yml @@ -2,6 +2,7 @@ minVersion: "0.10.0" github: owner: getsentry repo: onpremise +releaseBranchPrefix: releases changelogPolicy: none artifactProvider: name: none From d8069529d0aed6b10d0ced1be353690de7e6e58a Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Mon, 15 Jun 2020 13:40:27 +0300 Subject: [PATCH 4/5] move to craft from craft-action --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a611c1f64b0..55aa9579e3f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,12 +15,12 @@ jobs: if: ${{ !github.event.client_payload.version }} run: echo "::set-output name=version::$(date +'%y.%-m.0')" - uses: actions/checkout@v2 - - uses: getsentry/craft-action@master + - uses: getsentry/craft@master with: action: prepare version: ${{ github.event.client_payload.version || steps.calver.outputs.version }} dry_run: ${{ github.event.client_payload.dry_run }} - - uses: getsentry/craft-action@master + - uses: getsentry/craft@master with: action: publish version: ${{ github.event.client_payload.version || steps.calver.outputs.version }} From a481c55fd401bc743ac1e2d1536c6f5480d52116 Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Mon, 15 Jun 2020 19:20:38 +0300 Subject: [PATCH 5/5] ref DRY_RUN + add keep_branch and no_merge --- .github/workflows/release.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 55aa9579e3f..0a36cb3ff92 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,9 +19,13 @@ jobs: with: action: prepare version: ${{ github.event.client_payload.version || steps.calver.outputs.version }} - dry_run: ${{ github.event.client_payload.dry_run }} + env: + DRY_RUN: ${{ github.event.client_payload.dry_run }} - uses: getsentry/craft@master with: action: publish version: ${{ github.event.client_payload.version || steps.calver.outputs.version }} - dry_run: ${{ github.event.client_payload.dry_run }} + keep_branch: true + no_merge: true + env: + DRY_RUN: ${{ github.event.client_payload.dry_run }}