Skip to content

Commit 8ebd398

Browse files
committed
feat: Support missing calls with multi-project the options
1 parent 70dbd14 commit 8ebd398

4 files changed

Lines changed: 54 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
## Features
6+
7+
- In the JavaScript API, added multi-project support to `releases.newDeploy()` method. This method now accept a `projects` option (array of project slugs), aligning them with the Rust CLI's multi-project capabilities and matching the existing behavior of `releases.new()` and `releases.uploadSourceMaps()` ([#3001](https://github.com/getsentry/sentry-cli/pull/3001)).
8+
39
## 3.0.1
410

511
### Performance Improvements

lib/releases/__tests__/index.test.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,5 +144,45 @@ describe('SentryCli releases', () => {
144144
);
145145
});
146146
});
147+
148+
describe('newDeploy', () => {
149+
test('without projects', async () => {
150+
await cli.releases.newDeploy('my-version', { env: 'production' });
151+
152+
expect(mockExecute).toHaveBeenCalledWith(
153+
['releases', 'deploys', 'my-version', 'new', '--env', 'production'],
154+
null,
155+
false,
156+
undefined,
157+
{ silent: false }
158+
);
159+
});
160+
161+
test('with projects', async () => {
162+
await cli.releases.newDeploy('my-version', {
163+
env: 'production',
164+
projects: ['proj-a', 'proj-b'],
165+
});
166+
167+
expect(mockExecute).toHaveBeenCalledWith(
168+
[
169+
'releases',
170+
'deploys',
171+
'-p',
172+
'proj-a',
173+
'-p',
174+
'proj-b',
175+
'my-version',
176+
'new',
177+
'--env',
178+
'production',
179+
],
180+
null,
181+
false,
182+
undefined,
183+
{ silent: false }
184+
);
185+
});
186+
});
147187
});
148188
});

lib/releases/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ export class Releases {
203203
* time: 1295, // deployment duration in seconds. This can be specified alternatively to `started` and `finished`
204204
* name: 'PickleRick', // human readable name for this deployment
205205
* url: 'https://example.com', // URL that points to the deployment
206+
* projects: ['project1', 'project2'], // list of projects to deploy to
206207
* });
207208
*
208209
* @param release Unique name of the release.
@@ -213,7 +214,9 @@ export class Releases {
213214
if (!options || !options.env) {
214215
throw new Error('options.env must be a valid name');
215216
}
216-
const args = ['releases', 'deploys', release, 'new'];
217+
const args = ['releases', 'deploys']
218+
.concat(helper.getProjectFlagsFromOptions(options))
219+
.concat([release, 'new']);
217220
return this.execute(helper.prepareCommand(args, DEPLOYS_OPTIONS, options), null);
218221
}
219222

lib/types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,10 @@ export type SentryCliNewDeployOptions = {
167167
* URL that points to the deployment.
168168
*/
169169
url?: string;
170+
/**
171+
* The projects to deploy the release to. If not provided, the deployment will be created for the default project.
172+
*/
173+
projects?: string[];
170174
}
171175

172176
/**

0 commit comments

Comments
 (0)