Warm tip: This article is reproduced from stackoverflow.com, please click
jenkins jenkins-pipeline

Retrieving an injected build parameter in Pipeline

发布于 2020-04-13 09:24:14

I'm specifically working on the example below, but I'm guessing the question is a bit more general.

https://github.com/jenkinsci/poll-mailbox-trigger-plugin States the following build parameters, are injected into the job

pipeline {

    agent any

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

    }
}

The above methods don't seem to work for me:

How is it possible to retrieve an injected build parameter in a pipeline job?

Questioner
Ryan
Viewed
77
saadr 2020-02-03 03:43

As explained in the pipeline-plugin tutorial, you can use params to access the job's build parameters.

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