Skip to content

Commit 606bdbb

Browse files
committed
Support self-hosted servers
1 parent 2193204 commit 606bdbb

File tree

3 files changed

+22
-8
lines changed

3 files changed

+22
-8
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Add plugin config to your `config/deploy.js`:
3535
appName: 'sentry-app-name',
3636
orgName: 'sentry-org-name',
3737
authToken: process.env.SENTRY_AUTH_TOKEN
38+
// url: 'https://your-custom-sentry-server.test/` // in case of self-hosted server
3839
}
3940
}
4041
```

index.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ module.exports = {
2323

2424
environment(context) {
2525
return context.deployTarget;
26-
}
26+
},
27+
28+
url: ''
2729
},
2830

2931
requiredConfig: ['appName', 'orgName', 'authToken'],
@@ -70,11 +72,13 @@ module.exports = {
7072
const authToken = this.readConfig('authToken');
7173
const orgName = this.readConfig('orgName');
7274
const appName = this.readConfig('appName');
75+
const url = this.readConfig('url');
7376

7477
return this._exec(
78+
url ? `SENTRY_URL=${url} ` : '' +
7579
`SENTRY_ORG=${orgName} ` +
76-
`SENTRY_AUTH_TOKEN=${authToken} ` +
7780
`SENTRY_PROJECT=${appName} ` +
81+
`SENTRY_AUTH_TOKEN=${authToken} ` +
7882
`node_modules/.bin/sentry-cli ${command}`
7983
);
8084
},

tests/unit/index-nodetest.js

+15-6
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,15 @@ describe('sentry-cli', function() {
136136

137137
assert.equal(plugin.readConfig('environment'), 'my-production');
138138
});
139+
140+
it('url', function() {
141+
const plugin = Plugin.createDeployPlugin({ name: 'sentry-cli' });
142+
143+
plugin.beforeHook(this.context);
144+
plugin.configure(this.context);
145+
146+
assert.equal(plugin.readConfig('url'), '');
147+
});
139148
});
140149
});
141150

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

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

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

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

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

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

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

196205
this.sinon.assert.calledWithExactly(stub,
197206
'SENTRY_ORG=my-org ' +
198-
'SENTRY_AUTH_TOKEN=my-auth-token ' +
199207
'SENTRY_PROJECT=my-project ' +
208+
'SENTRY_AUTH_TOKEN=my-auth-token ' +
200209
'node_modules/.bin/sentry-cli releases finalize [email protected]@1234567');
201210
});
202211
});
@@ -212,8 +221,8 @@ describe('sentry-cli', function() {
212221

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

230239
this.sinon.assert.calledWithExactly(stub,
231240
'SENTRY_ORG=my-org ' +
232-
'SENTRY_AUTH_TOKEN=my-auth-token ' +
233241
'SENTRY_PROJECT=my-project ' +
242+
'SENTRY_AUTH_TOKEN=my-auth-token ' +
234243
'node_modules/.bin/sentry-cli releases delete [email protected]@1234567');
235244
});
236245
});

0 commit comments

Comments
 (0)