-
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
[pvc] run git commands as gitpod user when using pvc #13929
Conversation
started the job as gitpod-build-pavel-chown.4 because the annotations in the pull request description changed |
/werft run 👍 started the job as gitpod-build-pavel-chown.8 |
/werft run 👍 started the job as gitpod-build-pavel-chown.12 |
/werft run 👍 started the job as gitpod-build-pavel-chown.14 |
started the job as gitpod-build-pavel-chown.16 because the annotations in the pull request description changed |
started the job as gitpod-build-pavel-chown.17 because the annotations in the pull request description changed |
Can we move the content-init operation ring1 or ring2 that runs as the gitpod user? So we don't need to specify run git clone as gitpod user. |
@jenting frankly speaking, I am not sure, as there are a lot of moving parts in between ring0 and ring2. 🤔 @csweichel do you have any thoughts on this? ^ |
cmd := exec.Command("git", fullArgs...) | ||
cmdName := "git" | ||
if c.RunAsGitpodUser { | ||
cmdName = "sudo" |
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.
sudo
is required?
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.
yeah. that is the whole point here, and assumes that this runs as root (which it is from ring0).
so it runs sudo -u gitpod git ...
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.
At this code phase, is the permission root
?
If yes, I am thinking using runuser
is more suitable or not. 🤔
https://prasadlinuxblog.wordpress.com/2012/09/04/392/
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.
Is it safe from a security viewpoint?
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.
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.
Agree with you.
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.
I just want to confirm with you about it. 💯
👋 @sagor999 did you mean to link this to #14003, instead of #12892 ? I ask because this PR uses chown still, but as gitpod user, instead of root. Does this PR solve the underlying performance issue, where using |
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.
LGTM.
I can't think of any concerns about this change. So I'm okay to 🚢 it.
Description
When using PVC, we run content-init from inside the supervisor, which runs as root user.
This causes git clone to run as root, causing cloned repo to be owned by root.
Workaround was to do chown as the end of clone, but on big repos it is slow.
This allows to run git op as gitpod user instead, thus not needing to do chown at the end.
Related Issue(s)
Fixes #12892
How to test
Open and close all kind of various ways of opening a workspace.
This code should only affect PVC code path, so to properly test you need to enable PVC feature flag on your account first.
Release Notes
Documentation
Werft options:
If enabled this will build
install/preview
Valid options are
all
,workspace
,webapp
,ide