github.com/jaylevin/jenkins-library@v1.230.4/pkg/cnbutils/env.go (about)

     1  package cnbutils
     2  
     3  import (
     4  	"fmt"
     5  	"path/filepath"
     6  )
     7  
     8  func CreateEnvFiles(utils BuildUtils, platformPath string, env map[string]interface{}) error {
     9  	envDir := filepath.Join(platformPath, "env")
    10  	err := utils.MkdirAll(envDir, 0755)
    11  	if err != nil {
    12  		return err
    13  	}
    14  
    15  	for k, v := range env {
    16  		err = utils.FileWrite(filepath.Join(envDir, k), []byte(fmt.Sprintf("%v", v)), 0644)
    17  		if err != nil {
    18  			return err
    19  		}
    20  	}
    21  	return nil
    22  }