我尝试并行化动态定义的函数集,如下所示:
def somefunc() {
echo 'echo1'
}
def somefunc2() {
echo 'echo2'
}
running_set = [
{ somefunc() },
{ somefunc2() }
]
pipeline {
agent none
stages{
stage('Run') {
steps {
parallel(running_set)
}
}
}
}
我最终得到的是:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 17: No "steps" or "parallel" to execute within stage "Run" @ line 17, column 9.
stage('Run') {
尽管步骤是在“运行”阶段定义的。无论如何,我想要实现的是一组动态定义的并行执行的函数。