From 788215af9947501baab4fb25f3e45decd7ef689e Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Thu, 25 Apr 2019 10:47:29 +0200 Subject: [PATCH] fix(gitlab): Revert "feat(gitlab): try merging PR on creation (#3308)" This reverts commit 8bd75923bb9bcbc708dee487a03f8cd82bf98943. Reverting until https://gitlab.com/gitlab-org/gitlab-ce/issues/56698 is fixed by GitLab --- lib/platform/gitlab/index.js | 19 +----------------- lib/workers/pr/index.js | 4 +--- .../gitlab/__snapshots__/index.spec.js.snap | 14 ------------- test/platform/gitlab/index.spec.js | 20 ------------------- .../pr/__snapshots__/index.spec.js.snap | 4 ---- 5 files changed, 2 insertions(+), 59 deletions(-) diff --git a/lib/platform/gitlab/index.js b/lib/platform/gitlab/index.js index 80e106fbcd..63c2d4308f 100644 --- a/lib/platform/gitlab/index.js +++ b/lib/platform/gitlab/index.js @@ -639,9 +639,7 @@ async function createPr( title, description, labels, - useDefaultBranch, - _, - automerge + useDefaultBranch ) { const targetBranch = useDefaultBranch ? config.defaultBranch @@ -665,21 +663,6 @@ async function createPr( if (config.prList) { config.prList.push(pr); } - if (automerge === true) { - try { - await get.put( - `projects/${config.repository}/merge_requests/${pr.iid}/merge`, - { - body: { - should_remove_source_branch: true, - merge_when_pipeline_succeeds: true, - }, - } - ); - } catch (err) /* istanbul ignore next */ { - logger.debug({ err }, 'Automerge on PR creation failed'); - } - } return pr; } diff --git a/lib/workers/pr/index.js b/lib/workers/pr/index.js index 04c9496d39..ed10431317 100644 --- a/lib/workers/pr/index.js +++ b/lib/workers/pr/index.js @@ -247,15 +247,13 @@ async function ensurePr(prConfig) { logger.info('DRY-RUN: Would create PR: ' + prTitle); pr = { number: 0, displayNumber: 'Dry run PR' }; } else { - const automergePr = config.automerge && config.automergeType === 'pr'; pr = await platform.createPr( branchName, prTitle, prBody, config.labels, false, - config.statusCheckVerify, - automergePr + config.statusCheckVerify ); logger.info({ branch: branchName, pr: pr.number }, 'PR created'); } diff --git a/test/platform/gitlab/__snapshots__/index.spec.js.snap b/test/platform/gitlab/__snapshots__/index.spec.js.snap index 4204d5a22c..971da13226 100644 --- a/test/platform/gitlab/__snapshots__/index.spec.js.snap +++ b/test/platform/gitlab/__snapshots__/index.spec.js.snap @@ -68,20 +68,6 @@ Array [ ] `; -exports[`platform/gitlab createPr(branchName, title, body) auto-accepts the MR when requested 1`] = ` -Array [ - Array [ - "projects/undefined/merge_requests/12345/merge", - Object { - "body": Object { - "merge_when_pipeline_succeeds": true, - "should_remove_source_branch": true, - }, - }, - ], -] -`; - exports[`platform/gitlab createPr(branchName, title, body) returns the PR 1`] = ` Object { "branchName": "some-branch", diff --git a/test/platform/gitlab/index.spec.js b/test/platform/gitlab/index.spec.js index 9bd9065e58..b800f76898 100644 --- a/test/platform/gitlab/index.spec.js +++ b/test/platform/gitlab/index.spec.js @@ -806,26 +806,6 @@ describe('platform/gitlab', () => { expect(pr).toMatchSnapshot(); expect(get.post.mock.calls).toMatchSnapshot(); }); - it('auto-accepts the MR when requested', async () => { - get.post.mockReturnValueOnce({ - body: { - id: 1, - iid: 12345, - }, - }); - const _ = 42; - const automerge = true; - await gitlab.createPr( - 'some-branch', - 'some-title', - 'the-body', - [], - true, - _, - automerge - ); - expect(get.put.mock.calls).toMatchSnapshot(); - }); }); describe('getPr(prNo)', () => { it('returns the PR', async () => { diff --git a/test/workers/pr/__snapshots__/index.spec.js.snap b/test/workers/pr/__snapshots__/index.spec.js.snap index 3172fb31db..f99be39f2e 100644 --- a/test/workers/pr/__snapshots__/index.spec.js.snap +++ b/test/workers/pr/__snapshots__/index.spec.js.snap @@ -67,7 +67,6 @@ Array [ Array [], false, false, - false, ] `; @@ -112,7 +111,6 @@ Array [ Array [], false, false, - true, ] `; @@ -174,7 +172,6 @@ note 2 Array [], false, false, - false, ] `; @@ -219,7 +216,6 @@ Array [ Array [], false, false, - false, ] `; -- GitLab