Skip to content

Commit f17f6ea

Browse files
committed
wip
1 parent 351fe35 commit f17f6ea

File tree

1 file changed

+15
-12
lines changed
  • components/content-service/pkg/initializer

1 file changed

+15
-12
lines changed

components/content-service/pkg/initializer/git.go

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -77,18 +77,21 @@ func (ws *GitInitializer) Run(ctx context.Context, mappings []archive.IDMapping)
7777
}
7878

7979
// make sure that folder itself is owned by gitpod user prior to doing git clone
80-
//args := []string{"gitpod", ws.Location}
81-
//cmd := exec.Command("chown", args...)
82-
//res, cerr := cmd.CombinedOutput()
83-
//if cerr != nil && !process.IsNotChildProcess(cerr) {
84-
// err = git.OpFailedError{
85-
// Args: args,
86-
// ExecErr: cerr,
87-
// Output: string(res),
88-
// Subcommand: "chown",
89-
// }
90-
// return err
91-
//}
80+
// this is needed as otherwise git clone will fail if the folder is owned by root
81+
if ws.RunAsGitpodUser {
82+
args := []string{"gitpod", ws.Location}
83+
cmd := exec.Command("chown", args...)
84+
res, cerr := cmd.CombinedOutput()
85+
if cerr != nil && !process.IsNotChildProcess(cerr) {
86+
err = git.OpFailedError{
87+
Args: args,
88+
ExecErr: cerr,
89+
Output: string(res),
90+
Subcommand: "chown",
91+
}
92+
return err
93+
}
94+
}
9295

9396
log.WithField("stage", "init").WithField("location", ws.Location).Debug("Running git clone on workspace")
9497
err = ws.Clone(ctx)

0 commit comments

Comments
 (0)