Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Unreleased

### Improvements

- 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)).

## 3.0.1

### Performance Improvements
Expand Down
40 changes: 40 additions & 0 deletions lib/releases/__tests__/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,5 +144,45 @@ describe('SentryCli releases', () => {
);
});
});

describe('newDeploy', () => {
test('without projects', async () => {
await cli.releases.newDeploy('my-version', { env: 'production' });

expect(mockExecute).toHaveBeenCalledWith(
['releases', 'deploys', 'my-version', 'new', '--env', 'production'],
null,
false,
undefined,
{ silent: false }
);
});

test('with projects', async () => {
await cli.releases.newDeploy('my-version', {
env: 'production',
projects: ['proj-a', 'proj-b'],
});

expect(mockExecute).toHaveBeenCalledWith(
[
'releases',
'deploys',
'-p',
'proj-a',
'-p',
'proj-b',
'my-version',
'new',
'--env',
'production',
],
null,
false,
undefined,
{ silent: false }
);
});
});
});
});
5 changes: 4 additions & 1 deletion lib/releases/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ export class Releases {
* time: 1295, // deployment duration in seconds. This can be specified alternatively to `started` and `finished`
* name: 'PickleRick', // human readable name for this deployment
* url: 'https://example.com', // URL that points to the deployment
* projects: ['project1', 'project2'], // list of projects to deploy to
* });
*
* @param release Unique name of the release.
Expand All @@ -213,7 +214,9 @@ export class Releases {
if (!options || !options.env) {
throw new Error('options.env must be a valid name');
}
const args = ['releases', 'deploys', release, 'new'];
const args = ['releases', 'deploys']
.concat(helper.getProjectFlagsFromOptions(options))
.concat([release, 'new']);
return this.execute(helper.prepareCommand(args, DEPLOYS_OPTIONS, options), null);
}

Expand Down
4 changes: 4 additions & 0 deletions lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ export type SentryCliNewDeployOptions = {
* URL that points to the deployment.
*/
url?: string;
/**
* The projects to deploy the release to. If not provided, the deployment will be created for the default project.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* The projects to deploy the release to. If not provided, the deployment will be created for the default project.
* The projects to deploy the release to. If not provided, the deployment will be created for all projects associated with the release.

*/
projects?: string[];
}

/**
Expand Down