From a080a2d33ecad9f5e6921e4390aedcb4ae64c5d2 Mon Sep 17 00:00:00 2001 From: JPeer264 Date: Tue, 2 Dec 2025 14:08:43 +0100 Subject: [PATCH 1/3] feat: Support missing calls with multi-project the options --- CHANGELOG.md | 6 +++++ lib/releases/__tests__/index.test.js | 40 ++++++++++++++++++++++++++++ lib/releases/index.ts | 5 +++- lib/types.ts | 4 +++ 4 files changed, 54 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4cc6483372..93e39f9a30 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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.3 ### Fixes diff --git a/lib/releases/__tests__/index.test.js b/lib/releases/__tests__/index.test.js index 491a509c9e..bffba31ab6 100644 --- a/lib/releases/__tests__/index.test.js +++ b/lib/releases/__tests__/index.test.js @@ -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 } + ); + }); + }); }); }); diff --git a/lib/releases/index.ts b/lib/releases/index.ts index c8f57adf60..120a0fe0d7 100644 --- a/lib/releases/index.ts +++ b/lib/releases/index.ts @@ -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. @@ -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); } diff --git a/lib/types.ts b/lib/types.ts index 9f0a3efa0e..f3d995e1a5 100644 --- a/lib/types.ts +++ b/lib/types.ts @@ -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. + */ + projects?: string[]; } /** From 96a15c4cba001a21d7be180a67d6c65541b34492 Mon Sep 17 00:00:00 2001 From: JPeer264 Date: Fri, 9 Jan 2026 08:11:17 +0100 Subject: [PATCH 2/3] fixup! feat: Support missing calls with multi-project the options --- lib/releases/__tests__/index.test.js | 6 +++--- lib/releases/index.ts | 4 ++-- lib/types.ts | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/releases/__tests__/index.test.js b/lib/releases/__tests__/index.test.js index bffba31ab6..ad58157886 100644 --- a/lib/releases/__tests__/index.test.js +++ b/lib/releases/__tests__/index.test.js @@ -150,7 +150,7 @@ describe('SentryCli releases', () => { await cli.releases.newDeploy('my-version', { env: 'production' }); expect(mockExecute).toHaveBeenCalledWith( - ['releases', 'deploys', 'my-version', 'new', '--env', 'production'], + ['deploys', 'new', '--release', 'my-version', '--env', 'production'], null, false, undefined, @@ -166,14 +166,14 @@ describe('SentryCli releases', () => { expect(mockExecute).toHaveBeenCalledWith( [ - 'releases', 'deploys', + 'new', '-p', 'proj-a', '-p', 'proj-b', + '--release', 'my-version', - 'new', '--env', 'production', ], diff --git a/lib/releases/index.ts b/lib/releases/index.ts index 120a0fe0d7..6cd58c3801 100644 --- a/lib/releases/index.ts +++ b/lib/releases/index.ts @@ -214,9 +214,9 @@ export class Releases { if (!options || !options.env) { throw new Error('options.env must be a valid name'); } - const args = ['releases', 'deploys'] + const args = ['deploys', 'new'] .concat(helper.getProjectFlagsFromOptions(options)) - .concat([release, 'new']); + .concat(['--release', release]); return this.execute(helper.prepareCommand(args, DEPLOYS_OPTIONS, options), null); } diff --git a/lib/types.ts b/lib/types.ts index f3d995e1a5..c33d9c66f7 100644 --- a/lib/types.ts +++ b/lib/types.ts @@ -168,7 +168,7 @@ export type SentryCliNewDeployOptions = { */ url?: string; /** - * 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[]; } From 5f339ec9c14c130843ce8d97256de0dda171870d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Peer=20St=C3=B6cklmair?= Date: Fri, 9 Jan 2026 10:12:35 +0100 Subject: [PATCH 3/3] Update CHANGELOG.md Co-authored-by: Daniel Szoke <7881302+szokeasaurusrex@users.noreply.github.com> --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 93e39f9a30..4d4aa7a736 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## Unreleased -### Improvements +### 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)).