Skip to content

Commit

Permalink
Support self-hosted servers
Browse files Browse the repository at this point in the history
  • Loading branch information
Exelord committed Nov 13, 2019
1 parent 2193204 commit 606bdbb
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Add plugin config to your `config/deploy.js`:
appName: 'sentry-app-name',
orgName: 'sentry-org-name',
authToken: process.env.SENTRY_AUTH_TOKEN
// url: 'https://your-custom-sentry-server.test/` // in case of self-hosted server
}
}
```
Expand Down
8 changes: 6 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ module.exports = {

environment(context) {
return context.deployTarget;
}
},

url: ''
},

requiredConfig: ['appName', 'orgName', 'authToken'],
Expand Down Expand Up @@ -70,11 +72,13 @@ module.exports = {
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_AUTH_TOKEN=${authToken} ` +
`SENTRY_PROJECT=${appName} ` +
`SENTRY_AUTH_TOKEN=${authToken} ` +
`node_modules/.bin/sentry-cli ${command}`
);
},
Expand Down
21 changes: 15 additions & 6 deletions tests/unit/index-nodetest.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,15 @@ describe('sentry-cli', function() {

assert.equal(plugin.readConfig('environment'), 'my-production');
});

it('url', function() {
const plugin = Plugin.createDeployPlugin({ name: 'sentry-cli' });

plugin.beforeHook(this.context);
plugin.configure(this.context);

assert.equal(plugin.readConfig('url'), '');
});
});
});

Expand All @@ -150,8 +159,8 @@ describe('sentry-cli', function() {

this.sinon.assert.calledWithExactly(stub,
'SENTRY_ORG=my-org ' +
'SENTRY_AUTH_TOKEN=my-auth-token ' +
'SENTRY_PROJECT=my-project ' +
'SENTRY_AUTH_TOKEN=my-auth-token ' +
'node_modules/.bin/sentry-cli releases new [email protected]@1234567');
});

Expand All @@ -165,8 +174,8 @@ describe('sentry-cli', function() {

this.sinon.assert.calledWithExactly(stub,
'SENTRY_ORG=my-org ' +
'SENTRY_AUTH_TOKEN=my-auth-token ' +
'SENTRY_PROJECT=my-project ' +
'SENTRY_AUTH_TOKEN=my-auth-token ' +
'node_modules/.bin/sentry-cli releases set-commits --auto [email protected]@1234567');
});

Expand All @@ -180,8 +189,8 @@ describe('sentry-cli', function() {

this.sinon.assert.calledWithExactly(stub,
'SENTRY_ORG=my-org ' +
'SENTRY_AUTH_TOKEN=my-auth-token ' +
'SENTRY_PROJECT=my-project ' +
'SENTRY_AUTH_TOKEN=my-auth-token ' +
'node_modules/.bin/sentry-cli releases files [email protected]@1234567 upload-sourcemaps --rewrite my-dest-dir/assets');
});

Expand All @@ -195,8 +204,8 @@ describe('sentry-cli', function() {

this.sinon.assert.calledWithExactly(stub,
'SENTRY_ORG=my-org ' +
'SENTRY_AUTH_TOKEN=my-auth-token ' +
'SENTRY_PROJECT=my-project ' +
'SENTRY_AUTH_TOKEN=my-auth-token ' +
'node_modules/.bin/sentry-cli releases finalize [email protected]@1234567');
});
});
Expand All @@ -212,8 +221,8 @@ describe('sentry-cli', function() {

this.sinon.assert.calledWithExactly(stub,
'SENTRY_ORG=my-org ' +
'SENTRY_AUTH_TOKEN=my-auth-token ' +
'SENTRY_PROJECT=my-project ' +
'SENTRY_AUTH_TOKEN=my-auth-token ' +
'node_modules/.bin/sentry-cli releases deploys [email protected]@1234567 new -e my-production');
});
});
Expand All @@ -229,8 +238,8 @@ describe('sentry-cli', function() {

this.sinon.assert.calledWithExactly(stub,
'SENTRY_ORG=my-org ' +
'SENTRY_AUTH_TOKEN=my-auth-token ' +
'SENTRY_PROJECT=my-project ' +
'SENTRY_AUTH_TOKEN=my-auth-token ' +
'node_modules/.bin/sentry-cli releases delete [email protected]@1234567');
});
});
Expand Down

0 comments on commit 606bdbb

Please sign in to comment.