Skip to content

Commit

Permalink
fix(sentry): Update Sentry Flow (#1352)
Browse files Browse the repository at this point in the history
  • Loading branch information
adonispuente authored Jan 28, 2025
1 parent 4fcd08d commit 310a3f0
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 35 deletions.
26 changes: 18 additions & 8 deletions .github/workflows/webpack.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
name: uploadSourceMaps
name: sentryInit

on:
push:
branches:
- master
workflow_dispatch:
inputs:
commit_hash:
description: 'The commit hash (or branch/tag) to build'
required: true
default: 'master'
required: false
default: ''

jobs:
createSentryRelease:
Expand All @@ -15,17 +18,24 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.commit_hash }}
ref: ${{ github.event.inputs.commit_hash || 'refs/heads/master' }}

- name: Install dependencies
env:
SENTRY_RELEASE: ${{ github.event.inputs.commit_hash }}
SENTRY_RELEASE: ${{ github.event.inputs.commit_hash || github.sha }}
run: npm ci

- name: Build
env:
SENTRY_RELEASE: ${{ github.event.inputs.commit_hash }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_RELEASE: ${{ github.event.inputs.commit_hash || github.sha }}
SENTRY_AUTH_TOKEN: ${{ github.event.inputs.commit_hash && secrets.SENTRY_AUTH_TOKEN || 'null' }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
run: npm run build --if-present
run: |
if [[ -z "${{ secrets.SENTRY_AUTH_TOKEN }}" ]]; then
echo "Building without SENTRY_AUTH_TOKEN"
npm run build --if-present
else
echo "Building with SENTRY_AUTH_TOKEN"
npm run build --if-present
fi
43 changes: 16 additions & 27 deletions fec.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,22 @@ module.exports = {
proxyVerbose: false,
devtool: 'hidden-source-map',
plugins: [
...(process.env.SENTRY_AUTH_TOKEN
? [
sentryWebpackPlugin({
authToken: process.env.SENTRY_AUTH_TOKEN,
org: 'red-hat-it',
project: 'advisor-rhel',
moduleMetadata: ({ release }) => ({
dsn: 'https://[email protected]/4505397435367424',
release,
org: 'red-hat-it',
project: 'advisor-rhel',
}),
}),
]
: [
// Justs injects the debug ids
sentryWebpackPlugin({
org: 'red-hat-it',
project: 'advisor-rhel',
moduleMetadata: ({ release }) => ({
dsn: 'https://[email protected]/4505397435367424',
release,
org: 'red-hat-it',
project: 'advisor-rhel',
}),
}),
]),
//Sentry Plugin should be at the end
process.env.ENABLE_SENTRY && [
sentryWebpackPlugin({
...(process.env.SENTRY_AUTH_TOKEN && {
authToken: process.env.SENTRY_AUTH_TOKEN,
}),
org: 'red-hat-it',
project: 'advisor-rhel',
moduleMetadata: ({ release }) => ({
dsn: `https://[email protected]/4505397435367424`,
org: 'red-hat-it',
project: 'advisor-rhel',
release,
}),
}),
],
],
moduleFederation: {
shared: [
Expand Down

0 comments on commit 310a3f0

Please sign in to comment.