mirror of
https://github.com/SAP/jenkins-library.git
synced 2024-12-12 10:55:20 +02:00
feat(commonPipelineEnv): consume pipeline environment from env variable if set (#2919)
Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
This commit is contained in:
parent
80974ea930
commit
29b991d6fc
@ -31,13 +31,21 @@ func WritePipelineEnv() *cobra.Command {
|
||||
}
|
||||
|
||||
func runWritePipelineEnv() error {
|
||||
inBytes, err := ioutil.ReadAll(os.Stdin)
|
||||
if err != nil {
|
||||
return err
|
||||
pipelineEnv, ok := os.LookupEnv("PIPER_pipelineEnv")
|
||||
inBytes := []byte(pipelineEnv)
|
||||
if !ok {
|
||||
var err error
|
||||
inBytes, err = ioutil.ReadAll(os.Stdin)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if len(inBytes) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
commonPipelineEnv := piperenv.CPEMap{}
|
||||
err = json.Unmarshal(inBytes, &commonPipelineEnv)
|
||||
err := json.Unmarshal(inBytes, &commonPipelineEnv)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user