Merge pull request #13330 from Parsifal-M/add-projectid-gitlab

Add ProjectID to the output for #10907
This commit is contained in:
Johan Haals
2022-08-26 10:01:56 +02:00
committed by GitHub
3 changed files with 13 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-scaffolder-backend': minor
---
Added `projectId` for gitlab projects to be displayed in the `gitlab:publish` output
@@ -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 () => {
@@ -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);
},
});
}