Issue
I have two pipeline jobs which are job A and job B. I need to trigger job B while job A is running.. because job A will not finish due to some API calls. so I need to start the next pipeline job B.
how can we trigger another pipeline job from the Jenkins file?
All the parallel blocks of a,b,c need to run.
Below I have pasted the job A Jenkins script.
pipeline {
agent any
stages {
stage('need to run parallelly'){
steps {
parallel(
a:{
dir('file path'){
bat """
npm install
"""
}
},
b:{
dir('file path'){
bat """
npm start
"""
}
},
c:{
build job: 'JOB_B'
}
)
}
}
}
}
Solution
You have an example here.
In your case, try:
pipeline {
agent any
stages {
stage('need to run parallelly'){
steps{
script{
parallel(
a:{
dir('file path'){
bat """
npm install
"""
}
},
b:{
dir('file path'){
bat """
npm start
"""
}
},
"build":{
build job: 'JenkinsTest'
},
)
}
}
}
}
Answered By - VonC
Answer Checked By - Marilyn (JavaFixing Volunteer)