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

ref(admin): Upload sourcemaps to Sentry for the admin tool #4441

Merged
merged 7 commits into from
Jul 31, 2023
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
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 }}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@asottile-sentry I don't think this question was answered: how do I go about getting this secret set up?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the team which owns the repo (I believe sns) should have admin to add / alter repository-specific secrets

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect, thank you for all your help!

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