-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Switch to shallow git clone and add unshallow feature #6464
Conversation
/werft run 👍 started the job as gitpod-build-aledbf-unshallow.1 |
Codecov Report
@@ Coverage Diff @@
## main #6464 +/- ##
===========================================
+ Coverage 19.04% 32.61% +13.56%
===========================================
Files 2 86 +84
Lines 168 16459 +16291
===========================================
+ Hits 32 5368 +5336
- Misses 134 10616 +10482
- Partials 2 475 +473
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
4a91eb5
to
08b78ca
Compare
Another example running the script manually:
|
08b78ca
to
bb8801c
Compare
I very much like the unshallow idea - it nicely solves some of the issues we had seen. I wonder though if we can up with more convenient ways to decide when to unshallow. The two things that shallow cloning broke were "forking" and "git blame":
The proposed time-based mechanism would certainly help reduce the load on the cluster, I fret it offloads the complexity onto the user though and does not solve the two cases above. Unshallowing the copy though IMHO is an awesome idea. |
If you mean whether there is a way to hook on VS Code level, unfortunately not. GitLens execs git directly. Besides we are going to have other IDEs where we don't have any control of core features. |
Can we assume that everyone is going to exec git? If so, we could add our own facade to git which triggers the unshallow when needed (e.g. prior to a git blame). |
To my knowledge yes. Don't know what Jetbrains product will do, but maybe it is too early to worry. We can enable it first on some repos before making a default? |
Reading the comments I think my goals are not clear:
|
@aledbf What you propose sounds good as the end goal, but I am not sure about usability consequences of rolling it for everybody at once. It would be better if we use it ourself for a month on gitpod-io/gitpod and gitpod/openvscode-server to learn. |
I agree with Anton. We should start with opt-in for shallow cloning and enable it on gitpod and open-vscode-server to test ourselves. |
We have tested shallow clones for about a month in production already, and have found two issues only: forks and blame. Also, considering the real-world performance improvements we've seen, this is a change that we don't want to delay for a month with little gain. The goal must be to make shallow clones the default, because only then do we reap their benefits. That said, we'll want to have a good answer to the issues we've found before. Making this opt-out today would make this a potentially breaking change; documentation would certainly help. Making this opt-in would be the low-risk path but would not give us the benefits we hope to achieve. IMHO making this this feature opt-in makes little sense, because we're unlikely to see high uptake. I'd follow Alejandro's proposal with two alterations:
At the end it's mainly a communication issue, because with the outline above we don't expect adverse effects on most users. We'd need to make them aware of shallow clones, their implications, and how to remedy them. Also, worst case if we do see too many problems in practice, by having this a flag on the initializer (see below) we can quickly remove this behaviour. Technical detailsInstead of providing a time-based unshallow mechanism, I reckon we'd want to make this part of the Git content initializer spec, i.e. add a |
👍 For not doing the time-based unshallow bc it adds user-facing complexity. Regarding "opt-out vs opt-in": I agree that it does not make sense to go with opt-in only and wait for adoption. But this feature might break peoples workflows in a lot of ways, and just because we did not find more issues doesn't mean other will run into some. Especially as we cannot detect the general case and offer to unshallow.
💯 Another options to solve the UX problem:
|
Good catch @iQQBot. I've fixed that part now. |
/hold cancel |
lgtm |
@gitpod-io/engineering-ide please have a look as well, particularly towards the supervisor changes |
Can I test this in preview environment? Currently show Your account has been blocked. |
Sorry for that. That's the default behaviour in preview environments. I've unblocked your user. |
Thanks @csweichel looks good, in image builder stage, can we skip fetch to a depth of 20 commits ? |
We could indeed do that, and we've discussed not fetching the history for any headless workspace (prebuilds, image-builds). However, this looks like a potential future optimisation. Considering that variance that would introduce, we'd like to see the effect of this change under load first. |
/approve 👍 |
/approve |
Seem @roboquat doesn't work |
/approve |
/lgtm |
LGTM label has been added. Git tree hash: c4004c1c50d6c1ebbc1981c68e7fd2068fb48d2f
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: corneliusludmann, csweichel Associated issue: #5231 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Is there a way to tell gitpod to always do a deep clone, like for example defining an env variable in my gitpod settings? |
There isn't at the moment. It's not clear to me where such an "unshallow: always" setting should live: in the @svenefftinge wdyt? |
For @jeanp413 use case it should be user-level. Would it make sense to build a small vscode extension that does this? |
yeah, a vscode extension (or a contributed configuration option in the gitpod-web extension) that calls |
Description
In #4847 we tried to improve the initial clone of the workspace git repository using the flag
--filter=blob:none
.The CPU and bandwidth utilization were reduced drastically, also impacting the initial load of the workspace.
Even with these benefits, we had to roll back the change due to the side effects the flag introduces in the local git repository.
This pull request is another attempt to improve the initial clone of the git repository by using a shallow clone (flag
--depth=1
)By default, all workspaces will do a shallow clone and after 10s the start of the workspace, we fetch the latest 20 commits
Using
https://aledbf-unshallow.staging.gitpod-dev.com/#https://gitlab.com/gitlab-org/gitlab/
as an example:Initial size:
Only the last commit is present:
After a couple of minutes (usually takes ~4m to unshallow)
From the workspace logs:
Related Issue(s)
Fixes #5231
How to test
Open
https://aledbf-unshallow.staging.gitpod-dev.com/#https://gitlab.com/aledbf/gitlab
Release Notes
Documentation