Renovate: "automerge": true does not work on gitlab? (I think it used to)

Created on 1 Feb 2019  路  19Comments  路  Source: renovatebot/renovate

What Renovate type are you using?
Renovate CLI, Renovate GitHub App, or Renovate Pro?

GitLab

Describe the bug

automerge used to work, now it does not.my repo is here: https://gitlab.com/NullVoxPopuli/emberclear (open source)

Did you see anything helpful in debug logs?
I am overwhelmed by the debug logs and don't know what to search for :-\
https://renovatebot.com/dashboard#gitlab/NullVoxPopuli/emberclear

To Reproduce
unknown

Expected behavior
When C.I. passes, the PR should be merged

gitlab priority-3-normal bug

All 19 comments

Re: the logs. First filter by branch, and then look for any line mentioning "automerge"

thanks, I'll report back when I get another dep update :+1:

I checked the logs and both your branches on the last run printed this message: https://github.com/renovatebot/renovate/blob/0355b7558e86a2f8bf834f69e5d8ed4806e1e488/lib/platform/gitlab/index.js#L693

This means that the GitLab API is returning pr.merge_status === 'cannot_be_merged'

It's not possible to troubleshoot deeper now because the MRs are merged, but naturally Renovate won't merge if it thinks the API is returning that they can't be merged. It may not be a Renovate problem at all, but next time you have a PR open that you think should be merged then please query the GitLab API to check what metadata is returned. Comment here if you think it's Renovate's mistake and I'll reopen.

Here is one with an unmerged PR: https://renovatebot.com/dashboard#gitlab/NullVoxPopuli/emberclear/43148426

babel-eslint

The CI passed :/

The logs say No permissions to merge PR

This means it's getting back a 401 response when it attempts to merge: https://github.com/renovatebot/renovate/blob/0fffecb63629a1395dda143ccb7a8615cbfe4e69/lib/platform/gitlab/index.js#L773-L776

It has the Developer role, which has permissions to merge
:/

screenshot_20190202-092428

I've added a debug of the err that GitLab returns, in case it has any fields in it that give us a hint as to why. It should be live in the hosted app within 1-2 hours.

The error message doesn't help:

{
  "repository": "NullVoxPopuli\/emberclear",
  "branch": "renovate\/babel-eslint-10.x",
  "dependencies": [
    "babel-eslint"
  ],
  "err": {
    "name": "GitLabError",
    "hostname": "gitlab.com",
    "method": "PUT",
    "path": "\/api\/v4\/projects\/NullVoxPopuli%2Femberclear\/merge_requests\/214\/merge",
    "protocol": "https:",
    "url": "https:\/\/gitlab.com\/api\/v4\/projects\/NullVoxPopuli%2Femberclear\/merge_requests\/214\/merge",
    "gotOptions": {
      "path": "\/api\/v4\/projects\/NullVoxPopuli%2Femberclear\/merge_requests\/214\/merge",
      "protocol": "https:",
      "hostname": "gitlab.com",
      "hash": "",
      "search": "",
      "pathname": "\/api\/v4\/projects\/NullVoxPopuli%2Femberclear\/merge_requests\/214\/merge",
      "href": "https:\/\/gitlab.com\/api\/v4\/projects\/NullVoxPopuli%2Femberclear\/merge_requests\/214\/merge",
      "retry": {
        "methods": {

        },
        "statusCodes": {

        },
        "errorCodes": {

        }
      },
      "headers": {
        "user-agent": "https:\/\/github.com\/singapore\/gl-got",
        "accept": "application\/json",
        "accept-encoding": "gzip, deflate",
        "content-type": "application\/json",
        "PRIVATE-TOKEN": "[**redacted**]",
        "content-length": 36
      },
      "hooks": {
        "beforeRequest": [

        ],
        "beforeRedirect": [

        ],
        "beforeRetry": [

        ],
        "afterResponse": [

        ]
      },
      "decompress": true,
      "throwHttpErrors": true,
      "followRedirect": true,
      "stream": false,
      "form": false,
      "json": true,
      "cache": false,
      "useElectronNet": false,
      "baseUrl": "https:\/\/gitlab.com\/api\/v4\/",
      "name": "GitLab",
      "token": "[**redacted**]",
      "platform": "gitlab",
      "default": true,
      "body": "{\"should_remove_source_branch\":true}",
      "method": "PUT"
    },
    "statusCode": 401,
    "statusMessage": "Unauthorized",
    "headers": {
      "server": "nginx",
      "date": "Sat, 02 Feb 2019 15:17:30 GMT",
      "content-type": "application\/json",
      "content-length": "30",
      "connection": "close",
      "cache-control": "no-cache",
      "vary": "Origin",
      "x-content-type-options": "nosniff",
      "x-frame-options": "SAMEORIGIN",
      "x-request-id": "TGOrDUSEnC3",
      "x-runtime": "0.072143",
      "ratelimit-limit": "600",
      "ratelimit-observed": "8",
      "ratelimit-remaining": "592",
      "ratelimit-reset": "1549120710",
      "ratelimit-resettime": "Sun, 02 Feb 2019 15:18:30 GMT"
    },
    "body": {
      "message": "401 Unauthorized"
    },
    "message": "401 Unauthorized (401)",
    "stack": "GitLabError: 401 Unauthorized (401)\n    at EventEmitter.emitter.on (\/usr\/src\/node_modules\/got\/source\/as-promise.js:74:19)\n    at process._tickCallback (internal\/process\/next_tick.js:68:7)"
  },
  "msg": "merge PR error",
  "time": "2019-02-02T15:17:30.255Z"
}

This is what I see as a non-collaborator on the project:

image

According to https://docs.gitlab.com/ee/api/merge_requests.html#accept-mr:

If you don鈥檛 have permissions to accept this merge request - you鈥檒l get a 401

@leipert I don't suppose you have any GitLab ninja skills that can shed some light? e.g. is it possible that the bot account can't accept (merge) its own MR?

this is what I see:
image

so, according to GitLab's permissions table:
image

(see at the bottom)
I wonder if this is an issue with them? I'll ask their twitter

@NullVoxPopuli / @rarkins I am having a look 馃憖

I have found this issue, but it references an older version:
https://gitlab.com/gitlab-org/gitlab-ce/issues/56981

So the button in an MR uses another API, and not the publicly documented one (/v4/). I am trying to reproduce and file an issue accordingly.

image

@NullVoxPopuli Could it be that your master branch is protected? https://docs.gitlab.com/ee/user/project/protected_branches.html

Because then only maintainers are able to merge! Could you check your settings and set "Allowed to merge" to "Maintainers and Developers"?
screenshot 2019-02-02 at 19 05 20

that very well may be!
I just changed my settings to:
image

that seemed to do it. :+1: thanks!

Was this page helpful?
0 / 5 - 0 ratings