From 17807e0a13b8f5e518d84bd5903bdba21804bc89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Renaudeau?= Date: Sun, 17 Jun 2018 18:28:05 +0200 Subject: [PATCH] include git revision in sentry & export file name --- .eslintrc | 1 + flow-defs/globals.js | 1 + scripts/release.sh | 1 + src/components/ExportLogsBtn.js | 4 +++- src/sentry/install.js | 1 + webpack/plugins.js | 3 ++- 6 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.eslintrc b/.eslintrc index a473e83d..0cffcf1a 100644 --- a/.eslintrc +++ b/.eslintrc @@ -8,6 +8,7 @@ "__TEST__": false, "__PROD__": false, "__SENTRY_URL__": false, + "__GIT_REVISION__": false, "__PRINT_MODE__": false, "__GLOBAL_STYLES__": false, "__APP_VERSION__": false, diff --git a/flow-defs/globals.js b/flow-defs/globals.js index fd239c40..d1d1711e 100644 --- a/flow-defs/globals.js +++ b/flow-defs/globals.js @@ -6,6 +6,7 @@ declare var __PROD__: boolean declare var __ENV__: string declare var __PRINT_MODE__: string declare var __SENTRY_URL__: string +declare var __GIT_REVISION__: string declare var __GLOBAL_STYLES__: string declare var __APP_VERSION__: string declare var __STORYBOOK_ENV__: string diff --git a/scripts/release.sh b/scripts/release.sh index 8f919bbb..c6cebb5c 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -20,6 +20,7 @@ fi # TODO check if version is not already there # TODO check if local git HEAD is EXACTLY our remote master HEAD +export GIT_REVISION=`git rev-parse HEAD` export SENTRY_URL=https://db8f5b9b021048d4a401f045371701cb@sentry.io/274561 rm -rf ./node_modules/.cache yarn diff --git a/src/components/ExportLogsBtn.js b/src/components/ExportLogsBtn.js index f79c0ef7..98a5750e 100644 --- a/src/components/ExportLogsBtn.js +++ b/src/components/ExportLogsBtn.js @@ -30,7 +30,9 @@ class ExportLogsBtn extends Component<{ const reportJSON = JSON.stringify(report) const path = remote.dialog.showSaveDialog({ title: 'Export logs', - defaultPath: `ledger_export_${moment().format('YYYY-MM-DD_HHmmss')}.json`, + defaultPath: `ledgerlive-export-${moment().format( + 'YYYY.MM.DD-HH.mm.ss', + )}-${__GIT_REVISION__ || 'unversionned'}.json`, filters: [ { name: 'All Files', diff --git a/src/sentry/install.js b/src/sentry/install.js index d556339f..95a505d7 100644 --- a/src/sentry/install.js +++ b/src/sentry/install.js @@ -8,6 +8,7 @@ export default (Raven: any, shouldSendCallback: () => boolean, userId: string) = captureUnhandledRejections: true, allowSecretKey: true, release: __APP_VERSION__, + tags: { git_commit: __GIT_REVISION__ }, environment: __DEV__ ? 'development' : 'production', shouldSendCallback, }) diff --git a/webpack/plugins.js b/webpack/plugins.js index 7dc4536f..0f90e8db 100644 --- a/webpack/plugins.js +++ b/webpack/plugins.js @@ -3,7 +3,7 @@ const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer') const pkg = require('../package.json') require('../src/globals') -const { BUNDLE_ANALYZER, SENTRY_URL, STORYBOOK_ENV } = process.env +const { BUNDLE_ANALYZER, SENTRY_URL, STORYBOOK_ENV, GIT_REVISION } = process.env module.exports = type => { const plugins = [ @@ -12,6 +12,7 @@ module.exports = type => { __GLOBAL_STYLES__: JSON.stringify(__GLOBAL_STYLES__), __DEV__, __PROD__, + __GIT_REVISION__: JSON.stringify(GIT_REVISION), __SENTRY_URL__: JSON.stringify(SENTRY_URL || null), __STORYBOOK_ENV__: JSON.stringify(STORYBOOK_ENV), 'process.env.NODE_ENV': JSON.stringify(__ENV__),