From 5f5568952a5790629a07fa05ce1788760c4788a1 Mon Sep 17 00:00:00 2001 From: jorg-vr Date: Tue, 4 Jun 2024 15:22:40 +0200 Subject: [PATCH 1/5] Fix release time zone --- .github/workflows/deploy-naos.yml | 2 +- .github/workflows/deploy-production.yml | 2 +- .github/workflows/monthly-release.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy-naos.yml b/.github/workflows/deploy-naos.yml index ac8c750639..6f925d2b3f 100644 --- a/.github/workflows/deploy-naos.yml +++ b/.github/workflows/deploy-naos.yml @@ -34,7 +34,7 @@ jobs: type: remove - name: Get tag name id: tag_name - run: echo "tag_name=$(date +'%Y.%m.%d-%H:%M')" >> "$GITHUB_ENV" + run: echo "tag_name=$(TZ='Europe/Brussels' date +'%Y.%m.%d-%H:%M')" >> "$GITHUB_ENV" - uses: actions/checkout@v3 with: fetch-depth: 0 diff --git a/.github/workflows/deploy-production.yml b/.github/workflows/deploy-production.yml index 3249b7c4f3..5dde14cd2c 100644 --- a/.github/workflows/deploy-production.yml +++ b/.github/workflows/deploy-production.yml @@ -24,7 +24,7 @@ jobs: echo "deploy production $GITHUB_SHA" | ssh -p 4840 dodona@mestra.ugent.be - name: Get tag name id: tag_name - run: echo "tag_name=$(date +'%Y.%m.%d-%H:%M')" >> "$GITHUB_ENV" + run: echo "tag_name=$(TZ='Europe/Brussels' date +'%Y.%m.%d-%H:%M')" >> "$GITHUB_ENV" - uses: actions/checkout@v3 with: fetch-depth: 0 diff --git a/.github/workflows/monthly-release.yml b/.github/workflows/monthly-release.yml index 55919cb81c..c16633488c 100644 --- a/.github/workflows/monthly-release.yml +++ b/.github/workflows/monthly-release.yml @@ -9,7 +9,7 @@ jobs: steps: - name: Get tag name id: tag_name - run: echo "tag_name=$(date +'%Y.%m')" >> "$GITHUB_ENV" + run: echo "tag_name=$(TZ='Europe/Brussels' date +'%Y.%m')" >> "$GITHUB_ENV" - name: log tag name run: echo ${{ env.tag_name }} - uses: octokit/request-action@v2.x From 7e5c9a09681dd412f8b48c547565826731119e78 Mon Sep 17 00:00:00 2001 From: jorg-vr Date: Tue, 4 Jun 2024 15:45:46 +0200 Subject: [PATCH 2/5] Add release info to sentry --- app/assets/javascripts/sentry.ts | 13 +++++-------- app/javascript/packs/frame.js | 2 ++ app/views/layouts/application.html.erb | 2 ++ app/views/layouts/frame.html.erb | 2 ++ app/views/layouts/lti.html.erb | 2 ++ 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/app/assets/javascripts/sentry.ts b/app/assets/javascripts/sentry.ts index 7ab0736567..17325c4e3d 100644 --- a/app/assets/javascripts/sentry.ts +++ b/app/assets/javascripts/sentry.ts @@ -1,18 +1,15 @@ import * as Sentry from "@sentry/browser"; -const HOST_TO_ENVIRONMENT: Record = { - "dodona.localhost": "development", - "naos.dodona.be": "staging", - "dodona.be": "production", -}; - export function initSentry(): void { - const environment = window.location.hostname in HOST_TO_ENVIRONMENT ? - HOST_TO_ENVIRONMENT[window.location.hostname] : "unknown"; + const environmentTag = document.querySelector("meta[name='environment']"); + const environment = environmentTag ? environmentTag.getAttribute("content") : "unknown"; + const releaseTag = document.querySelector("meta[name='version']"); + const release = releaseTag ? releaseTag.getAttribute("content") : "unknown"; // config options can be found at https://docs.sentry.io/platforms/javascript/configuration/ Sentry.init({ dsn: "https://18315b6d60f9329de56983fd94f67db9@o4507329115783168.ingest.de.sentry.io/4507333215256657", environment, + release, }); } diff --git a/app/javascript/packs/frame.js b/app/javascript/packs/frame.js index 824de94580..36022c05cd 100644 --- a/app/javascript/packs/frame.js +++ b/app/javascript/packs/frame.js @@ -1,5 +1,7 @@ import "core-js/stable"; import "regenerator-runtime/runtime"; +import { initSentry } from "sentry"; +initSentry(); // bootstrap import { Alert, Button, Collapse, Dropdown, Modal, Popover, Tab, Tooltip } from "bootstrap"; diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 112b99732b..c05777484d 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -16,6 +16,8 @@ + + "> "> diff --git a/app/views/layouts/frame.html.erb b/app/views/layouts/frame.html.erb index 4856f80575..abeada8719 100644 --- a/app/views/layouts/frame.html.erb +++ b/app/views/layouts/frame.html.erb @@ -7,6 +7,8 @@ + + <%= yield :meta_tags %> diff --git a/app/views/layouts/lti.html.erb b/app/views/layouts/lti.html.erb index 46acabf3b5..417f79b01c 100644 --- a/app/views/layouts/lti.html.erb +++ b/app/views/layouts/lti.html.erb @@ -4,6 +4,8 @@ + + <%= yield :meta_tags %> Dodona<%= " - #{@title}" if @title %> From 0817086d85754ee3285730f91d9727e879df5f9e Mon Sep 17 00:00:00 2001 From: jorg-vr Date: Tue, 4 Jun 2024 16:11:33 +0200 Subject: [PATCH 3/5] Undo send releases to sentry --- .github/workflows/deploy-naos.yml | 15 --------------- .github/workflows/deploy-production.yml | 15 --------------- .github/workflows/monthly-release.yml | 2 +- 3 files changed, 1 insertion(+), 31 deletions(-) diff --git a/.github/workflows/deploy-naos.yml b/.github/workflows/deploy-naos.yml index 6f925d2b3f..00de4f325f 100644 --- a/.github/workflows/deploy-naos.yml +++ b/.github/workflows/deploy-naos.yml @@ -32,18 +32,3 @@ jobs: token: ${{secrets.GITHUB_TOKEN}} label: deploy naos type: remove - - name: Get tag name - id: tag_name - run: echo "tag_name=$(TZ='Europe/Brussels' date +'%Y.%m.%d-%H:%M')" >> "$GITHUB_ENV" - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Create Sentry release - uses: getsentry/action-release@v1 - env: - SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - SENTRY_ORG: dodona - SENTRY_PROJECT: dodona-frontend - with: - environment: staging - version: ${{ env.tag_name }} diff --git a/.github/workflows/deploy-production.yml b/.github/workflows/deploy-production.yml index 5dde14cd2c..c6ee9f0848 100644 --- a/.github/workflows/deploy-production.yml +++ b/.github/workflows/deploy-production.yml @@ -22,18 +22,3 @@ jobs: - name: Run deploy run: | echo "deploy production $GITHUB_SHA" | ssh -p 4840 dodona@mestra.ugent.be - - name: Get tag name - id: tag_name - run: echo "tag_name=$(TZ='Europe/Brussels' date +'%Y.%m.%d-%H:%M')" >> "$GITHUB_ENV" - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Create Sentry release - uses: getsentry/action-release@v1 - env: - SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - SENTRY_ORG: dodona - SENTRY_PROJECT: dodona-frontend - with: - environment: production - version: ${{ env.tag_name }} diff --git a/.github/workflows/monthly-release.yml b/.github/workflows/monthly-release.yml index c16633488c..55919cb81c 100644 --- a/.github/workflows/monthly-release.yml +++ b/.github/workflows/monthly-release.yml @@ -9,7 +9,7 @@ jobs: steps: - name: Get tag name id: tag_name - run: echo "tag_name=$(TZ='Europe/Brussels' date +'%Y.%m')" >> "$GITHUB_ENV" + run: echo "tag_name=$(date +'%Y.%m')" >> "$GITHUB_ENV" - name: log tag name run: echo ${{ env.tag_name }} - uses: octokit/request-action@v2.x From 0c54f3b6201677316c8b35aed32c7c372062b40c Mon Sep 17 00:00:00 2001 From: jorg-vr Date: Tue, 4 Jun 2024 16:35:04 +0200 Subject: [PATCH 4/5] Update app/assets/javascripts/sentry.ts Co-authored-by: Niko Strijbol --- app/assets/javascripts/sentry.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/sentry.ts b/app/assets/javascripts/sentry.ts index 17325c4e3d..aa5711beb7 100644 --- a/app/assets/javascripts/sentry.ts +++ b/app/assets/javascripts/sentry.ts @@ -2,7 +2,7 @@ import * as Sentry from "@sentry/browser"; export function initSentry(): void { const environmentTag = document.querySelector("meta[name='environment']"); - const environment = environmentTag ? environmentTag.getAttribute("content") : "unknown"; + const environment = environmentTag?.getAttribute("content") ?? "unknown"; const releaseTag = document.querySelector("meta[name='version']"); const release = releaseTag ? releaseTag.getAttribute("content") : "unknown"; From 15c76c4017650a09cab486bf54ee9e2639880693 Mon Sep 17 00:00:00 2001 From: jorg-vr Date: Tue, 4 Jun 2024 16:35:09 +0200 Subject: [PATCH 5/5] Update app/assets/javascripts/sentry.ts Co-authored-by: Niko Strijbol --- app/assets/javascripts/sentry.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/sentry.ts b/app/assets/javascripts/sentry.ts index aa5711beb7..ed2709c561 100644 --- a/app/assets/javascripts/sentry.ts +++ b/app/assets/javascripts/sentry.ts @@ -4,7 +4,7 @@ export function initSentry(): void { const environmentTag = document.querySelector("meta[name='environment']"); const environment = environmentTag?.getAttribute("content") ?? "unknown"; const releaseTag = document.querySelector("meta[name='version']"); - const release = releaseTag ? releaseTag.getAttribute("content") : "unknown"; + const release = releaseTag?.getAttribute("content") ?? "unknown"; // config options can be found at https://docs.sentry.io/platforms/javascript/configuration/ Sentry.init({