From 34b84b4072fb3546e97319fc012d52557b4d3755 Mon Sep 17 00:00:00 2001 From: djamaile Date: Thu, 9 Jun 2022 11:50:48 +0200 Subject: [PATCH] chore: make the changes backwards compatible to ease the migration Signed-off-by: djamaile --- .changeset/forty-timers-cheer.md | 5 +++-- .../actions/builtin/publish/gitlabMergeRequest.ts | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/.changeset/forty-timers-cheer.md b/.changeset/forty-timers-cheer.md index 29815fba67..20ea9b90d4 100644 --- a/.changeset/forty-timers-cheer.md +++ b/.changeset/forty-timers-cheer.md @@ -1,5 +1,6 @@ --- -'@backstage/plugin-scaffolder-backend': minor +'@backstage/plugin-scaffolder-backend': major --- -refactored the gitlab publish merge request action to not use the `projectId` property. Instead use the `host` and `owner` property from the `RepoUrlPicker`. This decreases the amount of fields the user has to fill in. +**DEPRECATION**: The `projectid` input parameters to the `publish:gitlab:merge-request`, it's no longer required as it can be decoded from the `repoUrl` input parameter. +**DEPRECATION**: The `projectid` output of the action in favour of `projectPath` diff --git a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/publish/gitlabMergeRequest.ts b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/publish/gitlabMergeRequest.ts index ab11787f05..d163a52d26 100644 --- a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/publish/gitlabMergeRequest.ts +++ b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/publish/gitlabMergeRequest.ts @@ -40,6 +40,8 @@ export const createPublishGitlabMergeRequestAction = (options: { branchName: string; targetPath: string; token?: string; + /** @deprecated */ + projectid?: string; }>({ id: 'publish:gitlab:merge-request', schema: { @@ -52,6 +54,12 @@ export const createPublishGitlabMergeRequestAction = (options: { title: 'Repository Location', description: `Accepts the format 'gitlab.com/group_name/project_name' where 'project_name' is the repository name and 'group_name' is a group or username`, }, + /** @deprecated */ + projectid: { + type: 'string', + title: 'projectid', + description: 'Project ID/Name(slug) of the Gitlab Project', + }, title: { type: 'string', title: 'Merge Request Name', @@ -82,6 +90,10 @@ export const createPublishGitlabMergeRequestAction = (options: { output: { type: 'object', properties: { + projectid: { + title: 'Gitlab Project id/Name(slug)', + type: 'string', + }, projectPath: { title: 'Gitlab Project path', type: 'string', @@ -173,7 +185,8 @@ export const createPublishGitlabMergeRequestAction = (options: { ).then((mergeRequest: { web_url: string }) => { return mergeRequest.web_url; }); - ctx.output('project path: ', projectPath); + ctx.output('projectid', projectPath); + ctx.output('projectPath', projectPath); ctx.output('mergeRequestUrl', mergeRequestUrl); } catch (e) { throw new InputError(`Merge request creation failed${e}`);