I am getting the following error: No. Such property: $env for class: WorkflowSscript
Here is my implementation:
node('test node') {
stage ('apply terraform') {
// this stage is passing successfully
env_meta = getEnvMeta("test", "${env.ENV_NAME}")
}
stage ('Run Env Tets'){
build job: 'infra_tets', parameters: [
string (name: 'UI_TESTS', value: 'all'),
string (name: 'env', value: String.valueOf($env.ENV_NAME)),
]
}
}
CodePudding user response:
Please try:
node('test node'){
stage ('apply terraform') {
// this stage is passing successfully
env.env_meta = getEnvMeta("test", "${env.ENV_NAME}")
}
stage ('Run Env Tets'){
build job: 'infra_tets', parameters: [
string (name: 'UI_TESTS', value: 'all'),
string (name: 'env', value: env.env_meta),
]
}
}
notice that if you use quotes you need to access env var by "${env.ENV_NAME}"