Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sentry release information #5582

Merged
merged 5 commits into from
Jun 5, 2024
Merged
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
15 changes: 0 additions & 15 deletions .github/workflows/deploy-naos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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=$(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 }}
15 changes: 0 additions & 15 deletions .github/workflows/deploy-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,3 @@ jobs:
- name: Run deploy
run: |
echo "deploy production $GITHUB_SHA" | ssh -p 4840 [email protected]
- name: Get tag name
id: tag_name
run: echo "tag_name=$(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 }}
13 changes: 5 additions & 8 deletions app/assets/javascripts/sentry.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
import * as Sentry from "@sentry/browser";

const HOST_TO_ENVIRONMENT: Record<string, string> = {
"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?.getAttribute("content") ?? "unknown";
const releaseTag = document.querySelector("meta[name='version']");
const release = 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,
});
}
2 changes: 2 additions & 0 deletions app/javascript/packs/frame.js
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
2 changes: 2 additions & 0 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
<meta property="og:image" content="<%= root_url(locale: nil) %>social-image.png">
<meta name="msapplication-TileColor" content="#2196F3"/>
<meta name="msapplication-TileImage" content="/icon.png"/>
<meta name="version" content="<%= Dodona::Application::VERSION %>">
<meta name="environment" content="<%= Rails.env %>">
<link rel="apple-touch-icon-precomposed" href="/icon.png"/>
<link rel="shortcut icon" sizes="192x192" href="<%= @dot_icon&.any? ? "/icon-not.png" : "/icon.png" %>">
<link rel="shortcut icon" href="<%= @dot_icon&.any? ? "/favicon-not.ico" : "/favicon.ico" %>">
Expand Down
2 changes: 2 additions & 0 deletions app/views/layouts/frame.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="version" content="<%= Dodona::Application::VERSION %>">
<meta name="environment" content="<%= Rails.env %>">
<%= yield :meta_tags %>
<meta property="og:image" content="<%= root_url(locale: nil) %>icon.png">
<link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,300;0,400;0,500;0,700;1,400&display=swap" rel="stylesheet">
Expand Down
2 changes: 2 additions & 0 deletions app/views/layouts/lti.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="version" content="<%= Dodona::Application::VERSION %>">
<meta name="environment" content="<%= Rails.env %>">
<%= yield :meta_tags %>
<title>Dodona<%= " - #{@title}" if @title %></title>
<link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,300;0,400;0,500;0,700;1,400&display=swap" rel="stylesheet">
Expand Down