Skip to content
Merged
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
Expand Up @@ -2,6 +2,12 @@

## Unreleased

### New Features

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

### Fixes

- Fixed a bug that prevented project IDs from being used with the `sentry-cli releases new` command for users with self-hosted Sentry instances on versions older than 25.12.1 ([#3068](https://github.com/getsentry/sentry-cli/issues/3068)).

## 3.0.3
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(
['deploys', 'new', '--release', 'my-version', '--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(
[
'deploys',
'new',
'-p',
'proj-a',
'-p',
'proj-b',
'--release',
'my-version',
'--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 = ['deploys', 'new']
.concat(helper.getProjectFlagsFromOptions(options))
.concat(['--release', release]);
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 all projects associated with the release.
*/
projects?: string[];
}

/**
Expand Down