Skip to content

Commit

Permalink
ref(admin): Upload sourcemaps to Sentry for the admin tool (#4441)
Browse files Browse the repository at this point in the history
Add the webpack integration for Sentry into webpack, and setup the integration
key to be passed down into the build step.
  • Loading branch information
evanh authored Jul 31, 2023
1 parent b20847b commit 0a3a57d
Show file tree
Hide file tree
Showing 5 changed files with 327 additions and 13 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/admin-sourcemaps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
on:
pull_request:
push:
branches: [master]
jobs:
build:
name: "build sourcemaps"
runs-on: ubuntu-latest
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SNUBA_SENTRY_SOURCEMAP_KEY }}
NODE_VERSION: 19.x
steps:
- uses: actions/checkout@v3
name: Checkout code
- uses: actions/setup-python@v4
with:
python-version: 3.8
- uses: actions/setup-node@v3
with:
node-version: ${{env.NODE_VERSION}}
- name: Build admin sourcemaps
run: make build-admin
6 changes: 1 addition & 5 deletions snuba/admin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,4 @@ this will start the yarn debug server and live reload your javascript changes. I

# Releasing new javascript

At time of writing, we check the compiled javscript bundle into source code (yes it's not great, if you want to fix it please do). Run this before checking in your JS changes:

```
make build-admin
```
The admin tool is automatically built as part of our normal CI flow.
1 change: 1 addition & 0 deletions snuba/admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"@tiptap/extension-placeholder": "^2.0.3",
"@tiptap/pm": "^2.0.3",
"@sentry/react": "^7.56.0",
"@sentry/webpack-plugin": "^2.4.0",
"@types/react": "^18.0.20",
"@types/react-dom": "^18.2.6",
"jest-dom": "^4.0.0",
Expand Down
11 changes: 11 additions & 0 deletions snuba/admin/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const path = require('path');
const { sentryWebpackPlugin } = require("@sentry/webpack-plugin");

module.exports = (env) => ({
entry: './static/index.tsx',
Expand All @@ -18,4 +19,14 @@ module.exports = (env) => ({
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist'),
},
devtool: "source-map", // Source map generation must be turned on
plugins: [
sentryWebpackPlugin({
org: process.env.SENTRY_ORGANIZATION,
project: process.env.SENTRY_PROJECT,
// Auth tokens can be obtained from https://sentry.io/settings/account/api/auth-tokens/
// and need `project:releases` and `org:read` scopes
authToken: process.env.SENTRY_AUTH_TOKEN,
}),
],
})
Loading

0 comments on commit 0a3a57d

Please sign in to comment.