diff --git a/docs/usage/configuration-options.md b/docs/usage/configuration-options.md index 750e96b8d98c0b..d889328df0e85e 100644 --- a/docs/usage/configuration-options.md +++ b/docs/usage/configuration-options.md @@ -705,6 +705,13 @@ If you enabled `automerge` in the Renovate config, you can speed up the automerg Caution (fixed in GitLab >= 12.7): when this option is enabled it is possible due to a bug in GitLab that MRs with failing pipelines might still get merged. This is caused by a race condition in GitLab's Merge Request API - [read the corresponding issue](https://gitlab.com/gitlab-org/gitlab/issues/26293) for details. +## gitLabIgnoreApprovals + +Ignore the default project level approval(s), so that Renovate bot can automerge its merge requests, without needing approval(s). +Under the hood, it creates a MR-level approval rule where `approvals_required` is set to `0`. +This option works only when `automerge=true`, `automergeType=pr` and `gitLabAutomerge=true`. +Also, approval rules overriding should not be [prevented in GitLab settings](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/settings.html#prevent-overrides-of-default-approvals). + ## golang Configuration added here applies for all Go-related updates, however currently the only supported package manager for Go is the native Go Modules (the `gomod` manager). diff --git a/lib/config/definitions.ts b/lib/config/definitions.ts index 26290fa07ebea7..014877a1e161f7 100644 --- a/lib/config/definitions.ts +++ b/lib/config/definitions.ts @@ -1892,7 +1892,13 @@ const options: RenovateOptions[] = [ }, { name: 'gitLabAutomerge', - description: `Enable or disable usage of GitLab's "merge when pipeline succeeds" feature when automerging PRs.`, + description: `Enable or disable usage of GitLab's "merge when pipeline succeeds" feature when automerging MRs.`, + type: 'boolean', + default: false, + }, + { + name: 'gitLabIgnoreApprovals', + description: `Ignore approval rules for MRs created by Renovate, which is useful for automerge.`, type: 'boolean', default: false, }, diff --git a/lib/platform/gitlab/__snapshots__/index.spec.ts.snap b/lib/platform/gitlab/__snapshots__/index.spec.ts.snap index 64478dadb7a950..4a26be961c2328 100644 --- a/lib/platform/gitlab/__snapshots__/index.spec.ts.snap +++ b/lib/platform/gitlab/__snapshots__/index.spec.ts.snap @@ -141,6 +141,108 @@ Array [ ] `; +exports[`platform/gitlab/index createPr(branchName, title, body) adds approval rule to ignore all approvals 1`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate, br", + "authorization": "Bearer some-token", + "host": "gitlab.com", + "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", + }, + "method": "GET", + "url": "https://gitlab.com/api/v4/user", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate, br", + "authorization": "Bearer some-token", + "host": "gitlab.com", + "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", + }, + "method": "GET", + "url": "https://gitlab.com/api/v4/version", + }, + Object { + "body": "{\\"source_branch\\":\\"some-branch\\",\\"target_branch\\":\\"master\\",\\"remove_source_branch\\":true,\\"title\\":\\"some-title\\",\\"description\\":\\"the-body\\",\\"labels\\":\\"\\"}", + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate, br", + "authorization": "Bearer abc123", + "content-length": "142", + "content-type": "application/json", + "host": "gitlab.com", + "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", + }, + "method": "POST", + "url": "https://gitlab.com/api/v4/projects/undefined/merge_requests", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate, br", + "authorization": "Bearer abc123", + "host": "gitlab.com", + "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", + }, + "method": "GET", + "url": "https://gitlab.com/api/v4/projects/undefined/merge_requests/12345/approval_rules", + }, + Object { + "body": "{\\"name\\":\\"renovateIgnoreApprovals\\",\\"approvals_required\\":0}", + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate, br", + "authorization": "Bearer abc123", + "content-length": "57", + "content-type": "application/json", + "host": "gitlab.com", + "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", + }, + "method": "POST", + "url": "https://gitlab.com/api/v4/projects/undefined/merge_requests/12345/approval_rules", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate, br", + "authorization": "Bearer abc123", + "host": "gitlab.com", + "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", + }, + "method": "GET", + "url": "https://gitlab.com/api/v4/projects/undefined/merge_requests/12345", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate, br", + "authorization": "Bearer abc123", + "host": "gitlab.com", + "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", + }, + "method": "GET", + "url": "https://gitlab.com/api/v4/projects/undefined/merge_requests/12345", + }, + Object { + "body": "{\\"should_remove_source_branch\\":true,\\"merge_when_pipeline_succeeds\\":true}", + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate, br", + "authorization": "Bearer abc123", + "content-length": "72", + "content-type": "application/json", + "host": "gitlab.com", + "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", + }, + "method": "PUT", + "url": "https://gitlab.com/api/v4/projects/undefined/merge_requests/12345/merge", + }, +] +`; + exports[`platform/gitlab/index createPr(branchName, title, body) auto-accepts the MR when requested 1`] = ` Array [ Object { @@ -218,6 +320,94 @@ Array [ ] `; +exports[`platform/gitlab/index createPr(branchName, title, body) does not try to create already existing approval rule 1`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate, br", + "authorization": "Bearer some-token", + "host": "gitlab.com", + "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", + }, + "method": "GET", + "url": "https://gitlab.com/api/v4/user", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate, br", + "authorization": "Bearer some-token", + "host": "gitlab.com", + "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", + }, + "method": "GET", + "url": "https://gitlab.com/api/v4/version", + }, + Object { + "body": "{\\"source_branch\\":\\"some-branch\\",\\"target_branch\\":\\"master\\",\\"remove_source_branch\\":true,\\"title\\":\\"some-title\\",\\"description\\":\\"the-body\\",\\"labels\\":\\"\\"}", + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate, br", + "authorization": "Bearer abc123", + "content-length": "142", + "content-type": "application/json", + "host": "gitlab.com", + "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", + }, + "method": "POST", + "url": "https://gitlab.com/api/v4/projects/undefined/merge_requests", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate, br", + "authorization": "Bearer abc123", + "host": "gitlab.com", + "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", + }, + "method": "GET", + "url": "https://gitlab.com/api/v4/projects/undefined/merge_requests/12345/approval_rules", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate, br", + "authorization": "Bearer abc123", + "host": "gitlab.com", + "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", + }, + "method": "GET", + "url": "https://gitlab.com/api/v4/projects/undefined/merge_requests/12345", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate, br", + "authorization": "Bearer abc123", + "host": "gitlab.com", + "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", + }, + "method": "GET", + "url": "https://gitlab.com/api/v4/projects/undefined/merge_requests/12345", + }, + Object { + "body": "{\\"should_remove_source_branch\\":true,\\"merge_when_pipeline_succeeds\\":true}", + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate, br", + "authorization": "Bearer abc123", + "content-length": "72", + "content-type": "application/json", + "host": "gitlab.com", + "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", + }, + "method": "PUT", + "url": "https://gitlab.com/api/v4/projects/undefined/merge_requests/12345/merge", + }, +] +`; + exports[`platform/gitlab/index createPr(branchName, title, body) returns the PR 1`] = ` Object { "displayNumber": "Merge Request #12345", @@ -270,6 +460,108 @@ Array [ ] `; +exports[`platform/gitlab/index createPr(branchName, title, body) silently ignores approval rules adding errors 1`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate, br", + "authorization": "Bearer some-token", + "host": "gitlab.com", + "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", + }, + "method": "GET", + "url": "https://gitlab.com/api/v4/user", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate, br", + "authorization": "Bearer some-token", + "host": "gitlab.com", + "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", + }, + "method": "GET", + "url": "https://gitlab.com/api/v4/version", + }, + Object { + "body": "{\\"source_branch\\":\\"some-branch\\",\\"target_branch\\":\\"master\\",\\"remove_source_branch\\":true,\\"title\\":\\"some-title\\",\\"description\\":\\"the-body\\",\\"labels\\":\\"\\"}", + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate, br", + "authorization": "Bearer abc123", + "content-length": "142", + "content-type": "application/json", + "host": "gitlab.com", + "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", + }, + "method": "POST", + "url": "https://gitlab.com/api/v4/projects/undefined/merge_requests", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate, br", + "authorization": "Bearer abc123", + "host": "gitlab.com", + "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", + }, + "method": "GET", + "url": "https://gitlab.com/api/v4/projects/undefined/merge_requests/12345/approval_rules", + }, + Object { + "body": "{\\"name\\":\\"renovateIgnoreApprovals\\",\\"approvals_required\\":0}", + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate, br", + "authorization": "Bearer abc123", + "content-length": "57", + "content-type": "application/json", + "host": "gitlab.com", + "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", + }, + "method": "POST", + "url": "https://gitlab.com/api/v4/projects/undefined/merge_requests/12345/approval_rules", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate, br", + "authorization": "Bearer abc123", + "host": "gitlab.com", + "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", + }, + "method": "GET", + "url": "https://gitlab.com/api/v4/projects/undefined/merge_requests/12345", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate, br", + "authorization": "Bearer abc123", + "host": "gitlab.com", + "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", + }, + "method": "GET", + "url": "https://gitlab.com/api/v4/projects/undefined/merge_requests/12345", + }, + Object { + "body": "{\\"should_remove_source_branch\\":true,\\"merge_when_pipeline_succeeds\\":true}", + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate, br", + "authorization": "Bearer abc123", + "content-length": "72", + "content-type": "application/json", + "host": "gitlab.com", + "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", + }, + "method": "PUT", + "url": "https://gitlab.com/api/v4/projects/undefined/merge_requests/12345/merge", + }, +] +`; + exports[`platform/gitlab/index createPr(branchName, title, body) supports draftPR on < 13.2 1`] = ` Object { "displayNumber": "Merge Request #12345", diff --git a/lib/platform/gitlab/index.spec.ts b/lib/platform/gitlab/index.spec.ts index d01c005d2c103d..5ad17600ec672b 100644 --- a/lib/platform/gitlab/index.spec.ts +++ b/lib/platform/gitlab/index.spec.ts @@ -1379,6 +1379,135 @@ describe(getName(), () => { }); expect(httpMock.getTrace()).toMatchSnapshot(); }); + + it('adds approval rule to ignore all approvals', async () => { + await initPlatform('13.3.6-ee'); + httpMock + .scope(gitlabApiHost) + .post('/api/v4/projects/undefined/merge_requests') + .reply(200, { + id: 1, + iid: 12345, + title: 'some title', + }) + .get('/api/v4/projects/undefined/merge_requests/12345') + .reply(200) + .get('/api/v4/projects/undefined/merge_requests/12345') + .reply(200, { + merge_status: 'can_be_merged', + pipeline: { + id: 29626725, + sha: '2be7ddb704c7b6b83732fdd5b9f09d5a397b5f8f', + ref: 'patch-28', + status: 'success', + }, + }) + .put('/api/v4/projects/undefined/merge_requests/12345/merge') + .reply(200) + .get('/api/v4/projects/undefined/merge_requests/12345/approval_rules') + .reply(200, []) + .post('/api/v4/projects/undefined/merge_requests/12345/approval_rules') + .reply(200); + await gitlab.createPr({ + sourceBranch: 'some-branch', + targetBranch: 'master', + prTitle: 'some-title', + prBody: 'the-body', + labels: [], + platformOptions: { + azureAutoComplete: false, + gitLabAutomerge: true, + gitLabIgnoreApprovals: true, + }, + }); + expect(httpMock.getTrace()).toMatchSnapshot(); + }); + + it('does not try to create already existing approval rule', async () => { + await initPlatform('13.3.6-ee'); + httpMock + .scope(gitlabApiHost) + .post('/api/v4/projects/undefined/merge_requests') + .reply(200, { + id: 1, + iid: 12345, + title: 'some title', + }) + .get('/api/v4/projects/undefined/merge_requests/12345') + .reply(200) + .get('/api/v4/projects/undefined/merge_requests/12345') + .reply(200, { + merge_status: 'can_be_merged', + pipeline: { + id: 29626725, + sha: '2be7ddb704c7b6b83732fdd5b9f09d5a397b5f8f', + ref: 'patch-28', + status: 'success', + }, + }) + .put('/api/v4/projects/undefined/merge_requests/12345/merge') + .reply(200) + .get('/api/v4/projects/undefined/merge_requests/12345/approval_rules') + .reply(200, [ + { name: 'renovateIgnoreApprovals', approvals_required: 0 }, + ]); + await gitlab.createPr({ + sourceBranch: 'some-branch', + targetBranch: 'master', + prTitle: 'some-title', + prBody: 'the-body', + labels: [], + platformOptions: { + azureAutoComplete: false, + gitLabAutomerge: true, + gitLabIgnoreApprovals: true, + }, + }); + expect(httpMock.getTrace()).toMatchSnapshot(); + }); + + it('silently ignores approval rules adding errors', async () => { + await initPlatform('13.3.6-ee'); + httpMock + .scope(gitlabApiHost) + .post('/api/v4/projects/undefined/merge_requests') + .reply(200, { + id: 1, + iid: 12345, + title: 'some title', + }) + .get('/api/v4/projects/undefined/merge_requests/12345') + .reply(200) + .get('/api/v4/projects/undefined/merge_requests/12345') + .reply(200, { + merge_status: 'can_be_merged', + pipeline: { + id: 29626725, + sha: '2be7ddb704c7b6b83732fdd5b9f09d5a397b5f8f', + ref: 'patch-28', + status: 'success', + }, + }) + .put('/api/v4/projects/undefined/merge_requests/12345/merge') + .reply(200) + .get('/api/v4/projects/undefined/merge_requests/12345/approval_rules') + .reply(200, []) + .post('/api/v4/projects/undefined/merge_requests/12345/approval_rules') + .replyWithError('Unknown'); + await gitlab.createPr({ + sourceBranch: 'some-branch', + targetBranch: 'master', + prTitle: 'some-title', + prBody: 'the-body', + labels: [], + platformOptions: { + azureAutoComplete: false, + gitLabAutomerge: true, + gitLabIgnoreApprovals: true, + }, + }); + expect(httpMock.getTrace()).toMatchSnapshot(); + }); }); describe('getPr(prNo)', () => { it('returns the PR', async () => { diff --git a/lib/platform/gitlab/index.ts b/lib/platform/gitlab/index.ts index 28eecfa1c19a9e..390770348b46b4 100644 --- a/lib/platform/gitlab/index.ts +++ b/lib/platform/gitlab/index.ts @@ -436,12 +436,35 @@ export async function getPrList(): Promise { return config.prList; } +async function ignoreApprovals(pr: number): Promise { + try { + const url = `projects/${config.repository}/merge_requests/${pr}/approval_rules`; + const { body: rules } = await gitlabApi.getJson<{ name: string }[]>(url); + const ruleName = 'renovateIgnoreApprovals'; + const zeroApproversRule = rules?.find(({ name }) => name === ruleName); + if (!zeroApproversRule) { + await gitlabApi.postJson(url, { + body: { + name: ruleName, + approvals_required: 0, + }, + }); + } + } catch (err) { + logger.warn({ err }, 'GitLab: Error adding approval rule'); + } +} + async function tryPrAutomerge( pr: number, platformOptions: PlatformPrOptions ): Promise { if (platformOptions?.gitLabAutomerge) { try { + if (platformOptions?.gitLabIgnoreApprovals) { + await ignoreApprovals(pr); + } + const desiredStatus = 'can_be_merged'; const retryTimes = 5; diff --git a/lib/platform/types.ts b/lib/platform/types.ts index 121245f42f8b73..3a9cc08babf5bc 100644 --- a/lib/platform/types.ts +++ b/lib/platform/types.ts @@ -78,6 +78,7 @@ export type PlatformPrOptions = { azureWorkItemId?: number; bbUseDefaultReviewers?: boolean; gitLabAutomerge?: boolean; + gitLabIgnoreApprovals?: boolean; }; export interface CreatePRConfig { sourceBranch: string; diff --git a/lib/workers/pr/__snapshots__/index.spec.ts.snap b/lib/workers/pr/__snapshots__/index.spec.ts.snap index 19997363f4e8a0..8c734aeabab1d6 100644 --- a/lib/workers/pr/__snapshots__/index.spec.ts.snap +++ b/lib/workers/pr/__snapshots__/index.spec.ts.snap @@ -63,6 +63,7 @@ Array [ "azureWorkItemId": 0, "bbUseDefaultReviewers": true, "gitLabAutomerge": false, + "gitLabIgnoreApprovals": false, }, "prBody": "This PR contains the following updates:\\n\\n| Package | Type | Update | Change |\\n|---|---|---|---|\\n| [dummy](https://dummy.com) ([source](https://github.com/renovateapp/dummy), [changelog](https://github.com/renovateapp/dummy/changelog.md)) | devDependencies | pin | \`1.0.0\` -> \`1.1.0\` |\\n\\nšŸ“Œ **Important**: Renovate will wait until you have merged this Pin PR before creating any *upgrade* PRs for the affected packages. Add the preset \`:preserveSemverRanges\` to your config if you instead don't wish to pin dependencies.\\n\\n---\\n\\n### Release Notes\\n\\n
\\nrenovateapp/dummy\\n\\n### [\`v1.1.0\`](https://github.com/renovateapp/dummy/compare/v1.0.0...v1.1.0)\\n\\n[Compare Source](https://github.com/renovateapp/dummy/compare/v1.0.0...v1.1.0)\\n\\n
\\n\\n---\\n\\n### Configuration\\n\\nšŸ“… **Schedule**: \\"before 5am\\" in timezone some timezone.\\n\\nšŸš¦ **Automerge**: Disabled by config. Please merge this manually once you are satisfied.\\n\\nā™» **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.\\n\\nšŸ”• **Ignore**: Close this PR and you won't be reminded about this update again.\\n\\n---\\n\\n - [ ] If you want to rebase/retry this PR, check this box.\\n\\n---\\n\\nThis PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).", "prTitle": "Update dependency dummy to v1.1.0", @@ -96,6 +97,7 @@ Array [ "azureWorkItemId": 0, "bbUseDefaultReviewers": true, "gitLabAutomerge": false, + "gitLabIgnoreApprovals": false, }, "prBody": "This PR contains the following updates:\\n\\n| Package | Type | Update | Change |\\n|---|---|---|---|\\n| [dummy](https://dummy.com) ([source](https://github.com/renovateapp/dummy), [changelog](https://github.com/renovateapp/dummy/changelog.md)) | devDependencies | minor | \`1.0.0\` -> \`1.1.0\` |\\n\\n---\\n\\n### Release Notes\\n\\n
\\nrenovateapp/dummy\\n\\n### [\`v1.1.0\`](https://github.com/renovateapp/dummy/compare/v1.0.0...v1.1.0)\\n\\n[Compare Source](https://github.com/renovateapp/dummy/compare/v1.0.0...v1.1.0)\\n\\n
\\n\\n---\\n\\n### Configuration\\n\\nšŸ“… **Schedule**: \\"before 5am\\" (UTC).\\n\\nšŸš¦ **Automerge**: Enabled.\\n\\nā™» **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.\\n\\nšŸ”• **Ignore**: Close this PR and you won't be reminded about this update again.\\n\\n---\\n\\n - [ ] If you want to rebase/retry this PR, check this box.\\n\\n---\\n\\nThis PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).", "prTitle": "Update dependency dummy to v1.1.0", @@ -116,6 +118,7 @@ Array [ "azureWorkItemId": 0, "bbUseDefaultReviewers": true, "gitLabAutomerge": false, + "gitLabIgnoreApprovals": false, }, "prBody": "This PR contains the following updates:\\n\\n| Package | Type | Update | Change |\\n|---|---|---|---|\\n| [gitlabdummy](https://dummy.com) ([source](https://gitlab.com/renovateapp/gitlabdummy), [changelog](https://gitlab.com/renovateapp/gitlabdummy/changelog.md)) | devDependencies | minor | \`1.0.0\` -> \`1.1.0\` |\\n\\n---\\n\\n### Configuration\\n\\nšŸ“… **Schedule**: \\"before 5am\\" (UTC).\\n\\nšŸš¦ **Automerge**: Enabled.\\n\\nā™» **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.\\n\\nšŸ”• **Ignore**: Close this PR and you won't be reminded about this update again.\\n\\n---\\n\\n - [ ] If you want to rebase/retry this PR, check this box.\\n\\n---\\n\\nThis PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).", "prTitle": "Update dependency dummy to v1.1.0", @@ -136,6 +139,7 @@ Array [ "azureWorkItemId": 0, "bbUseDefaultReviewers": true, "gitLabAutomerge": false, + "gitLabIgnoreApprovals": false, }, "prBody": "This PR contains the following updates:\\n\\n| Package | Type | Update | Change |\\n|---|---|---|---|\\n| [dummy](https://dummy.com) ([source](https://github.com/renovateapp/dummy), [changelog](https://github.com/renovateapp/dummy/changelog.md)) | devDependencies | lockFileMaintenance | \`1.0.0\` -> \`1.1.0\` |\\n| a | | | \`zzzzzz\` -> \`aaaaaaa\` |\\n| b | | pin | \`some_old_value\` -> \`some_new_value\` |\\n| c | | | \`\` -> \`\` |\\n| d | | lockFileMaintenance | \`\` -> \`\` |\\n\\nnote 1\\n\\nnote 2\\n\\n:warning: Release Notes retrieval for this PR were skipped because no github.com credentials were available.\\nIf you are using the hosted GitLab app, please follow [this guide](https://docs.renovatebot.com/install-gitlab-app/#configuring-a-token-for-githubcom-hosted-release-notes). If you are self-hosted, please see [this instruction](https://github.com/renovatebot/renovate/blob/master/docs/usage/self-hosting.md#githubcom-token-for-release-notes) instead.\\n\\nšŸ”” If you wish to disable git hash updates, add \`\\":disableDigestUpdates\\"\` to the extends array in your config.\\n\\nšŸ”§ This Pull Request updates lock files to use the latest dependency versions.\\n\\n---\\n\\n### Release Notes\\n\\n
\\nrenovateapp/dummy\\n\\n### [\`v1.1.0\`](https://github.com/renovateapp/dummy/compare/v1.0.0...v1.1.0)\\n\\n[Compare Source](https://github.com/renovateapp/dummy/compare/v1.0.0...v1.1.0)\\n\\n
\\n\\n
\\nrenovateapp/dummy\\n\\n
\\n\\n---\\n\\n### Configuration\\n\\nšŸ“… **Schedule**: At any time (no schedule defined).\\n\\nšŸš¦ **Automerge**: Disabled by config. Please merge this manually once you are satisfied.\\n\\nā™» **Rebasing**: Never, or you tick the rebase/retry checkbox.\\n\\nšŸ‘» **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://github.com/renovatebot/renovate/discussions) if that's undesired.\\n\\n---\\n\\n - [ ] If you want to rebase/retry this PR, check this box.\\n\\n---\\n\\nThis PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).", "prTitle": "Update dependency dummy to v1.1.0", @@ -156,6 +160,7 @@ Array [ "azureWorkItemId": 0, "bbUseDefaultReviewers": true, "gitLabAutomerge": false, + "gitLabIgnoreApprovals": false, }, "prBody": "This PR contains the following updates:\\n\\n| Package | Type | Update | Change |\\n|---|---|---|---|\\n| [dummy](https://dummy.com) ([source](https://github.com/renovateapp/dummy), [changelog](https://github.com/renovateapp/dummy/changelog.md)) | devDependencies | minor | \`1.0.0\` -> \`1.1.0\` |\\n\\n---\\n\\n### Release Notes\\n\\n
\\nsomeproject\\n\\n### [\`v1.1.0\`](https://github.com/renovateapp/dummy/compare/v1.0.0...v1.1.0)\\n\\n[Compare Source](https://github.com/renovateapp/dummy/compare/v1.0.0...v1.1.0)\\n\\n
\\n\\n---\\n\\n### Configuration\\n\\nšŸ“… **Schedule**: At any time (no schedule defined).\\n\\nšŸš¦ **Automerge**: Disabled by config. Please merge this manually once you are satisfied.\\n\\nā™» **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.\\n\\nšŸ”• **Ignore**: Close this PR and you won't be reminded about this update again.\\n\\n---\\n\\n - [ ] If you want to rebase/retry this PR, check this box.\\n\\n---\\n\\nThis PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).", "prTitle": "Update dependency dummy to v1.1.0", diff --git a/lib/workers/pr/index.spec.ts b/lib/workers/pr/index.spec.ts index 4d0e5f62ea85a0..9e4772a7092b09 100644 --- a/lib/workers/pr/index.spec.ts +++ b/lib/workers/pr/index.spec.ts @@ -628,11 +628,13 @@ describe(getName(), () => { it('should trigger GitLab automerge when configured', async () => { config.gitLabAutomerge = true; + config.gitLabIgnoreApprovals = true; config.automerge = true; await prWorker.ensurePr(config); const args = platform.createPr.mock.calls[0]; expect(args[0].platformOptions).toMatchObject({ gitLabAutomerge: true, + gitLabIgnoreApprovals: true, }); }); diff --git a/lib/workers/pr/index.ts b/lib/workers/pr/index.ts index b4bd2b75b9a236..a05022d9d89563 100644 --- a/lib/workers/pr/index.ts +++ b/lib/workers/pr/index.ts @@ -124,6 +124,7 @@ export function getPlatformPrOptions( config.automerge && config.automergeType === 'pr' && config.gitLabAutomerge, + gitLabIgnoreApprovals: config.gitLabIgnoreApprovals, }; }