Skip to content
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

Git clone is failing when blobs filter is unavailable on platform #13440

Closed
zharinov opened this issue Jan 9, 2022 · 13 comments
Closed

Git clone is failing when blobs filter is unavailable on platform #13440

zharinov opened this issue Jan 9, 2022 · 13 comments
Labels
status:requirements Full requirements are not yet known, so implementation should not be started type:bug Bug fix of existing functionality

Comments

@zharinov
Copy link
Collaborator

zharinov commented Jan 9, 2022

How are you running Renovate?

Self-hosted

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

Latest

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.

Latest

Describe the bug

Gitea doesn't support shallow clone yet, which causes our our HTTPS authenticated clone to fail.

❯ git clone --filter=blob:none https://try.gitea.io/zharinov/shallow-test.git
Cloning into 'shallow-test'...
fatal: error reading section header 'shallow-info'

❯ git clone --filter=blob:none [email protected]:zharinov/shallow-test.git
Cloning into 'shallow-test'...
warning: filtering not recognized by server, ignoring
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (3/3), done.

Relevant debug logs

Logs
DEBUG: Performing blobless clone (repository=zharinov/shallow-test)
DEBUG: git clone error (repository=zharinov/shallow-test)
       "err": {
         "task": {
           "commands": [
             "clone",
             "--filter=blob:none",
             "https://**redacted**@try.gitea.io/zharinov/shallow-test.git",
             "."
           ],
           "format": "utf-8",
           "parser": "[function]"
         },
         "message": "Cloning into '.'...\nfatal: error reading section header 'shallow-info'\n",
         "stack": "Error: Cloning into '.'...\nfatal: error reading section header 'shallow-info'\n\n    at Object.action (/Users/sergio/Work/renovate/node_modules/simple-git/src/lib/plugins/error-detection.plugin.ts:38:28)\n    at PluginStore.exec (/Users/sergio/Work/renovate/node_modules/simple-git/src/lib/plugins/plugin-store.ts:24:29)\n    at /Users/sergio/Work/renovate/node_modules/simple-git/src/lib/runners/git-executor-chain.ts:114:40\n    at new Promise (<anonymous>)\n    at GitExecutorChain.handleTaskData (/Users/sergio/Work/renovate/node_modules/simple-git/src/lib/runners/git-executor-chain.ts:111:14)\n    at GitExecutorChain.<anonymous> (/Users/sergio/Work/renovate/node_modules/simple-git/src/lib/runners/git-executor-chain.ts:88:40)\n    at Generator.next (<anonymous>)\n    at fulfilled (/Users/sergio/Work/renovate/node_modules/simple-git/src/lib/runners/git-executor-chain.js:5:58)"
       }
 WARN: Host error (repository=zharinov/shallow-test)
       "hostType": "git",
       "lookupName": undefined,
       "err": {
         "task": {
           "commands": [
             "clone",
             "--filter=blob:none",
             "https://**redacted**@try.gitea.io/zharinov/shallow-test.git",
             "."
           ],
           "format": "utf-8",
           "parser": "[function]"
         },
         "message": "Cloning into '.'...\nfatal: error reading section header 'shallow-info'\n",
         "stack": "Error: Cloning into '.'...\nfatal: error reading section header 'shallow-info'\n\n    at Object.action (/Users/sergio/Work/renovate/node_modules/simple-git/src/lib/plugins/error-detection.plugin.ts:38:28)\n    at PluginStore.exec (/Users/sergio/Work/renovate/node_modules/simple-git/src/lib/plugins/plugin-store.ts:24:29)\n    at /Users/sergio/Work/renovate/node_modules/simple-git/src/lib/runners/git-executor-chain.ts:114:40\n    at new Promise (<anonymous>)\n    at GitExecutorChain.handleTaskData (/Users/sergio/Work/renovate/node_modules/simple-git/src/lib/runners/git-executor-chain.ts:111:14)\n    at GitExecutorChain.<anonymous> (/Users/sergio/Work/renovate/node_modules/simple-git/src/lib/runners/git-executor-chain.ts:88:40)\n    at Generator.next (<anonymous>)\n    at fulfilled (/Users/sergio/Work/renovate/node_modules/simple-git/src/lib/runners/git-executor-chain.js:5:58)"
       }
 INFO: External host error causing abort - skipping (repository=zharinov/shallow-test)
DEBUG: Unknown res (repository=zharinov/shallow-test)
       "res": "external-host-error"

Have you created a minimal reproduction repository?

https://try.gitea.io/zharinov/shallow-test

@zharinov zharinov added type:bug Bug fix of existing functionality status:requirements Full requirements are not yet known, so implementation should not be started priority-5-triage labels Jan 9, 2022
@zharinov zharinov changed the title Fail to perform blob-less clone for Gitea platform Failure to perform blob-less clone for Gitea platform Jan 9, 2022
@viceice
Copy link
Member

viceice commented Jan 9, 2022

You can enable it in gitea.

@viceice
Copy link
Member

viceice commented Jan 9, 2022

@zharinov
Copy link
Collaborator Author

zharinov commented Jan 9, 2022

Thank you, now I see. So, maybe log this link for this particular stack trace?

@viceice
Copy link
Member

viceice commented Jan 9, 2022

You need this in .gitconfig:

[uploadpack]
        allowfilter = true

Are you using the official docker image?

@zharinov
Copy link
Collaborator Author

zharinov commented Jan 9, 2022

No, I've just tried to run with their public test instance.

@viceice
Copy link
Member

viceice commented Jan 9, 2022

🤔 For me it works even without the upload filter, but it will do a full clone then automatically. Maybe they have some extra filtering on the test instance?

@zharinov zharinov changed the title Failure to perform blob-less clone for Gitea platform Git clone is failing when blobs filter is unavailable on platform Jan 9, 2022
@zharinov
Copy link
Collaborator Author

zharinov commented Jan 9, 2022

Possible ways to fix are:

  • Make fullClone configurable by the Renovate admin
  • Graceful fallback to full cloning
  • Make stacktrace more user-friendly by pointing to relevant platform docs

@bprins
Copy link

bprins commented Jan 25, 2022

🤔 For me it works even without the upload filter, but it will do a full clone then automatically. Maybe they have some extra filtering on the test instance?

I'm having the same issue as @zharinov using the gitea official docker image (git version 2.30.2) without explicitly disabling clone filters (so enabled by default). Adding allowfilter = true to the my gitea .gitconfig [uploadpack] section fixed it.

@proton-ab
Copy link
Contributor

proton-ab commented Jan 29, 2022

This might've changed on Gitea side very recently. v1.15 should work as @viceice mentioned (no configuration necessary) while v1.16-rc1 requires explicitly enabling allowfilter = true in .gitconfig. Interestingly this has worked in v1.16 before rc1, so the change must've happened very recently (last 3 weeks or so of v1.16 development cycle before feature-freeze for rc1).

The reason this happens on test instance is because they always use newest development version there.

Possibly introduced by go-gitea/gitea#18195 but without doing full bisect it's going to be hard to debug, they've been doing lot of changes near internals on how they handle Git commands overall.

Regardless of cause, I think falling back to full cloning with a warning seems like a good idea - there's no good reason to fail here. See below for more detailed analysis - I no longer think that Renovate should be doing anything to address it at the moment.

@viceice
Copy link
Member

viceice commented Jan 29, 2022

That pr explicit enables filters, so it should just work.

Are you using the official docker image? As the filter only work with git 2.22+. See PR changes.

@proton-ab
Copy link
Contributor

Are you using the official docker image? As the filter only work with git 2.22+. See PR changes.

Using 1.16.0-rc1-rootless for Gitea and custom image based on renovate/renovate:31-slim with PHP, composer and golang built-in (updated daily).

Both meet requirements:

# docker run -ti ***/renovate sh
$ git --version
git version 2.35.0

# docker exec -ti gitea sh
$ git --version
git version 2.30.2

That pr explicit enables filters, so it should just work.

Indeed, it should - yet it doesn't, unless

[uploadpack]
  allowfilter = true

is added to .gitconfig.


Root cause analysis

It used to work on previous development snapshot of v1.16 and I can pinpoint it to specific and and hour:

-rw-r--r-- 1 renovate renovate 473784 Jan 27 03:04 renovate-270120220300.log
-rw-r--r-- 1 renovate renovate  34663 Jan 27 04:00 renovate-270120220400.log

The time matches when Gitea was upgraded to rc1 - during that time it has executed migrations 205,206,207,208 which means that the issue was introduced on Gitea between 6fe756dc93f3704079d942f0a29966b61aed8aec and 623c93ff46798e86636dba24f5a48bb35e12b9a5. Sadly Gitea does not log its own version when starting up so I can not pinpoint the exact commit that it has been upgraded from.

Immediately after upgrade it started failing for these with:

2022/01/27 04:00:09 ...ers/web/repo/http.go:502:serviceRPC() [E] Fail to serve RPC(upload-pack) in /var/lib/repos/***/***.git: exit status 128 - fatal: unexpected line: 'filter blob:none'

As such, I believe that the issue has been indirectly introduced by previously mentioned commit - it tries to enable the functionality by default, however by doing so it trips on by failing to properly construct valid parameters for git command as explained on go-gitea/gitea#18373


Unsure at the moment if there's anything that Renovate should do on its side. This will be fixed soon on Gitea side and the fix will be included in official 1.16 release version. Renovate is trying its best to act as it should and as far as I understand the issue at the moment, it's a server (Gitea in this case) that is acting incorrectly by failing a valid request.

@viceice
Copy link
Member

viceice commented Feb 4, 2022

I didn't see any issues with official v1.16 docker image. (Rootless)

@proton-ab
Copy link
Contributor

proton-ab commented Feb 5, 2022

Correct @viceice, go-gitea/gitea@42991dc is commit that fixes it for 1.16 branch (backport of go-gitea/gitea#18373). Only 1.16.0-rc1 was ever affected so you're free to close the issue.

@rarkins rarkins closed this as completed Feb 5, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status:requirements Full requirements are not yet known, so implementation should not be started type:bug Bug fix of existing functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants