From caca6ec667bfc17fa3664c7971d21a2fdcc8fac9 Mon Sep 17 00:00:00 2001 From: Oleksiy Pavlenko Date: Fri, 11 Oct 2024 14:45:17 -0700 Subject: [PATCH 1/3] feat: Additional project settings related to MR discussions and pipelines must succeed Signed-off-by: Oleksiy Pavlenko --- .../report.api.md | 3 ++ .../src/actions/gitlab.examples.ts | 39 +++++++++++++++++++ .../src/actions/gitlab.ts | 18 +++++++++ 3 files changed, 60 insertions(+) diff --git a/plugins/scaffolder-backend-module-gitlab/report.api.md b/plugins/scaffolder-backend-module-gitlab/report.api.md index fa6c12e2e3..302dc1bef1 100644 --- a/plugins/scaffolder-backend-module-gitlab/report.api.md +++ b/plugins/scaffolder-backend-module-gitlab/report.api.md @@ -154,6 +154,9 @@ export function createPublishGitlabAction(options: { | undefined; topics?: string[] | undefined; visibility?: 'internal' | 'private' | 'public' | undefined; + only_allow_merge_if_all_discussions_are_resolved?: boolean | undefined; + only_allow_merge_if_pipeline_succeeds?: boolean | undefined; + allow_merge_on_skipped_pipeline?: boolean | undefined; } | undefined; branches?: diff --git a/plugins/scaffolder-backend-module-gitlab/src/actions/gitlab.examples.ts b/plugins/scaffolder-backend-module-gitlab/src/actions/gitlab.examples.ts index f7a957c32e..3015850399 100644 --- a/plugins/scaffolder-backend-module-gitlab/src/actions/gitlab.examples.ts +++ b/plugins/scaffolder-backend-module-gitlab/src/actions/gitlab.examples.ts @@ -163,4 +163,43 @@ export const examples: TemplateExample[] = [ ], }), }, + { + description: + 'Initializes a GitLab repository with pipeline must succeed and allow merge on skipped pipeline settings.', + example: yaml.stringify({ + steps: [ + { + id: 'publish', + action: 'publish:gitlab', + name: 'Publish to GitLab', + input: { + repoUrl: 'gitlab.com?repo=project_name&owner=group_name', + settings: { + only_allow_merge_if_pipeline_succeeds: true, + allow_merge_on_skipped_pipeline: true, + }, + }, + }, + ], + }), + }, + { + description: + 'Initializes a GitLab repository with setting to require all threads (discussions) on merge request to be resolved before merging.', + example: yaml.stringify({ + steps: [ + { + id: 'publish', + action: 'publish:gitlab', + name: 'Publish to GitLab', + input: { + repoUrl: 'gitlab.com?repo=project_name&owner=group_name', + settings: { + only_allow_merge_if_all_discussions_are_resolved: true, + }, + }, + }, + ], + }), + }, ]; diff --git a/plugins/scaffolder-backend-module-gitlab/src/actions/gitlab.ts b/plugins/scaffolder-backend-module-gitlab/src/actions/gitlab.ts index 1c888cff09..722e4acad4 100644 --- a/plugins/scaffolder-backend-module-gitlab/src/actions/gitlab.ts +++ b/plugins/scaffolder-backend-module-gitlab/src/actions/gitlab.ts @@ -60,6 +60,9 @@ export function createPublishGitlabAction(options: { squash_option?: 'default_off' | 'default_on' | 'never' | 'always'; topics?: string[]; visibility?: 'private' | 'internal' | 'public'; + only_allow_merge_if_all_discussions_are_resolved?: boolean; + only_allow_merge_if_pipeline_succeeds?: boolean; + allow_merge_on_skipped_pipeline?: boolean; }; branches?: Array<{ name: string; @@ -199,6 +202,21 @@ export function createPublishGitlabAction(options: { type: 'string', enum: ['private', 'public', 'internal'], }, + only_allow_merge_if_all_discussions_are_resolved: { + title: 'All threads must be resolved', + description: 'Set whether merge requests can only be merged when all the discussions are resolved.', + type: 'boolean', + }, + only_allow_merge_if_pipeline_succeeds: { + title: 'Pipelines must succeed', + description: 'Set whether merge requests can only be merged with successful pipelines. This setting is named Pipelines must succeed in the project settings.', + type: 'boolean', + }, + allow_merge_on_skipped_pipeline: { + title: 'Skipped pipelines are considered successful', + description: 'Set whether or not merge requests can be merged with skipped jobs.', + type: 'boolean', + }, }, }, branches: { From 0116c08d3862d1490e54cda87ab0e647e587ba22 Mon Sep 17 00:00:00 2001 From: blam Date: Tue, 12 Nov 2024 13:44:44 -0700 Subject: [PATCH 2/3] chore: fixing prettier Signed-off-by: blam --- .../src/actions/gitlab.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/scaffolder-backend-module-gitlab/src/actions/gitlab.ts b/plugins/scaffolder-backend-module-gitlab/src/actions/gitlab.ts index 722e4acad4..957ac0aaf7 100644 --- a/plugins/scaffolder-backend-module-gitlab/src/actions/gitlab.ts +++ b/plugins/scaffolder-backend-module-gitlab/src/actions/gitlab.ts @@ -204,17 +204,20 @@ export function createPublishGitlabAction(options: { }, only_allow_merge_if_all_discussions_are_resolved: { title: 'All threads must be resolved', - description: 'Set whether merge requests can only be merged when all the discussions are resolved.', + description: + 'Set whether merge requests can only be merged when all the discussions are resolved.', type: 'boolean', }, only_allow_merge_if_pipeline_succeeds: { title: 'Pipelines must succeed', - description: 'Set whether merge requests can only be merged with successful pipelines. This setting is named Pipelines must succeed in the project settings.', + description: + 'Set whether merge requests can only be merged with successful pipelines. This setting is named Pipelines must succeed in the project settings.', type: 'boolean', }, allow_merge_on_skipped_pipeline: { title: 'Skipped pipelines are considered successful', - description: 'Set whether or not merge requests can be merged with skipped jobs.', + description: + 'Set whether or not merge requests can be merged with skipped jobs.', type: 'boolean', }, }, From 6378047d68f721715139c13d4d5c60ce7a140664 Mon Sep 17 00:00:00 2001 From: blam Date: Tue, 12 Nov 2024 13:57:56 -0700 Subject: [PATCH 3/3] chore: fixing api-reports Signed-off-by: blam --- plugins/scaffolder-backend-module-gitlab/report.api.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/scaffolder-backend-module-gitlab/report.api.md b/plugins/scaffolder-backend-module-gitlab/report.api.md index 302dc1bef1..0cf1c41717 100644 --- a/plugins/scaffolder-backend-module-gitlab/report.api.md +++ b/plugins/scaffolder-backend-module-gitlab/report.api.md @@ -154,7 +154,9 @@ export function createPublishGitlabAction(options: { | undefined; topics?: string[] | undefined; visibility?: 'internal' | 'private' | 'public' | undefined; - only_allow_merge_if_all_discussions_are_resolved?: boolean | undefined; + only_allow_merge_if_all_discussions_are_resolved?: + | boolean + | undefined; only_allow_merge_if_pipeline_succeeds?: boolean | undefined; allow_merge_on_skipped_pipeline?: boolean | undefined; }