-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[content-service] add prestop hook to extract git status #9807
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
Conversation
004b142
to
42f92fd
Compare
layers := []fileInLayer{ | ||
{&tar.Header{Typeflag: tar.TypeDir, Name: "/.workspace", Uid: initializer.GitpodUID, Gid: initializer.GitpodGID, Mode: 0755}, nil}, | ||
{&tar.Header{Typeflag: tar.TypeDir, Name: "/.workspace/.gitpod", Uid: initializer.GitpodUID, Gid: initializer.GitpodGID, Mode: 0755}, nil}, | ||
{&tar.Header{Typeflag: tar.TypeReg, Name: "/.supervisor/prestophook.sh", Uid: 0, Gid: 0, Mode: 0775, Size: int64(len(prestophookScript))}, []byte(prestophookScript)}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please explain why we are setting Uid and Gid to 0 but then permission to 0775?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uid/Gid to 0 to make sure no one else can edit\modify this file from inside the workspace (otherwise you can execute things from ring1).
775 to allow gitpod user to execute it as part of prestop hook.
Nice PR! I have a question if I use the |
42f92fd
to
2cb0604
Compare
/hold I am ok to merge this PR. @sagor999 please remove the hold label when you think it is ok to merge. I have added this as there were other reviewers who left comments. |
/unhold |
Description
add prestop hook to extract git status when workspace is using pvc.
This is needed when workspace is using PVC and ws-daemon cannot access those files directly because:
they are on a dedicated pvc
finalize happens when container is stopped, and at that point pvc has been detached.
So we use prestop hook to do necessary work right before container will receive signal to stop (later prebuilds will extract build log in the same way for example).
Related Issue(s)
Part of #9475
How to test
You can test this as part of #9475
But for this PR, verify that workspace starts and stops normally. This PR shouldn't affect normal workflow (without PVC) and that is what should be tested in this PR.
Release Notes
Documentation