Skip to content

Commit

Permalink
fix(sentry): adding commit information to release context + avoid to …
Browse files Browse the repository at this point in the history
…create n release by n commit on dev (#5974)

* fix: source map

* fix: source map

* fix: sentry secret

* fix: config

* fix: config

* fix: config

* fix: config

* fix: config

* fix: config

* fix: done

* fix: done

* fix: test
  • Loading branch information
maxgfr authored Jun 20, 2024
1 parent 2bdc92f commit 2195b5d
Show file tree
Hide file tree
Showing 6 changed files with 282 additions and 213 deletions.
2 changes: 1 addition & 1 deletion .kontinuous/env/dev/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
buildArgs:
NEXT_PUBLIC_SENTRY_DSN: https://[email protected]/107
NEXT_PUBLIC_SENTRY_ENV: dev
NEXT_PUBLIC_SENTRY_RELEASE: "{{.Values.global.sha}}"
NEXT_PUBLIC_SENTRY_RELEASE: "{{.Values.global.branchSlug32}}"
NEXT_PUBLIC_BUCKET_DEFAULT_FOLDER: "default"
NEXT_PUBLIC_BUCKET_SITEMAP_FOLDER: "sitemap"
NEXT_PUBLIC_BUCKET_URL: https://cdtn-prod-public.s3.gra.io.cloud.ovh.net/preview
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ USER 1000
COPY --from=dist --chown=1000:1000 /dep/packages/code-du-travail-frontend/.next /app/packages/code-du-travail-frontend/.next
COPY --from=dist --chown=1000:1000 /dep/packages/code-du-travail-frontend/package.json /app/packages/code-du-travail-frontend/package.json
COPY --from=dist --chown=1000:1000 /dep/packages/code-du-travail-frontend/public /app/packages/code-du-travail-frontend/public
COPY --from=dist --chown=1000:1000 /dep/packages/code-du-travail-frontend/next.config.js /app/packages/code-du-travail-frontend/next.config.js
COPY --from=dist --chown=1000:1000 /dep/packages/code-du-travail-frontend/next.config.mjs /app/packages/code-du-travail-frontend/next.config.mjs
COPY --from=dist --chown=1000:1000 /dep/packages/code-du-travail-frontend/instrumentation.ts /app/packages/code-du-travail-frontend/instrumentation.ts
COPY --from=dist --chown=1000:1000 /dep/packages/code-du-travail-frontend/sentry.client.config.ts /app/packages/code-du-travail-frontend/sentry.client.config.ts
COPY --from=dist --chown=1000:1000 /dep/packages/code-du-travail-frontend/sentry.server.config.ts /app/packages/code-du-travail-frontend/sentry.server.config.ts
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import { withSentryConfig } from "@sentry/nextjs";
import MappingReplacement from "./redirects.json" assert { type: "json" };

const ContentSecurityPolicy = `
default-src 'self' *.travail.gouv.fr *.data.gouv.fr *.fabrique.social.gouv.fr;
img-src 'self' data: *.fabrique.social.gouv.fr https://travail-emploi.gouv.fr https://mon-entreprise.urssaf.fr https://www.service-public.fr https://cdtn-prod-public.s3.gra.io.cloud.ovh.net;
Expand All @@ -11,15 +14,20 @@ worker-src 'self' blob:;
child-src 'self' blob:;
`;

const { withSentryConfig } = require("@sentry/nextjs");
const MappingReplacement = require("./redirects");

const sentryConfig = {
org: process.env.NEXT_PUBLIC_SENTRY_ORG,
project: process.env.NEXT_PUBLIC_SENTRY_PROJECT,
authToken: process.env.SENTRY_AUTH_TOKEN,
release: { name: process.env.NEXT_PUBLIC_SENTRY_RELEASE },
sentryUrl: process.env.NEXT_PUBLIC_SENTRY_URL,
authToken: process.env.SENTRY_AUTH_TOKEN,
release: {
name: process.env.NEXT_PUBLIC_SENTRY_RELEASE,
setCommits: process.env.NEXT_PUBLIC_COMMIT
? {
repo: "SocialGouv/code-du-travail-numerique",
commit: process.env.NEXT_PUBLIC_COMMIT,
}
: { auto: true },
},
hideSourceMaps: true,
widenClientFileUpload: true,
};
Expand Down Expand Up @@ -86,4 +94,4 @@ const moduleExports = {
},
};

module.exports = withSentryConfig(moduleExports, sentryConfig);
export default withSentryConfig(moduleExports, sentryConfig);
6 changes: 3 additions & 3 deletions packages/code-du-travail-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"@opentelemetry/instrumentation-generic-pool": "^0.37.0",
"@opentelemetry/instrumentation-http": "^0.52.0",
"@opentelemetry/instrumentation-net": "^0.37.0",
"@sentry/nextjs": "^8.9.2",
"@sentry/nextjs": "^8.10.0",
"@socialgouv/cdtn-elasticsearch": "^2.44.2",
"@socialgouv/cdtn-logger": "^2.0.0",
"@socialgouv/cdtn-types": "^2.42.3",
Expand All @@ -62,7 +62,7 @@
"lit": "2.6.1",
"lodash.deburr": "^4.1.0",
"memoizee": "^0.4.15",
"next": "14.2.3",
"next": "14.2.4",
"p-debounce": "^2.1.0",
"prop-types": "^15.8.1",
"publicodes": "1.0.0-beta.60",
Expand Down Expand Up @@ -94,7 +94,7 @@
"cypress-html-validate": "^6.1.0",
"cypress-iframe": "^1.0.1",
"eslint": "8.57.0",
"eslint-config-next": "14.1.0",
"eslint-config-next": "14.2.4",
"eslint-plugin-cypress": "^2.12.1",
"eslint-plugin-storybook": "^0.8.0",
"jest": "^29.7.0",
Expand Down
7 changes: 3 additions & 4 deletions packages/code-du-travail-frontend/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
{
"compilerOptions": {
"target": "es6",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": false,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"strictNullChecks": true,
"incremental": true,
"forceConsistentCasingInFileNames": true,
"strictNullChecks": true,
"downlevelIteration": true
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
Expand Down
Loading

0 comments on commit 2195b5d

Please sign in to comment.