renovatebot / config-help

Please use the Discussions feature of https://github.com/renovatebot/renovate instead
https://github.com/renovatebot/renovate/discussions
MIT License
27 stars 16 forks source link

Automerge Enabled, but does not merge #639

Closed nadar closed 4 years ago

nadar commented 4 years ago

Hi, we are using this awesome renovate bot system to update our websites dependencies. What makes me curious is that it generates Pull Requests and says "Automerge: Enabled" but the bot does not merge automatically (also not in second run (3rd, etc.)) - also we have the option on GitLab to Approve Merge Request, which we did, but i does not merge either. Any help? Or is this a known config behavior?

image

This is the .renovaterc config we use:

{
   "extends":[
      ":pinVersions",
      ":separateMultipleMajorReleases",
      ":combinePatchMinorReleases",
      ":ignoreModulesAndTests",
      ":automergePatch",
      ":automergeMinor",
      ":pinSkipCi",
      "group:allNonMajor"
   ],
   "assignees":[
      "elnadar"
   ]
}
rarkins commented 4 years ago

Do you have any tests running? Renovate by default won't merge unless at least one test has passed.

nadar commented 4 years ago

There is a CI Pipeline configured, which runs successful:

image

nadar commented 4 years ago

This Merge Request triggered those Pipelines:

image

which both have been successful.

viceice commented 4 years ago

@nadar can you please provide the debug logs. There should be a hint, why automerge isn't done

nadar commented 4 years ago

Output with logLevel "info":

INFO: Repository started (repository=_THE_REPO)
"renovateVersion": "19.231.8"
INFO: Dependency extraction complete (repository=_THE_REPO)
"baseBranch": "master",
"stats": {
"managers": {
"composer": {"fileCount": 1, "depCount": 17},
"docker-compose": {"fileCount": 1, "depCount": 3},
"dockerfile": {"fileCount": 1, "depCount": 1},
"gitlabci-include": {"fileCount": 1, "depCount": 1}
},
"total": {"fileCount": 4, "depCount": 22}
},
"durationMs": 1667
INFO: Package releases lookups complete (repository=_THE_REPO)
"durationMs": 3106
INFO: Repository finished (repository=_THE_REPO)

i switched now to logLevel trace. Will post the same with "trace" level in a few minutes.

viceice commented 4 years ago

oh no, debug is enough, trace will flood

nadar commented 4 years ago

@viceice its a 1040 lines long logfile. Is there a certain part you are looking for?

I was searching for "automerge":

DEBUG: Checking if we can automerge branch (repository=__MY__REPO__, branch=renovate/luyadev-luya-bootstrap4-1.0.x)
DEBUG: mergeStatus=no automerge (repository=__MY__REPO__, branch=renovate/luyadev-luya-bootstrap4-1.0.x)
DEBUG: Ensuring PR (repository=__MY__REPO__, branch=renovate/luyadev-luya-bootstrap4-1.0.x)
DEBUG: There are 0 errors and 0 warnings (repository=__MY__REPO__, branch=renovate/luyadev-luya-bootstrap4-1.0.x)
DEBUG: getBranchPr(renovate/luyadev-luya-bootstrap4-1.0.x) (repository=__MY__REPO__, branch=renovate/luyadev-luya-bootstrap4-1.0.x)
DEBUG: Got res with 1 results (repository=__MY__REPO__, branch=renovate/luyadev-luya-bootstrap4-1.0.x)
DEBUG: getPr(27) (repository=__MY__REPO__, branch=renovate/luyadev-luya-bootstrap4-1.0.x)
DEBUG: getBranchStatus(renovate/luyadev-luya-bootstrap4-1.0.x) (repository=__MY__REPO__, branch=renovate/luyadev-luya-bootstrap4-1.0.x)
DEBUG: Got res with 2 results (repository=__MY__REPO__, branch=renovate/luyadev-luya-bootstrap4-1.0.x)
DEBUG: Found existing PR (repository=__MY__REPO__, branch=renovate/luyadev-luya-bootstrap4-1.0.x)
DEBUG: getBranchStatus(renovate/luyadev-luya-bootstrap4-1.0.x) (repository=__MY__REPO__, branch=renovate/luyadev-luya-bootstrap4-1.0.x)
DEBUG: Got res with 2 results (repository=__MY__REPO__, branch=renovate/luyadev-luya-bootstrap4-1.0.x)
DEBUG: Processing existing PR (repository=__MY__REPO__, branch=renovate/luyadev-luya-bootstrap4-1.0.x)
DEBUG: getBranchStatus(renovate/luyadev-luya-bootstrap4-1.0.x) (repository=__MY__REPO__, branch=renovate/luyadev-luya-bootstrap4-1.0.x)
DEBUG: Got res with 2 results (repository=__MY__REPO__, branch=renovate/luyadev-luya-bootstrap4-1.0.x)
DEBUG: getBranchStatus() result (repository=__MY__REPO__, branch=renovate/luyadev-luya-bootstrap4-1.0.x)
"branchStatus": "green",
"branchName": "renovate/luyadev-luya-bootstrap4-1.0.x"
DEBUG: Merge Request #27 does not need updating (repository=__MY__REPO__, branch=renovate/luyadev-luya-bootstrap4-1.0.x)
DEBUG: Checking #27 for automerge (repository=__MY__REPO__, branch=renovate/luyadev-luya-bootstrap4-1.0.x)
"automerge": true,
"automergeType": "pr",
"automergeComment": "automergeComment"
DEBUG: PR is configured for automerge (repository=__MY__REPO__, branch=renovate/luyadev-luya-bootstrap4-1.0.x)
DEBUG: getBranchStatus(renovate/luyadev-luya-bootstrap4-1.0.x) (repository=__MY__REPO__, branch=renovate/luyadev-luya-bootstrap4-1.0.x)
DEBUG: Got res with 2 results (repository=__MY__REPO__, branch=renovate/luyadev-luya-bootstrap4-1.0.x)
DEBUG: Automerging #27 (repository=__MY__REPO__, branch=renovate/luyadev-luya-bootstrap4-1.0.x)
DEBUG: No permissions to merge PR (repository=__MY__REPO__, branch=renovate/luyadev-luya-bootstrap4-1.0.x)
DEBUG: processBranch with 1 upgrades (repository=__MY__REPO__, dependencies=tecnickcom/tcpdf, branch=renovate/tecnickcom-tcpdf-6.2.x)
DEBUG: Setting baseBranch to master (repository=__MY__REPO__, branch=renovate/tecnickcom-tcpdf-6.2.x)
DEBUG: Setting baseBranch to master (repository=__MY__REPO__, branch=renovate/tecnickcom-tcpdf-6.2.x)
DEBUG: latest commit (repository=__MY__REPO__, branch=renovate/tecnickcom-tcpdf-6.2.x)
"branchName": "master",
nadar commented 4 years ago

No permissions to merge PR

:scream: Thanks for the help @viceice

Maybe it helps someone else googling for this topic:

Ensure the renovate access token has write_repository permission on GitLab.

viceice commented 4 years ago

@rarkins Maybe we should throw an automerge failure if we have no permission to merge? Or at lease add a comment

nadar commented 4 years ago

Instead of Automerge: enable i would suggest Automerge: enable but no permissions to merge. Or a comment would be good to.

ps: I updated my token and its not yet auto merged, need to debug once more.

rarkins commented 4 years ago

I think adding a MR comment would work best.

FWIW I'm not sure how Renovate could create the branch in the first place if write_repository wasn't enabled. Perhaps it got the permission from elsewhere? If so then it's not the solution, so reopening.

nadar commented 4 years ago

I found another permission "hole" (:smile:), make sure the user within this group has either write permission for the given repository or role "Maintainer" within the group. Otherwise this user is not able to merge. This fixes the problem.