Skip to content

Renovate failing to make PR on Gitea 1.16.1 #14059

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
redstonedesigner opened this issue Feb 7, 2022 · 12 comments · Fixed by go-gitea/gitea#25388
Closed

Renovate failing to make PR on Gitea 1.16.1 #14059

redstonedesigner opened this issue Feb 7, 2022 · 12 comments · Fixed by go-gitea/gitea#25388
Labels
auto:reproduction A minimal reproduction is necessary to proceed platform:gitea Gitea or Forgejo platforms status:requirements Full requirements are not yet known, so implementation should not be started

Comments

@redstonedesigner
Copy link

How are you running Renovate?

Self-hosted

If you're self-hosting Renovate, tell us what version of Renovate you run.

31.68.0

Please select which platform you are using if self-hosting.

Gitea

If you're self-hosting Renovate, tell us what version of the platform you run.

1.16.1

Was this something which used to work for you, and then stopped?

It used to work, and then stopped

Describe the bug

When attempting to post a Pull Request to a repository, there is a 422 Unprocessable Entity returned by Gitea to Renovate. This seems to be due to a malformed JSON input from Renovate to Gitea.

Relevant debug logs

Logs
 INFO: Renovate is exiting with a non-zero code due to the following logged errors
       "loggerErrors": [
         {
           "name": "renovate",
           "level": 50,
           "logContext": "21H0P7t9qc2ATU2w-6qhR",
           "repository": "Owner/Repository",
           "err": {
             "name": "HTTPError",
             "code": "ERR_NON_2XX_3XX_RESPONSE",
             "timings": {
               "start": 1644236061632,
               "socket": 1644236061633,
               "lookup": 1644236061634,
               "connect": 1644236061644,
               "secureConnect": 1644236061657,
               "upload": 1644236061658,
               "response": 1644236061745,
               "end": 1644236061747,
               "phases": {
                 "wait": 1,
                 "dns": 1,
                 "tcp": 10,
                 "tls": 13,
                 "request": 1,
                 "firstByte": 87,
                 "download": 2,
                 "total": 115
               }
             },
             "message": "Response code 422 (Unprocessable Entity)",
             "stack": "HTTPError: Response code 422 (Unprocessable Entity)\n    at Request.<anonymous> (/usr/src/app/node_modules/got/dist/source/as-promise/index.js:117:42)\n    at runMicrotasks (<anonymous>)\n    at processTicksAndRejections (internal/process/task_queues.js:95:5)",
             "options": {
               "headers": {
                 "user-agent": "RenovateBot/31.68.0 (https://github.com/renovatebot/renovate)",
                 "authorization": "***********",
                 "accept": "application/json",
                 "content-type": "application/json",
                 "content-length": "1515",
                 "accept-encoding": "gzip, deflate, br"
               },
               "url": "https://git.example.com/api/v1/repos/Owner/Repo/pulls",
               "hostType": "gitea",
               "username": "",
               "password": "",
               "method": "POST",
               "http2": false
             },
             "response": {
               "statusCode": 422,
               "statusMessage": "Unprocessable Entity",
               "body": {
                 "message": "[]: json: string unexpected end of JSON input",
                 "url": "https://git.example.com/api/swagger"
               },
               "headers": {
                 "date": "Mon, 07 Feb 2022 12:14:21 GMT",
                 "content-type": "application/json;charset=utf-8",
                 "content-length": "109",
                 "connection": "close",
                 "set-cookie": [
                   "i_like_gitea=a6aee114e463ea56; Path=/; HttpOnly; SameSite=Lax",
                   "_csrf=xy9zokjrrytCNjK6gAvriPYbfGo6MTY0NDIzNjA2MTY4MTY4ODQ1OQ; Path=/; Expires=Tue, 08 Feb 2022 12:14:21 GMT; HttpOnly; SameSite=Lax"
                 ],
                 "x-content-type-options": "nosniff",
                 "x-frame-options": "SAMEORIGIN",
                 "cf-cache-status": "DYNAMIC",
                 "expect-ct": "max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"",
                 "report-to": "{\"endpoints\":[{\"url\":\"https:\\/\\/a.nel.cloudflare.com\\/report\\/v3?s=U0M5HgqXrYP9fFuumd%2B%2BSbI6%2Feu7ssvDxOfJTDEWheTWi%2FtBvHx8PrvJjNdZ1HScXNZ4HiIfQnX2kIPLwwY2n1kz3gOOGU8s3VaMpIuF%2FldoiStJFggLax7CSIz1JtI8paoq%2FoXDlw%3D%3D\"}],\"group\":\"cf-nel\",\"max_age\":604800}",
                 "nel": "{\"success_fraction\":0,\"report_to\":\"cf-nel\",\"max_age\":604800}",
                 "server": "cloudflare",
                 "cf-ray": "6d9c8999680d639e-ORD",
                 "alt-svc": "h3=\":443\"; ma=86400, h3-29=\":443\"; ma=86400"
               },
               "httpVersion": "1.1"
             }
           },
           "msg": "Repository has unknown error"
         }```

</details>


### Have you created a minimal reproduction repository?

No reproduction repository
@redstonedesigner redstonedesigner added priority-5-triage status:requirements Full requirements are not yet known, so implementation should not be started labels Feb 7, 2022
@rarkins rarkins added the auto:reproduction A minimal reproduction is necessary to proceed label Feb 7, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Feb 7, 2022

Hi there,

Help us by making a minimal reproduction repository.

Before we can start work on your issue we first need to know exactly what's causing the current behavior. A minimal reproduction helps us with this.

To get started, please read our guide on creating a minimal reproduction to understand what is needed.

We may close the issue if you (or someone else) have not provided a minimal reproduction within two weeks. If you need more time, or are stuck, please ask for help or more time in a comment.

Good luck,

The Renovate team

@rarkins
Copy link
Collaborator

rarkins commented Feb 7, 2022

Renovate works fine with many other instances of Gitea, so unfortunately you will need to do some reproducing/troubleshooting if we are to understand what's going wrong with yours.

@rarkins rarkins added the platform:gitea Gitea or Forgejo platforms label Feb 7, 2022
@rarkins
Copy link
Collaborator

rarkins commented Feb 7, 2022

When you say:

It used to work, and then stopped

What changed? Gitea version, or Renovate version?

@redstonedesigner
Copy link
Author

I upgraded Gitea to 1.16.0 and then to 1.16.1. It worked prior to the 1.16.0 upgrade but ceased to work since then.

Renovate version is continually updated according to the latest tag on the Docker image.

@rarkins
Copy link
Collaborator

rarkins commented Feb 7, 2022

In this case we don't know if it's a Gitea change or Renovate change so need to wait for further feedback

@viceice
Copy link
Member

viceice commented Feb 8, 2022

I don't see any issues on my gitea instance

@redstonedesigner
Copy link
Author

Appears to be an upstream issue with Gtea rather than issue with Renovate.

The permissions system was changed in 1.16.0 leading to the wrong value "read-only" being returned by Renovate's permission checks, rather than "read-write". Currently, the only way to fix this is to add the Renovate user to a team with "Administrator Access" to repositories.

@xoxys
Copy link

xoxys commented Feb 24, 2022

I'm facing the same issue. @redstonedesigner is there an existing Gitea issue already?

@xoxys
Copy link

xoxys commented Feb 24, 2022

The strange thing is, it is still working on other repos on the same Gitea (v1.16.1) server. So the current operation is:

  • successful Renovate PR creation on multiple repos
  • faulty PR creation on a single repo with the same error message as in the initial issue; what looks strange to me is that the branch + commit to the branch was created and pushed successfully so "just" the PR creation fails

The described workaround does not fix the issue for me, and due to the fact that everything works on other repos this does not look like a gitea or permission issue to me.

@viceice @rarkins Would you mind reopening the issue, or should I create a new one? Thanks for your help.

@redstonedesigner
Copy link
Author

I'm facing the same issue. @redstonedesigner is there an existing Gitea issue already?

I don't believe there is currently an open issue for this on Gitea.

@viceice
Copy link
Member

viceice commented Feb 24, 2022

Open a new bug report with an exact reproduction. So it's probably a PR body issue.
Maybe you can reproduce it on https://try.gitea.io

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 27, 2022
6543 pushed a commit to go-gitea/gitea that referenced this issue Jun 22, 2023
The old code generates `structs.Repository.Permissions` with only
`access.Permission.AccessMode`, however, it should check the units too,
or the value could be incorrect. For example,
`structs.Repository.Permissions.Push` could be false even the doer has
write access to code unit.

Should fix
renovatebot/renovate#14059 (comment)
(Not reported by it, I just found it when I was looking into this bug)

---

Review tips:

The major changes are
- `modules/structs/repo.go`
https://github.com/go-gitea/gitea/pull/25388/files#diff-870406f6857117f8b03611c43fca0ab9ed6d6e76a2d0069a7c1f17e8fa9092f7
- `services/convert/repository.go`
https://github.com/go-gitea/gitea/pull/25388/files#diff-7736f6d2ae894c9edb7729a80ab89aa183b888a26a811a0c1fdebd18726a7101

And other changes are passive.
GiteaBot pushed a commit to GiteaBot/gitea that referenced this issue Jun 22, 2023
The old code generates `structs.Repository.Permissions` with only
`access.Permission.AccessMode`, however, it should check the units too,
or the value could be incorrect. For example,
`structs.Repository.Permissions.Push` could be false even the doer has
write access to code unit.

Should fix
renovatebot/renovate#14059 (comment)
(Not reported by it, I just found it when I was looking into this bug)

---

Review tips:

The major changes are
- `modules/structs/repo.go`
https://github.com/go-gitea/gitea/pull/25388/files#diff-870406f6857117f8b03611c43fca0ab9ed6d6e76a2d0069a7c1f17e8fa9092f7
- `services/convert/repository.go`
https://github.com/go-gitea/gitea/pull/25388/files#diff-7736f6d2ae894c9edb7729a80ab89aa183b888a26a811a0c1fdebd18726a7101

And other changes are passive.
6543 pushed a commit to go-gitea/gitea that referenced this issue Jun 22, 2023
Backport #25388 by @wolfogre

The old code generates `structs.Repository.Permissions` with only
`access.Permission.AccessMode`, however, it should check the units too,
or the value could be incorrect. For example,
`structs.Repository.Permissions.Push` could be false even the doer has
write access to code unit.

Should fix
renovatebot/renovate#14059 (comment)
(Not reported by it, I just found it when I was looking into this bug)

---

Review tips:

The major changes are
- `modules/structs/repo.go`
https://github.com/go-gitea/gitea/pull/25388/files#diff-870406f6857117f8b03611c43fca0ab9ed6d6e76a2d0069a7c1f17e8fa9092f7
- `services/convert/repository.go`
https://github.com/go-gitea/gitea/pull/25388/files#diff-7736f6d2ae894c9edb7729a80ab89aa183b888a26a811a0c1fdebd18726a7101

And other changes are passive.

Co-authored-by: Jason Song <[email protected]>
@viceice
Copy link
Member

viceice commented Jul 23, 2023

this is now fixed upstream in v1.20.0

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto:reproduction A minimal reproduction is necessary to proceed platform:gitea Gitea or Forgejo platforms status:requirements Full requirements are not yet known, so implementation should not be started
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants