-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Prebuilds fail with error "cannot initialize workspace: prebuild initializer: git fetch -p -P . tags -f failed" #9280
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
Comments
I could not reproduce this error. I tried the following.
Also, When I investigate DB I see that SELECT
cloneURL,COUNT(*)
FROM
d_b_prebuilt_workspace
WHERE
error LIKE '%prebuild initializer: git fetch -p -P%'
and creationTime > '2022-02-13 08:56:44.752194'
GROUP BY cloneURL; |
Hi @princerachit , have you tried setting up a repo with a submodule, and then push to the repo and repo backing the submodule at different times? |
Yes, I tried that too but did not work |
So far I tried these combinations could not reproduce the issue, in all these cases the submodule was a private module:
I suspect that these combinations are not working because my user has permission to access the private submodule and does not use an ssh key. As a next set of steps I am going to create a private submodule in another account and then would use my account to perform above test. I will also make sure that the |
I have moved this to scheduled column as my prebuilds are stuck in pending state. Team webapp is investigating the problem, I will pick it up once the issue is resolved. |
Reproducing the ErrorI was able to reproduce this issue using incremental prebuild. Refer to the prebuild url here and logs (This is not accessible to public)
NOTE: If you update the init section of Why previous attempts failed
|
CauseI am not exactly sure of the reason of this failure, I will add logs and try to reproduce this in development env. Maybe Related issue forum Related Code
|
I added logs to the code path where we perform fetch. The file permission looks correct with all the files owned by user 133332: 40K
-rw-r--r-- 1 133332 133332 2 Apr 28 07:02 there
-rw-r--r-- 1 133332 133332 21 Apr 28 07:02 afile
-rw-r--r-- 1 133332 133332 14 Apr 28 07:02 README.md
-rw-r--r-- 1 133332 133332 446 Apr 28 07:02 .gitpod.yml
-rw-r--r-- 1 133332 133332 82 Apr 28 07:02 .gitmodules
-rw-r--r-- 1 133332 133332 5 Apr 28 07:02 .gitignore
drwxr-xr-x 2 133332 133332 4.0K Apr 28 07:02 hidden
drwxr-x--- 4 133332 133332 4.0K Apr 28 07:02 .
drwxr-xr-x 5 133332 133332 4.0K Apr 28 09:05 ..
drwxr-xr-x 9 133332 133332 4.0K Apr 28 09:05 .git But we still see the error: "cannot initialize workspace:
github.com/gitpod-io/gitpod/content-service/pkg/initializer.InitializeWorkspace
github.com/gitpod-io/gitpod/[email protected]/pkg/initializer/initializer.go:426
- prebuild initializer:
github.com/gitpod-io/gitpod/content-service/pkg/initializer.runGitInit
github.com/gitpod-io/gitpod/[email protected]/pkg/initializer/prebuild.go:131
- git fetch -p -P --tags -f failed (exit status 1): From https://github.com/princerachit/pub
bb4a4d3..6ed10c5 main -> origin/main
* [new branch] test1 -> origin/test1
* [new branch] test2 -> origin/test2
* [new branch] test3 -> origin/test3
Fetching submodule hidden
No user exists for uid 133332
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
No user exists for uid 133332
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Errors during submodule fetch:
hidden
hidden
"
|
I am moving this issue into blocked state. See internal slack thread. Gist: The snapshot contains the hidden submodule. When we run the This will likely get resolved as we migrate to PVC based snapshots, where the git commands will be run in workspace context. |
This seems to happen even when git submodule references public repo. |
@csweichel
|
And just to confirm, this happens on prebuilds that have incremental build disabled. |
That is one way indeed. We could also add a special mode to the snapshot initialiser whereby we don't do the UID mapping. This way we'd safe a (potentially rather expensive) |
That's odd and warrants some more investigation. Where do those UIDs come from if not from a snapshot restoration? |
I am moving this issue into scheduled state from blocked, since it does affect non incremental prebuilds as well and we need to investigate why. |
I suspect we might be using incremental prebuild when we are not supposed to?
I cannot find anything that would disable incremental prebuild based on project config setting, but maybe that is done somewhere else? Here is the affected project: https://gitpod.io/admin/projects/d2168919-f8ac-4c4c-8e6d-4fe9ac049911 It seems like its prebuilds are running based on previous prebuild, even though incremental prebuilds are disabled for that project. |
Changed title given @sagor999's comment: "it does affect non incremental prebuilds as well and we need to investigate why" |
Added to webapp inbox and pinging @geropl because of @sagor999 's comment here. Thanks, @sagor999 , for the find! 🙏 |
Thx @sagor999 , will schedule for someone to investigate. 👍 |
This has come up with matching error message in this customer context here (internal). |
If incremental prebuilds are disabled in project settings, that code path wont be taken because the
and the call site: gitpod/components/server/ee/src/prebuilds/prebuild-manager.ts Lines 88 to 111 in cc2f3b3
|
Hi! What are workarounds for this problem? This is a huge blocker. We are not able to spawn any workspaces anymore at https://github.com/OpenMS/OpenMS Apparently it? the prebuild? cached some state of a submodule with a commit that does exist anymore. Or something like that. I don't get it. Prebuilds run fine! But when opening the workspace it always crashes. |
Thank you for sharing, @axonasif!! This is interesting. cc: @aledbf @csweichel |
Closing. The fix is deployed now |
Uh oh!
There was an error while loading. Please reload this page.
Bug description
Incremental Prebuilds (Beta) fails for Projects which have repo that contains private submodules.
This happens when the submodules are update in the repo. The subsequent prebuild fails while trying to update the submodules.
Error
Error looks similar to these
Example 1
When you start a workspace, it triggers a prebuild which results in the following error:
Example 2
Example 3
On the prebuild page of the project.
Prebuild failed for system reasons. Please contact support. cannot initialize workspace: cannot initialize workspace: prebuild initializer: git fetch -p -P --tags -f failed (exit status 1): From https://github.com/princerachit/pub 9383449..529e501 main -> origin/main * [new branch] newbranch1 - ...
Workaround
Since this problem is specific to Incremental Prebuilds as workaround we suggest users to do the following until we fix this issue.
Above seems to work for most cases but recently we encountered a customer who disabled prebuild but could still see the issue: internal slack thread
Please let us know if this workaround does not help.
Steps to reproduce
pub
) which has a private repo git submodule (hidden
)hidden
cat id_rsa | base64
.gitpod.yml
so that it uses that key to initializepub
's submodules in prebuild- refpub
repo and enable incremental prebuildsb1
frompub
repo and push it to GH. Let the prebuild run and finish.b1
e.g.cd hidden && GIT_SSH_COMMAND="ssh -i ../idkey -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" git pull origin main
git add -u && git commit -m "changes"
git push
b1
branch. Prebuild should be failing.e.g. Refer to the prebuild url here and logs (This is not accessible to public)
Workspace affected
Several prebuilds have been affected resulting in workspace failure.
To find the current number of failed prebuilds by their repo run the following command:
Expected behavior
Prebuilds should work without any issue.
Example repository
https://github.com/princerachit/pub
Anything else?
No response
Root cause
During incremental prebuild snapshost is downloaded and then the local repo is updated.
The snapshot contains the hidden submodule which was initialized during last successful prebuild.
When the
git fetch -p -P --tags
command is run git finds that there was an update in the hidden submodule's sha reference. It then tries to update the submodule. Since we preserve the userid/gid (133332 which is missing in the init container) mapping when untarring the snapshot, the git command complains about the user not exisiting.Even after creating this user manually the prebuild fails as the ssh-key required to fetch this submodule does not exists in the content-init container.
Plan to Resolve
The text was updated successfully, but these errors were encountered: