Reputation: 505
I am trying to invoke a separate jenkins job whose direct job url is https://jenkins.example.com/job/jobName/
. This job runs with one parameter name "branch", whose value is "Master".
Below is how I am giving in my Jenkinsfile
, but when I run it, gives me error
ERROR: No item named https://jenkins.example.com/job/jobName found
if ("${params.buildParam}" == 'test' || !params.buildParam ){
stage('Test') {
def job = build job: 'https://jenkins.example.com/job/jobName/', parameters: [[$class: 'StringParameterValue', name: 'branch', value: 'Master']]
}
}
Upvotes: 3
Views: 10338
Reputation: 37630
The build
step takes a job name as parameter, not a URL. So try
build job: '/jobName'
to refer using the absolute path. Depending on where your pipeline job is, you might use something like the following as well:
build job: '../../jobName/'
btw. you can avoid string interpolation here:
if (params.buildParam == 'test' ...)
Upvotes: 5