From d82da6d914742b50b49dae951b716d4954034894 Mon Sep 17 00:00:00 2001 From: Sergey Nikitin Date: Sun, 18 Jun 2023 00:15:28 +0200 Subject: [PATCH] fix(sentry): Sign up with release version Initialize sentry with proper release version so it can map issues with releases and commits --- .github/workflows/ci-master.yml | 12 +++++++----- .github/workflows/deploy.yml | 9 +++++++-- .../workflows/{postrelease.yml => prerelease.yml} | 6 +++++- src/monitoring/sentry.ts | 3 ++- 4 files changed, 21 insertions(+), 9 deletions(-) rename .github/workflows/{postrelease.yml => prerelease.yml} (89%) diff --git a/.github/workflows/ci-master.yml b/.github/workflows/ci-master.yml index 2177c225..c410cd56 100644 --- a/.github/workflows/ci-master.yml +++ b/.github/workflows/ci-master.yml @@ -10,12 +10,14 @@ jobs: uses: ./.github/workflows/scan.yml secrets: inherit - deploy: + prerelease: needs: [scan] - uses: ./.github/workflows/deploy.yml + uses: ./.github/workflows/prerelease.yml secrets: inherit - postrelease: - needs: [deploy] - uses: ./.github/workflows/postrelease.yml + deploy: + needs: [prerelease] + uses: ./.github/workflows/deploy.yml secrets: inherit + with: + version: ${{ needs.prerelease.outputs.version }} diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index fa9c0290..1b0d7a93 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -2,6 +2,11 @@ name: App Deploy on: workflow_call: + inputs: + version: + type: string + description: "Version tag" + required: true jobs: docker: @@ -32,7 +37,7 @@ jobs: tags: | ghcr.io/${{ secrets.DOCKER_USERNAME }}/voice-to-text-bot/voice-to-speech-app:latest ghcr.io/${{ secrets.DOCKER_USERNAME }}/voice-to-text-bot/voice-to-speech-app:${{ github.sha }} - build-args: APP_VERSION=${{ github.sha }} + build-args: APP_VERSION=${{ github.event.inputs.version }} heroku: runs-on: ubuntu-latest @@ -63,7 +68,7 @@ jobs: run: heroku container:push web --app ${{ vars.HEROKU_APP }} --arg APP_VERSION=${{ env.D_VERSION }} env: HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} - D_VERSION: ${{ github.sha }} + D_VERSION: ${{ github.event.inputs.message }} - name: Release docker image run: heroku container:release web --app ${{ vars.HEROKU_APP }} diff --git a/.github/workflows/postrelease.yml b/.github/workflows/prerelease.yml similarity index 89% rename from .github/workflows/postrelease.yml rename to .github/workflows/prerelease.yml index d814c4a2..4ba5d9a3 100644 --- a/.github/workflows/postrelease.yml +++ b/.github/workflows/prerelease.yml @@ -1,7 +1,11 @@ -name: Post-release +name: Pre-release on: workflow_call: + outputs: + version: + description: "Export version tag" + value: ${{ jobs.tag-release.outputs.version }} jobs: tag-release: diff --git a/src/monitoring/sentry.ts b/src/monitoring/sentry.ts index be75d42d..a3fd02f4 100644 --- a/src/monitoring/sentry.ts +++ b/src/monitoring/sentry.ts @@ -1,7 +1,7 @@ import { Express } from "express"; import * as sentry from "@sentry/node"; import { ProfilingIntegration } from "@sentry/profiling-node"; -import { nodeEnvironment, sentryDsn } from "../env.js"; +import { appVersion, nodeEnvironment, sentryDsn } from "../env.js"; import { isDevelopment } from "../common/environment.js"; const isEnabled = (): boolean => { @@ -15,6 +15,7 @@ export const initSentry = (app: Express): void => { sentry.init({ dsn: sentryDsn, environment: nodeEnvironment, + release: appVersion, integrations: [ // enable HTTP calls tracing new sentry.Integrations.Http({ tracing: true }),