1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-14 11:03:09 +02:00

fix(commonPipelineEnvironment) file and directory permissions (#2924)

This commit is contained in:
Kevin Stiehl 2021-06-18 09:56:31 +02:00 committed by GitHub
parent 9db249fe1c
commit 792d435a7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -28,20 +28,20 @@ func (c *CPEMap) LoadFromDisk(path string) error {
// WriteToDisk writes the CPEMap to a disk and uses rootDirectory as the starting point
func (c CPEMap) WriteToDisk(rootDirectory string) error {
err := os.MkdirAll(rootDirectory, 0755)
err := os.MkdirAll(rootDirectory, 0777)
if err != nil {
return err
}
for k, v := range c {
entryPath := path.Join(rootDirectory, k)
err := os.MkdirAll(filepath.Dir(entryPath), 0755)
err := os.MkdirAll(filepath.Dir(entryPath), 0777)
if err != nil {
return err
}
// if v is a string no json marshalling is needed
if vString, ok := v.(string); ok {
err := ioutil.WriteFile(entryPath, []byte(vString), 0644)
err := ioutil.WriteFile(entryPath, []byte(vString), 0666)
if err != nil {
return err
}
@ -53,7 +53,7 @@ func (c CPEMap) WriteToDisk(rootDirectory string) error {
return err
}
err = ioutil.WriteFile(fmt.Sprintf("%s.json", entryPath), jsonVal, 0644)
err = ioutil.WriteFile(fmt.Sprintf("%s.json", entryPath), jsonVal, 0666)
if err != nil {
return err
}