Jenkins 多线程函数
Jenkins multithreading functions
我需要 运行 在 Jenkins 管道中并行定义两个函数。
正如 jenkins 中所定义的那样,与作业一起使用的关键字 parallel 似乎不适用于函数调用。
我试过的是 -
def first_func(){
echo "first function"
}
def second_func(){
echo "second function"
}
node {
task = [:]
function_lists = ['first_func()', 'second_func()']
stage ('build') {
for (job in function_lists) {
task[job] = { '${job}' }
}
parallel task
}
}
不要实际调用函数。在詹金斯有什么办法吗?
是的,这可以通过以下方式实现:
def first_func(){
echo "first function"
}
def second_func(){
echo "second function"
}
node {
def task = [:]
stage ('build') {
// Loop through list
['first_func', 'second_func'].each {
def a = it;
task[a] = { "${a}"()}
}
parallel task
}
}
输出:
我需要 运行 在 Jenkins 管道中并行定义两个函数。 正如 jenkins 中所定义的那样,与作业一起使用的关键字 parallel 似乎不适用于函数调用。 我试过的是 -
def first_func(){
echo "first function"
}
def second_func(){
echo "second function"
}
node {
task = [:]
function_lists = ['first_func()', 'second_func()']
stage ('build') {
for (job in function_lists) {
task[job] = { '${job}' }
}
parallel task
}
}
不要实际调用函数。在詹金斯有什么办法吗?
是的,这可以通过以下方式实现:
def first_func(){
echo "first function"
}
def second_func(){
echo "second function"
}
node {
def task = [:]
stage ('build') {
// Loop through list
['first_func', 'second_func'].each {
def a = it;
task[a] = { "${a}"()}
}
parallel task
}
}
输出: