Home > Software design >  Missing Property Exception on trigger build
Missing Property Exception on trigger build

Time:07-29

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}"

  • Related