File tree 1 file changed +22
-0
lines changed
components/content-service/pkg/initializer
1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 9
9
"errors"
10
10
"fmt"
11
11
"os"
12
+ "os/exec"
12
13
"path/filepath"
13
14
"strings"
14
15
@@ -17,6 +18,7 @@ import (
17
18
"golang.org/x/xerrors"
18
19
19
20
"github.com/gitpod-io/gitpod/common-go/log"
21
+ "github.com/gitpod-io/gitpod/common-go/process"
20
22
"github.com/gitpod-io/gitpod/common-go/tracing"
21
23
csapi "github.com/gitpod-io/gitpod/content-service/api"
22
24
"github.com/gitpod-io/gitpod/content-service/pkg/archive"
@@ -152,5 +154,25 @@ func runGitInit(ctx context.Context, gInit *GitInitializer) (err error) {
152
154
153
155
log .Debug ("prebuild initializer Git operations complete" )
154
156
}
157
+
158
+ defer func () {
159
+ span .SetTag ("Chown" , gInit .Chown )
160
+ if ! gInit .Chown {
161
+ return
162
+ }
163
+ // TODO (ptumik): need this for regular prebuild -> pvc workspace. Once fixed supervisor executor.execure() running with root we can remove this code.
164
+ args := []string {"-R" , "-L" , "gitpod:gitpod" , gInit .Location }
165
+ cmd := exec .Command ("chown" , args ... )
166
+ res , cerr := cmd .CombinedOutput ()
167
+ if cerr != nil && ! process .IsNotChildProcess (cerr ) {
168
+ err = git.OpFailedError {
169
+ Args : args ,
170
+ ExecErr : cerr ,
171
+ Output : string (res ),
172
+ Subcommand : "chown" ,
173
+ }
174
+ return
175
+ }
176
+ }()
155
177
return nil
156
178
}
You can’t perform that action at this time.
0 commit comments