温馨提示:本文翻译自stackoverflow.com,查看原文请点击:jenkins - Retrieving an injected build parameter in Pipeline
jenkins jenkins-pipeline

jenkins - 在管道中检索注入的构建参数

发布于 2020-04-13 10:50:31

我正在专门研究下面的示例,但是我想这个问题要笼统一些。

https://github.com/jenkinsci/poll-mailbox-trigger-plugin状态 将以下构建参数注入到作业中

pipeline {

    agent any

    stages {
        stage('Test') {
            steps {
                echo env.pmt_content
                echo ${pmt_content}
            }
        }

    }
}

上面的方法似乎不适用于我:

如何在管道作业中检索注入的构建参数?

查看更多

提问者
Ryan
被浏览
100
saadr 2020-02-03 03:43

管道插件教程中所述,您可以使用params来访问作业的构建参数。

    print params.pmt_content 
    print "Content is ${params.pmt_content}"