From 290ca43a2033c6c7f96d24f4e7a843712ac274ed Mon Sep 17 00:00:00 2001 From: Peter Macdonald Date: Wed, 24 Aug 2022 15:37:25 +0200 Subject: [PATCH 1/4] Add ProjectID to the output for #10907 Signed-off-by: Peter Macdonald --- .../src/scaffolder/actions/builtin/publish/gitlab.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/publish/gitlab.ts b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/publish/gitlab.ts index 4fe55b77a2..9fc95b1b5e 100644 --- a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/publish/gitlab.ts +++ b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/publish/gitlab.ts @@ -112,6 +112,10 @@ export function createPublishGitlabAction(options: { title: 'A URL to the root of the repository', type: 'string', }, + projectId: { + title: 'The ID of the project', + type: 'string', + }, }, }, }, @@ -214,6 +218,7 @@ export function createPublishGitlabAction(options: { ctx.output('remoteUrl', remoteUrl); ctx.output('repoContentsUrl', repoContentsUrl); + ctx.output('projectId', projectId); }, }); } From 7db961367170d21b78642da7dbd3c3cb44fb0c3f Mon Sep 17 00:00:00 2001 From: Peter Macdonald Date: Wed, 24 Aug 2022 16:07:50 +0200 Subject: [PATCH 2/4] Added Changeset Signed-off-by: Peter Macdonald --- .changeset/good-papayas-dress.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/good-papayas-dress.md diff --git a/.changeset/good-papayas-dress.md b/.changeset/good-papayas-dress.md new file mode 100644 index 0000000000..09f60263c3 --- /dev/null +++ b/.changeset/good-papayas-dress.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-scaffolder-backend': minor +--- + +added projectId for gitlab projects to be displayed in the output From ac081c133d19ddf1f76a749a0b3c67906d0007eb Mon Sep 17 00:00:00 2001 From: Peter Macdonald <13601053+Parsifal-M@users.noreply.github.com> Date: Thu, 25 Aug 2022 11:14:19 +0200 Subject: [PATCH 3/4] Update .changeset/good-papayas-dress.md Anything for Vale :) Co-authored-by: Johan Haals Signed-off-by: Peter Macdonald <13601053+Parsifal-M@users.noreply.github.com> --- .changeset/good-papayas-dress.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/good-papayas-dress.md b/.changeset/good-papayas-dress.md index 09f60263c3..26062c8da8 100644 --- a/.changeset/good-papayas-dress.md +++ b/.changeset/good-papayas-dress.md @@ -2,4 +2,4 @@ '@backstage/plugin-scaffolder-backend': minor --- -added projectId for gitlab projects to be displayed in the output +Added `projectId` for gitlab projects to be displayed in the `gitlab:publish` output From 6017734ec8e8e8a637222e17a490eb11ecc188ef Mon Sep 17 00:00:00 2001 From: Peter Macdonald Date: Thu, 25 Aug 2022 19:18:52 +0200 Subject: [PATCH 4/4] Added projectId test scenario under the outputs section Signed-off-by: Peter Macdonald --- .../src/scaffolder/actions/builtin/publish/gitlab.test.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/publish/gitlab.test.ts b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/publish/gitlab.test.ts index 27261ecd49..dc1d26d416 100644 --- a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/publish/gitlab.test.ts +++ b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/publish/gitlab.test.ts @@ -313,11 +313,12 @@ describe('publish:gitlab', () => { }); }); - it('should call output with the remoteUrl and repoContentsUrl', async () => { + it('should call output with the remoteUrl and repoContentsUrl and projectId', async () => { mockGitlabClient.Users.current.mockResolvedValue({ id: 12345 }); mockGitlabClient.Namespaces.show.mockResolvedValue({ id: 1234 }); mockGitlabClient.Projects.create.mockResolvedValue({ http_url_to_repo: 'http://mockurl.git', + id: 1234, }); await action.handler(mockContext); @@ -330,6 +331,7 @@ describe('publish:gitlab', () => { 'repoContentsUrl', 'http://mockurl/-/blob/master', ); + expect(mockContext.output).toHaveBeenCalledWith('projectId', 1234); }); it('should call the correct Gitlab APIs when setUserAsOwner option is true and integration config has a token', async () => {