Trigger from GIT to Jenkins buildWithParameters ignores parameter value in pipeline

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Trigger from GIT to Jenkins buildWithParameters ignores parameter value in pipeline

Jaroslav Koblizek

I have a post-receive hook in GIT (works ok) which calls


http://ip:port/job/project_name/buildWithParameters?token=abc&ABC=qwe
 

ABC is my parameter which is defined in Jenkins' project as String parameter with default value xyz. URL has value qwe.


enter image description here


My Jenkins pipeline script is


pipeline {
    agent any
    stages {
        stage('Checkout') {
            steps {
                print env.ABC
            }
        }
    }
}


When the build is triggered from GIT, env.ABC prints xyz and not qwe.


enter image description here


How to get the value qwe from the URL ? My goal is to pass versioned tag name from GIT to pipeline.


Thanks

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/809d5fb5-4553-40de-8eb7-01ef775dda10%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Trigger from GIT to Jenkins buildWithParameters ignores parameter value in pipeline

Aaron Digulla
 Use

    params.ABC

"params" contains build parameters, "env" the environment.

--
Aaron Digulla

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/e24195ee-68a7-44f9-a714-81170d98cb8f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Trigger from GIT to Jenkins buildWithParameters ignores parameter value in pipeline

Jaroslav Koblizek
In reply to this post by Jaroslav Koblizek
Thanks Aaron.

The issue was in missing escaping of & in URL. More details I posted to https://stackoverflow.com/questions/55257984/trigger-from-git-to-jenkins-buildwithparameters-ignores-parameter-value-in-pipel/55265035

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/b5dbd4ce-c337-4d80-bc5e-2e26c15d9e5b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.