does this https://jenkinsci.github.io/job-dsl-plugin/#path/pipelineJob-environmentVariables-groovy actually work?
Probably more of an plugin issue.
groovy scripts to set env vars seem to work for freestyle job. But I can't get them to work with pipeline jobs. They don't cause any errors but the environment variable won't get set either.
Anyone else played around with it?
pipelineJob('example') {
environmentVariables {
env('ONE', '1')
env('TWO', '2')
groovy('''
def a = 1
return [THREE: 3 * a]
''')
}
definition {
cps {
script('''
pipeline {
agent any
stages {
stage('Env') {
steps {
sh 'env'
}
}
}
}
''')
}
}
}
thx