Skip to content
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
8 changes: 1 addition & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,7 @@ jobs:
run: yarn ci --filter=@navikt/${{ inputs.app }}
env:
VITE_SENTRY_RELEASE: ${{ steps.sentry_release_key.outputs.SENTRY_RELEASE }}

- name: Opprett release med Sentry
if: inputs.push-image
run: yarn sentry-release
env:
SENTRY_RELEASE: ${{ steps.sentry_release_key.outputs.SENTRY_RELEASE }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
VITE_SENTRY_AUTH_TOKEN: ${{ inputs.push-image && secrets.SENTRY_AUTH_TOKEN || '' }}

- name: Bygg server
run: cd ./server && yarn install --immutable && yarn build
Expand Down
1 change: 1 addition & 0 deletions apps/fp-avdelingsleder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"@navikt/ft-form-validators": "4.2.14",
"@navikt/ft-ui-komponenter": "6.2.11",
"@navikt/ft-utils": "3.8.13",
"@sentry/vite-plugin": "4.6.0",
"@tanstack/react-query": "5.90.6",
"@tanstack/react-query-devtools": "5.90.2",
"dayjs": "1.11.19",
Expand Down
2 changes: 1 addition & 1 deletion apps/fp-avdelingsleder/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if (app === null) {
throw new Error('No app element');
}

initSentry();
initSentry('fp-avdelingsleder');

const root = createRoot(app);

Expand Down
14 changes: 14 additions & 0 deletions apps/fp-avdelingsleder/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/// <reference types="vitest" />
import { mergeConfig } from 'vite';
import { sentryVitePlugin } from '@sentry/vite-plugin';

import { createSharedAppConfig } from '@navikt/fp-config-vite';

Expand Down Expand Up @@ -27,4 +28,17 @@ export default mergeConfig(createSharedAppConfig(), {
},
},
},
plugins: [
// Put the Sentry vite plugin after all other plugins
sentryVitePlugin({
authToken: process.env.VITE_SENTRY_AUTH_TOKEN, // Kommer fra Github organization secrets
disable: !process.env.VITE_SENTRY_AUTH_TOKEN, // Ikke last opp source maps hvis token ikke er satt. Token er bare satt når det bygges fra master branch
org: 'nav',
project: 'fp-avdelingsleder',
url: 'https://sentry.gc.nav.no',
release: {
name: process.env.VITE_SENTRY_RELEASE,
},
}),
],
});
1 change: 1 addition & 0 deletions apps/fp-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
"@navikt/ft-ui-komponenter": "6.2.11",
"@navikt/ft-utils": "3.8.13",
"@popperjs/core": "2.11.8",
"@sentry/vite-plugin": "4.6.0",
"@tanstack/react-query": "5.90.6",
"@tanstack/react-query-devtools": "5.90.2",
"classnames": "2.5.1",
Expand Down
2 changes: 1 addition & 1 deletion apps/fp-frontend/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if (app === null) {
throw new Error('No app element');
}

initSentry();
initSentry('fp-frontend');

const root = createRoot(app);

Expand Down
14 changes: 14 additions & 0 deletions apps/fp-frontend/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/// <reference types="vitest" />
import { mergeConfig } from 'vite';
import { sentryVitePlugin } from '@sentry/vite-plugin';

import { createSharedAppConfig } from '@navikt/fp-config-vite';

Expand Down Expand Up @@ -38,4 +39,17 @@ export default mergeConfig(createSharedAppConfig(), {
},
},
},
plugins: [
// Put the Sentry vite plugin after all other plugins
sentryVitePlugin({
authToken: process.env.VITE_SENTRY_AUTH_TOKEN, // Kommer fra Github organization secrets
disable: !process.env.VITE_SENTRY_AUTH_TOKEN, // Ikke last opp source maps hvis token ikke er satt. Token er bare satt når det bygges fra master branch
org: 'nav',
project: 'fp-frontend',
url: 'https://sentry.gc.nav.no',
release: {
name: process.env.VITE_SENTRY_RELEASE,
},
}),
],
});
1 change: 1 addition & 0 deletions apps/fp-journalforing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"@navikt/ft-form-validators": "4.2.14",
"@navikt/ft-ui-komponenter": "6.2.11",
"@navikt/ft-utils": "3.8.13",
"@sentry/vite-plugin": "4.6.0",
"@tanstack/react-query": "5.90.6",
"@tanstack/react-query-devtools": "5.90.2",
"dayjs": "1.11.19",
Expand Down
2 changes: 1 addition & 1 deletion apps/fp-journalforing/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const app = document.getElementById('root');
if (app === null) {
throw new Error('No app element');
}
initSentry();
initSentry('fp-journalforing');

const root = createRoot(app);

Expand Down
14 changes: 14 additions & 0 deletions apps/fp-journalforing/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/// <reference types="vitest" />
import { mergeConfig } from 'vite';
import { sentryVitePlugin } from '@sentry/vite-plugin';

import { createSharedAppConfig } from '@navikt/fp-config-vite';

Expand Down Expand Up @@ -27,4 +28,17 @@ export default mergeConfig(createSharedAppConfig(), {
},
},
},
plugins: [
// Put the Sentry vite plugin after all other plugins
sentryVitePlugin({
authToken: process.env.VITE_SENTRY_AUTH_TOKEN, // Kommer fra Github organization secrets
disable: !process.env.VITE_SENTRY_AUTH_TOKEN, // Ikke last opp source maps hvis token ikke er satt. Token er bare satt når det bygges fra master branch
org: 'nav',
project: 'fp-journalforing',
url: 'https://sentry.gc.nav.no',
release: {
name: process.env.VITE_SENTRY_RELEASE,
},
}),
],
});
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
"remove-node-modules": "find . -name \"node_modules\" -exec rm -rf '{}' +",
"build:storybook": "turbo run build-storybook && yarn storybook-create-deploy-folder",
"storybook-create-deploy-folder": "node scripts/create-storybook-index.cjs",
"sentry-release": "node ./scripts/sentry-release.cjs",
"prepare": "husky install",
"update-swagger": "node scripts/hent-openapi-spec.js",
"generate:local": "yarn update-swagger lokal && openapi-ts",
Expand All @@ -42,7 +41,6 @@
"devDependencies": {
"@hey-api/openapi-ts": "0.86.11",
"@navikt/aksel-stylelint": "7.33.0",
"@sentry/cli": "2.57.0",
"@storybook/addon-a11y": "10.0.2",
"@storybook/addon-links": "10.0.2",
"@storybook/react": "10.0.2",
Expand Down
15 changes: 13 additions & 2 deletions packages/app-felles/src/initSentry.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
import { breadcrumbsIntegration, init } from '@sentry/browser';

export const initSentry = () => {
export const initSentry = (app: 'fp-frontend' | 'fp-journalforing' | 'fp-avdelingsleder') => {
init({
dsn: 'https://d1b7de8cc42949569da03849b47d3ea1@sentry.gc.nav.no/17',
dsn: getDsn(app),
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
release: import.meta.env['VITE_SENTRY_RELEASE'] ?? 'unknown',
environment: globalThis.location.hostname,
enabled: import.meta.env.MODE !== 'development',
integrations: [breadcrumbsIntegration({ console: false })],
});
};

const getDsn = (app: 'fp-frontend' | 'fp-journalforing' | 'fp-avdelingsleder') => {
switch (app) {
case 'fp-frontend':
return 'https://d1b7de8cc42949569da03849b47d3ea1@sentry.gc.nav.no/17';
case 'fp-avdelingsleder':
return 'https://acfe5c7d102b49aa1b622345dc6cd0c0@sentry.gc.nav.no/184';
case 'fp-journalforing':
return 'https://e3fbcf06855a6a4caf8d9c8e1e92479b@sentry.gc.nav.no/185';
}
};
36 changes: 0 additions & 36 deletions scripts/sentry-release.cjs

This file was deleted.

2 changes: 1 addition & 1 deletion turbo.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://turbo.build/schema.json",
"globalPassThroughEnv": ["VITE_SENTRY_RELEASE"],
"globalPassThroughEnv": ["VITE_SENTRY_RELEASE", "VITE_SENTRY_AUTH_TOKEN "],
"globalDependencies": [
"turbo.json",
"yarn.lock",
Expand Down
Loading
Loading