[英]trigger pipeline job from jenkins pipeline script
我有兩個管道作業,分別是作業 A和作業 B。 我需要在作業 A運行時觸發作業 B。因為由於某些 API 調用,作業 A將無法完成。 所以我需要開始下一個管道作業 B 。
我們如何從 Jenkins 文件中觸發另一個管道作業? a,b,c 的所有並行塊都需要運行。
下面我粘貼了作業 A Jenkins 腳本。
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'
}
)
}
}
}
}
你有一個例子在這里。
在您的情況下,請嘗試:
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'
},
)
}
}
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.