Issue
getting No. Such property: $env for class: WorkflowSscript
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)),
]
}
}
Solution
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}"
Answered By - Barel elbaz
Answer Checked By - Mildred Charles (JavaFixing Admin)