From d3da46d95d796d8836ffda90dab257e68e0d60b2 Mon Sep 17 00:00:00 2001 From: Sinan Keskin Date: Wed, 27 May 2020 00:43:13 +0300 Subject: [PATCH 1/3] Update env variables to -- params --- index.js | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/index.js b/index.js index 438d760..f612d4b 100644 --- a/index.js +++ b/index.js @@ -25,7 +25,7 @@ module.exports = { return context.deployTarget; }, - url: '' + url: '', }, requiredConfig: ['appName', 'orgName', 'authToken'], @@ -35,16 +35,16 @@ module.exports = { const assetsDir = this.readConfig('assetsDir'); this.log('SENTRY: Creating release...'); - this.sentryCliExec(`releases new ${releaseName}`); + this.sentryCliExec(`new ${releaseName}`); this.log('SENTRY: Assigning commits...'); - this.sentryCliExec(`releases set-commits --auto ${releaseName}`); + this.sentryCliExec(`set-commits --auto ${releaseName}`); this.log('SENTRY: Uploading source maps...'); - this.sentryCliExec(`releases files ${releaseName} upload-sourcemaps --rewrite ${assetsDir}`); + this.sentryCliExec(`files ${releaseName} upload-sourcemaps --rewrite ${assetsDir}`); this.log('SENTRY: Finalizing release...'); - this.sentryCliExec(`releases finalize ${releaseName}`); + this.sentryCliExec(`finalize ${releaseName}`); this.log('SENTRY: Release published!...'); }, @@ -55,7 +55,7 @@ module.exports = { const environment = this.readConfig('environment'); this.log('SENTRY: Deploying release...'); - this.sentryCliExec(`releases deploys ${releaseName} new -e ${environment}`); + this.sentryCliExec(`deploys ${releaseName} new -e ${environment}`); this.log('SENTRY: Deployed!'); }, @@ -64,30 +64,34 @@ module.exports = { const releaseName = `${appName}@${this.readConfig('revisionKey')}`; this.log('SENTRY: Deleting release...'); - this.sentryCliExec(`releases delete ${releaseName}`); + this.sentryCliExec(`delete ${releaseName}`); this.log('SENTRY: Release deleted!'); }, - sentryCliExec(command) { + sentryCliExec(params) { const authToken = this.readConfig('authToken'); const orgName = this.readConfig('orgName'); const appName = this.readConfig('appName'); const url = this.readConfig('url'); return this._exec( - url ? `SENTRY_URL=${url} ` : '' + - `SENTRY_ORG=${orgName} ` + - `SENTRY_PROJECT=${appName} ` + - `SENTRY_AUTH_TOKEN=${authToken} ` + - `node_modules/.bin/sentry-cli ${command}` + [ + path.join('node_modules', '.bin', 'sentry-cli'), + url ? `SENTRY_URL=${url}` : '', + `--auth-token ${authToken}`, + 'releases', + `--org ${orgName}`, + `--project ${appName}`, + params, + ].join(' ') ); }, _exec(command = '') { return execSync(command, { cwd: this.project.root }); - } + }, }); return new DeployPlugin(); - } + }, }; From 26b5f5ea55fa84ca20e1b60f3f2e02037b27143a Mon Sep 17 00:00:00 2001 From: Sinan Keskin Date: Wed, 27 May 2020 00:45:38 +0300 Subject: [PATCH 2/3] Fix URL typo --- index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index f612d4b..d653bcf 100644 --- a/index.js +++ b/index.js @@ -25,7 +25,7 @@ module.exports = { return context.deployTarget; }, - url: '', + url: '' }, requiredConfig: ['appName', 'orgName', 'authToken'], @@ -77,21 +77,21 @@ module.exports = { return this._exec( [ path.join('node_modules', '.bin', 'sentry-cli'), - url ? `SENTRY_URL=${url}` : '', + url ? `--url ${url}` : '', `--auth-token ${authToken}`, 'releases', `--org ${orgName}`, `--project ${appName}`, - params, + params ].join(' ') ); }, _exec(command = '') { return execSync(command, { cwd: this.project.root }); - }, + } }); return new DeployPlugin(); - }, + } }; From 7c0a4cc49ad72de7f91aacc0034f02412a187a62 Mon Sep 17 00:00:00 2001 From: Sinan Keskin Date: Wed, 27 May 2020 14:41:04 +0300 Subject: [PATCH 3/3] Change the sentryCliExec signature --- index.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/index.js b/index.js index d653bcf..9343c09 100644 --- a/index.js +++ b/index.js @@ -35,16 +35,16 @@ module.exports = { const assetsDir = this.readConfig('assetsDir'); this.log('SENTRY: Creating release...'); - this.sentryCliExec(`new ${releaseName}`); + this.sentryCliExec('releases', `new ${releaseName}`); this.log('SENTRY: Assigning commits...'); - this.sentryCliExec(`set-commits --auto ${releaseName}`); + this.sentryCliExec('releases', `set-commits --auto ${releaseName}`); this.log('SENTRY: Uploading source maps...'); - this.sentryCliExec(`files ${releaseName} upload-sourcemaps --rewrite ${assetsDir}`); + this.sentryCliExec('releases', `files ${releaseName} upload-sourcemaps --rewrite ${assetsDir}`); this.log('SENTRY: Finalizing release...'); - this.sentryCliExec(`finalize ${releaseName}`); + this.sentryCliExec('releases', `finalize ${releaseName}`); this.log('SENTRY: Release published!...'); }, @@ -55,7 +55,7 @@ module.exports = { const environment = this.readConfig('environment'); this.log('SENTRY: Deploying release...'); - this.sentryCliExec(`deploys ${releaseName} new -e ${environment}`); + this.sentryCliExec('releases', `deploys ${releaseName} new -e ${environment}`); this.log('SENTRY: Deployed!'); }, @@ -64,11 +64,11 @@ module.exports = { const releaseName = `${appName}@${this.readConfig('revisionKey')}`; this.log('SENTRY: Deleting release...'); - this.sentryCliExec(`delete ${releaseName}`); + this.sentryCliExec('releases', `delete ${releaseName}`); this.log('SENTRY: Release deleted!'); }, - sentryCliExec(params) { + sentryCliExec(command, subCommand) { const authToken = this.readConfig('authToken'); const orgName = this.readConfig('orgName'); const appName = this.readConfig('appName'); @@ -79,10 +79,10 @@ module.exports = { path.join('node_modules', '.bin', 'sentry-cli'), url ? `--url ${url}` : '', `--auth-token ${authToken}`, - 'releases', + command, `--org ${orgName}`, `--project ${appName}`, - params + subCommand ].join(' ') ); },