Skip to content

Commit

Permalink
feat(RHINENG-15390): Onboard OCP Advisor to Sentry Instance (#879)
Browse files Browse the repository at this point in the history
  • Loading branch information
adonispuente authored Jan 31, 2025
1 parent 0d5f8eb commit cc6fdf4
Show file tree
Hide file tree
Showing 5 changed files with 716 additions and 353 deletions.
33 changes: 33 additions & 0 deletions .github/sentry.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: sentryInit

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

jobs:
createSentryRelease:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.commit_hash || 'refs/heads/master' }}

- name: Install dependencies
run: npm ci

- name: Build
env:
ENABLE_SENTRY: ${{ secrets.ENABLE_SENTRY }}
SENTRY_RELEASE: ${{ github.event.inputs.commit_hash && github.event.inputs.commit_hash }}
SENTRY_AUTH_TOKEN: ${{ github.event.inputs.commit_hash && secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
run: npm run build --if-present
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,6 @@ cypress/screenshots
cypress/videos

# cache
.cache/
.cache/
# Sentry Config File
.env.sentry-build-plugin
23 changes: 22 additions & 1 deletion fec.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const { resolve } = require('path');
const { sentryWebpackPlugin } = require('@sentry/webpack-plugin');

module.exports = {
appUrl: '/openshift/insights/advisor',
Expand All @@ -12,7 +13,27 @@ module.exports = {
/**
* Add additional webpack plugins
*/
plugins: [],
devtool: 'hidden-source-map',
plugins: [
// Put the Sentry Webpack plugin after all other plugins
...(process.env.ENABLE_SENTRY
? [
sentryWebpackPlugin({
...(process.env.SENTRY_AUTH_TOKEN && {
authToken: process.env.SENTRY_AUTH_TOKEN,
}),
org: 'red-hat-it',
project: 'ocp-advisor',
moduleMetadata: ({ release }) => ({
dsn: `https://[email protected]/4508683272454144`,
org: 'red-hat-it',
project: 'ocp-advisor',
release,
}),
}),
]
: []),
],
...(process.env.HOT
? { hotReload: process.env.HOT === 'true' }
: { hotReload: true }),
Expand Down
Loading

0 comments on commit cc6fdf4

Please sign in to comment.