Skip to content

Commit dfb2d45

Browse files
authored
Set umask to 0 before cloning (#236)
1 parent 66d8e73 commit dfb2d45

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

plugin.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"os/exec"
1111
"path/filepath"
1212
"strings"
13+
"syscall"
1314
"time"
1415
)
1516

@@ -29,17 +30,15 @@ var defaultEnvVars = []string{
2930
}
3031

3132
func (p Plugin) Exec() error {
33+
// set umask to 0 so cloned files are
34+
// accessible from non-root containers
35+
syscall.Umask(0)
36+
3237
if p.Pipeline.Path != "" {
3338
err := os.MkdirAll(p.Pipeline.Path, 0o777)
3439
if err != nil {
3540
return err
3641
}
37-
38-
// Ensure the correct mode for the path. This is also necessary if the path does not exist
39-
// and was created by os.MkdirAll. This is due to the fact that the permissions set by os.MkdirAll
40-
// are filtered by the system umask (usually 0022). As we need an additional chmod anyway,
41-
// we do not mess around with the system umask.
42-
os.Chmod(p.Pipeline.Path, 0o777)
4342
}
4443

4544
err := writeNetrc(p.Config.Home, p.Netrc.Machine, p.Netrc.Login, p.Netrc.Password)

0 commit comments

Comments
 (0)