Reputation: 2649
Using Jenkins latest, I have a multi-branch project with a declarative Jenkinsfile. The jenkins file has parameters defined:
Jenkins snippet
pipeline {
agent any
parameters {
string(name: 'P_A', defaultValue: 'a', description: 'a')
string(name: 'P_B', defaultValue: '[email protected]', description: 'b')
}
stages {
In my multi-branch project configuration, I have disabled SCM triggering when a new branch is found. I want to run the pipeline on demand via the following call to /buildWithParameters.
Request
POST http://127.0.0.1:9000/job/multibranchprojectname/job/jobname/buildWithParameters
Content-type: application/x-www-form-urlencoded
token=&P_A=test&[email protected]
Reponse
HTTP 500
java.lang.IllegalStateException: This build is not parameterized!
Upvotes: 3
Views: 2282
Reputation: 21
For parameters defined in the pipeline Jenkins does not recognize them if the pipeline has not been executed at least once.
Upvotes: 2
Reputation: 1
Under the "General" tab of the Jenkins job in the jenkins web app, you must select the checkbox labeled "This project is parameterized" and then create String Parameters (one of the available types of parameters once this check box is selected) which you are trying to pass values to.
Upvotes: 0