Gitea: Guard against unknown submodule hashes #125
Labels
No Label
Service
Buildbot
Service
Chat
Service
Gitea
Service
Translate
Type
Bug
Type
Config
Type
Deployment
Type
Feature
Type
Setup
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: infrastructure/blender-projects-platform#125
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Sometimes incidents happen and changes to
blender.git
are landed and they point to a non-existing hashes in the submodule repository.Example: https://builder.blender.org/admin/#/builders/30/builds/18549
For developers and artists recovery is quite easy: run
make update
second time. Still annoying, and could be confusing.For the buildbot it is much more annoying, to recover, as
git pull
need to happen twice on all the workers, all the tracks.Ideally we'd have a receive hook which will verify that the submodule hash exists. It might be tricky to detect the change to hash. More importantly, the hash check should be cheap, and not require having to do a checkout to check the hash. Not sure there is a way to query repository by URL to check commit. Can also just hardcode some paths on the local drive to the libs/tests folders.
If the automated check is not possible for whatever reason, would be good to automate recovery from this situation on the buildbot. Maybe parse the
make update
output fornot our ref
and run it again?There is, something like this would work:
it will return 0 for a non-existing hash in the repo, 1 for an existing one
I took the time to cook up a rough pre-receive Git hook script:
It's quite a bit of logic and I will need to have this tested as well as reviewed by others.
I don't think it'll work on the server side?
On the server side the repository is stored as "bare", so it would not contain
.gitmodules
file.There are some way described on the Internet how to get content of a file in a bare repository. Perhaps it could work well enough.
Although, currently I think it will error out if a new submodule is added. Imagine when we'll be adding linux_arm64 libraries: ideally the sanitization script will let us do it.
And another aspect of checking commit: would the fetch fail for commit which is not in any of the branches, but is not yet garbage-collected? You can imagine situation when locally you force-push to the libraries repo branch, and then push blender.git.
Can we use
git show "$newrev:.gitmodules"
instead?Intuitively yes. I am not sure how
git show
handles situation for the new hash from a receive hook. It is one of those things we'd need to try and see :)some googling brought me https://github.com/rodrigo-lima/submodule_checker
Plus: this looks pretty close to what we are looking for
Minus: Last commit: 10 years ago
sooo.... it may need a little work