diff --git a/.drone.yml b/.drone.yml index 22d1b81..3fe9584 100644 --- a/.drone.yml +++ b/.drone.yml @@ -33,52 +33,3 @@ steps: when: status: - failure - ---- - -kind: pipeline -name: release -trigger: - event: push - branch: release -steps: - - name: build-dist - image: node:10.16 - environment: - GH_TOKEN: - from_secret: gh_token - SENTRY_DSN: - from_secret: sentry_dsn - GA_TRACKING_ID: - from_secret: ga_tracking_id - commands: - - npm install - - npm run build:dist - - - name: build-target-win - image: proalexandr/node-wine - environment: - GH_TOKEN: - from_secret: gh_token - SENTRY_DSN: - from_secret: sentry_dsn - GA_TRACKING_ID: - from_secret: ga_tracking_id - commands: - - npm run build:target -- --win -p always - depends_on: - - build-dist - - - name: build-target-linux - image: node:10.16 - environment: - GH_TOKEN: - from_secret: gh_token - SENTRY_DSN: - from_secret: sentry_dsn - GA_TRACKING_ID: - from_secret: ga_tracking_id - commands: - - npm run build:target -- --linux -p always - depends_on: - - build-dist diff --git a/.electron-vue/plugins/sentry-webpack.js b/.electron-vue/plugins/sentry-webpack.js new file mode 100644 index 0000000..c87f2ef --- /dev/null +++ b/.electron-vue/plugins/sentry-webpack.js @@ -0,0 +1,11 @@ +const packageJson = require('../../package.json') + +const SentryWebpackPlugin = require('@sentry/webpack-plugin') + +module.exports = new SentryWebpackPlugin({ + release: `${packageJson.name}@${packageJson.version}`, + silent: true, + include: ['.'], + ignore: ['node_modules', '.electron-vue', 'build', 'cypress', 'test', 'src'], + configFile: 'sentry.properties' +}) diff --git a/.electron-vue/webpack.main.config.js b/.electron-vue/webpack.main.config.js index e82db26..ec32276 100644 --- a/.electron-vue/webpack.main.config.js +++ b/.electron-vue/webpack.main.config.js @@ -3,17 +3,17 @@ process.env.BABEL_ENV = 'main' const path = require('path') -const { dependencies } = require('../package.json') const webpack = require('webpack') -const BabiliWebpackPlugin = require('babili-webpack-plugin') +const packageJson = require('../package.json') +const sentryWebpackPlugin = require('./plugins/sentry-webpack') let mainConfig = { entry: { main: path.join(__dirname, '../src/main/index.js') }, externals: [ - ...Object.keys(dependencies || {}) + ...Object.keys(packageJson.dependencies || {}) ], module: { rules: [ @@ -63,12 +63,14 @@ if (process.env.NODE_ENV !== 'production') { if (process.env.NODE_ENV === 'production') { mainConfig.devtool = 'source-map' - mainConfig.plugins.push( + mainConfig.plugins = [ + ...mainConfig.plugins, new webpack.DefinePlugin({ 'process.env.NODE_ENV': '"production"', 'process.env.SENTRY_DSN': `"${process.env.SENTRY_DSN}"` - }) - ) + }), + process.env.RELEASE === 'true' ? sentryWebpackPlugin : null + ].filter(Boolean) } module.exports = mainConfig diff --git a/.electron-vue/webpack.renderer.config.js b/.electron-vue/webpack.renderer.config.js index 8859032..2d6343c 100644 --- a/.electron-vue/webpack.renderer.config.js +++ b/.electron-vue/webpack.renderer.config.js @@ -3,14 +3,15 @@ process.env.BABEL_ENV = 'renderer' const path = require('path') -const { dependencies } = require('../package.json') const webpack = require('webpack') - const CopyWebpackPlugin = require('copy-webpack-plugin') const MiniCssExtractPlugin = require('mini-css-extract-plugin') const HtmlWebpackPlugin = require('html-webpack-plugin') const { VueLoaderPlugin } = require('vue-loader') +const { dependencies } = require('../package.json') +const sentryWebpackPlugin = require('./plugins/sentry-webpack') + /** * List of node_modules to include in webpack bundle * @@ -157,7 +158,8 @@ if (process.env.NODE_ENV !== 'production') { if (process.env.NODE_ENV === 'production') { rendererConfig.devtool = 'source-map' - rendererConfig.plugins.push( + rendererConfig.plugins = [ + ...rendererConfig.plugins, new CopyWebpackPlugin([ { from: path.join(__dirname, '../static'), @@ -172,8 +174,9 @@ if (process.env.NODE_ENV === 'production') { }), new webpack.LoaderOptionsPlugin({ minimize: true - }) - ) + }), + process.env.RELEASE === 'true' ? sentryWebpackPlugin : null + ].filter(Boolean) } module.exports = rendererConfig diff --git a/README.md b/README.md index 7aa4a98..d3ac0fe 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,8 @@ which will be used to connect to a resource. Let's see an example of a problem t 1) If the user tries to forward the resource in Kube Forwarder again, most likely there will be an error since a connection will be established with `remote-cluster`, not `local-cluster` as the user expected, and `remote-cluster` couldn't have `postgres` resource. -So, to avoid the error we should store the current context in a separate field. + + So, to avoid the error we should store the current context in a separate field. Screenshot 2019-07-06 at 12 04 45 @@ -218,22 +219,23 @@ npm run test:cypress:open ## Release guide -1) Be sure that you created `.env.production` and filled it in the right way. -2) Update the version in `package.json`. -3) Push to `release` branch. [Drone(pixel-point/kube-forwarder)](https://drone.pixelpoint.io/pixel-point/kube-forwarder/) -will build packages for Windows and Linux and upload them to [releases](https://github.com/pixel-point/kube-forwarder/releases) -4) Run `npm run release` on a Mac computer to build `.dmg` target. -It will be automatically pushed to releases at Github. -5) Go to [Releases](https://github.com/pixel-point/kube-forwarder/releases) in the repository. +### Configure environment + +Also, this steps could be used to configure CI environment. + +1) Copy `.env.example` to `.env.production` and fill variables. + +### Release steps + +1) Update the version in `package.json` and Push to `release` branch. +1) Run `npm run release` on a Mac computer to build packages. They will be automatically pushed to releases at Github. +1) Go to [Releases](https://github.com/pixel-point/kube-forwarder/releases) in the repository. Make sure that the created draft is OK and release it (Edit -> Release). -6) Run `cask-repair kube-forwarder` to update the cask version. +1) Run `cask-repair kube-forwarder` to update the cask version. ([https://github.com/Homebrew/homebrew-cask/blob/master/CONTRIBUTING.md#updating-a-cask](About cask-repair)) Notes: -1) `.dmg` target is added to release by your mac computer. -`.AppImage` and `.exe` have to be added to the release by drone CI. -2) A release tag (for example: `v1.0.3`) will be added automatically -by Github when you release your draft. +1) A release tag (for example: `v1.0.3`) will be added to GIT automatically by Github when you release your draft. ## Development tips diff --git a/package-lock.json b/package-lock.json index dc1e8d8..dd0054b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1391,6 +1391,28 @@ } } }, + "@sentry/cli": { + "version": "1.47.1", + "resolved": "https://registry.npmjs.org/@sentry/cli/-/cli-1.47.1.tgz", + "integrity": "sha512-WijaRu1lb99OL6rHee6uOSb1wDyNCbrWcTJoRCuZD83K2fw3U58p68nli/y8CoMwQ55Mrg6CgtY8pmBiuseG0A==", + "dev": true, + "requires": { + "fs-copy-file-sync": "^1.1.1", + "https-proxy-agent": "^2.2.1", + "mkdirp": "^0.5.1", + "node-fetch": "^2.1.2", + "progress": "2.0.0", + "proxy-from-env": "^1.0.0" + }, + "dependencies": { + "progress": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.0.tgz", + "integrity": "sha1-ihvjZr+Pwj2yvSPxDG/pILQ4nR8=", + "dev": true + } + } + }, "@sentry/core": { "version": "4.6.6", "resolved": "https://registry.npmjs.org/@sentry/core/-/core-4.6.6.tgz", @@ -1570,6 +1592,15 @@ "tslib": "^1.9.3" } }, + "@sentry/webpack-plugin": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@sentry/webpack-plugin/-/webpack-plugin-1.7.0.tgz", + "integrity": "sha512-Bfu59WLOB1QlM1WY9BD1pakeV3+wgAwRpcnH07GcIuj1fZUragaBaD3hwCIQkwvJpvC7cCoH4yL+Wp4iaVGW6Q==", + "dev": true, + "requires": { + "@sentry/cli": "^1.44.4" + } + }, "@types/caseless": { "version": "0.12.2", "resolved": "https://registry.npmjs.org/@types/caseless/-/caseless-0.12.2.tgz", @@ -8490,6 +8521,12 @@ "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", "dev": true }, + "fs-copy-file-sync": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/fs-copy-file-sync/-/fs-copy-file-sync-1.1.1.tgz", + "integrity": "sha512-2QY5eeqVv4m2PfyMiEuy9adxNP+ajf+8AR05cEi+OAzPcOj90hvFImeZhTmKLBgSd9EvG33jsD7ZRxsx9dThkQ==", + "dev": true + }, "fs-extra": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.3.tgz", @@ -12216,6 +12253,12 @@ "lower-case": "^1.1.1" } }, + "node-fetch": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz", + "integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==", + "dev": true + }, "node-forge": { "version": "0.7.5", "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.7.5.tgz", @@ -13555,6 +13598,12 @@ "ipaddr.js": "1.9.0" } }, + "proxy-from-env": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.0.0.tgz", + "integrity": "sha1-M8UDmPcOp+uW0h97gXYwpVeRx+4=", + "dev": true + }, "prr": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", diff --git a/package.json b/package.json index 044ba99..27a4004 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "build:clean": "cross-env BUILD_TARGET=clean node .electron-vue/build.js", "build:web": "cross-env BUILD_TARGET=web node .electron-vue/build.js", "upload": "./upload.sh", - "release": "npm run build -- -- -p always", + "release": "RELEASE=true npm run build -- -- -p always --mac --linux --win", "dev": "BUILD=DEV-VERSION node .electron-vue/dev-runner.js", "web": "BUILD=WEB-VERSION node .electron-vue/web-runner.js", "e2e": "npm run pack && mocha test/e2e", @@ -109,6 +109,7 @@ "@babel/plugin-transform-runtime": "^7.5.5", "@babel/preset-env": "^7.5.5", "@babel/runtime-corejs2": "^7.5.5", + "@sentry/webpack-plugin": "^1.7.0", "ajv": "^6.7.0", "babel-eslint": "^9.0.0", "babel-loader": "^8.0.0", diff --git a/src/common/configure-sentry.js b/src/common/configure-sentry.js index 215e2ad..dfa1f03 100644 --- a/src/common/configure-sentry.js +++ b/src/common/configure-sentry.js @@ -8,6 +8,7 @@ export default function configureSentry(configOverrides = {}) { if (!process.env.SENTRY_DSN) return Sentry.init({ + release: `${packageJson.name}@${packageJson.version}`, dsn: process.env.SENTRY_DSN, defaultIntegrations: false, async beforeSend(event) { diff --git a/src/renderer/components/Layout/Toolbar.vue b/src/renderer/components/Layout/Toolbar.vue index 69de5a6..935a2a6 100644 --- a/src/renderer/components/Layout/Toolbar.vue +++ b/src/renderer/components/Layout/Toolbar.vue @@ -8,7 +8,6 @@