触发器生成时出现缺少属性异常错误

drnojrws  于 2022-11-01  发布在  其他
关注(0)|答案(1)|浏览(145)

我收到以下错误: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)),
        ]
    }
}
6rvt4ljy

6rvt4ljy1#

请尝试:

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),
        ]
    }
}

请注意,如果您使用引号,则需要通过"${env.ENV_NAME}"访问env var

相关问题