Access Github webhook payload inside a Jenkins declarative pipeline

412 views Asked by At

I created a multibranch github pipeline using Jenkins BlueOcean. Its able to receive push notifications from my repository and start a build. However, I want to access specific information from the payload of the post request made to Jenkins for the build. I do not see any env variables in the build pertaining to the payload. Is there a way to access this information? I followed the steps in this - How to process a github webhook payload in Jenkins? but my payload param has null value

pipeline {
    agent any
    parameters {
        string(name: 'payload')
    }
    stages {
        stage('Bump version') {
            steps {
                script {
                    def parameters = build?.actions.find{ it instanceof ParametersAction }?.parameters
                    parameters.each {
                       println "parameter ${it.name}:"
                       println it.dump()
                       println "-" * 80
                    }
                }
            }
        }
    }
}
0

There are 0 answers