我无法运行这段代码:
buildPath = 'applications'
buildJob(['java', 'nodejs'])
def buildJob(def jobList){
for(job in jobList){
def jobName = "${job}_seed"
def jobDescription = "Jenkins DSL seed for ${job}"
def jobScriptPath = "resources/dsl/${jobName}.groovy"
job("${buildPath}/${jobName}")
}
}
所以,我收到此错误:
Processing provided DSL script
ERROR: (script, line 12) No signature of method: java.lang.String.call() is applicable for argument types: (org.codehaus.groovy.runtime.GStringImpl) values: [applications/java_seed]
Possible solutions: wait(), any(), wait(long), take(int), each(groovy.lang.Closure), any(groovy.lang.Closure)
Finished: FAILURE
我看不到导致此错误的原因或原因。我在buildJob(def jobList)
函数之外创建了一个作业,该作业正在运行,但是我需要执行循环以使作业创建自动化。
有什么想法吗?
答案 0 :(得分:3)
发布我遇到的类似问题。网上关于这个问题的内容不多。
includeRegionBranchBuildStrategy {
includedRegions(String value)
}
假设我们正在实现一个作业 dsl 插件 (https://github.com/jenkinsci/multibranch-build-strategy-extension-plugin),例如:
def includedRegions = r ? String.join("\n", r) : null
branchSources {
branchSource {
buildStrategies {
if(includedRegions){
includeRegionBranchBuildStrategy {
includedRegions(includedRegions)
}
}
}
}
}
我们有如下代码:
def regions = r ? String.join("\n", r) : null
branchSources {
branchSource {
buildStrategies {
if(regions){
includeRegionBranchBuildStrategy {
includedRegions(regions)
}
}
}
}
}
需要重命名您的变量才能使其工作!例如,该方法不能与上面定义的 var 同名。
if( /Android|webOS|iPhone|iPad|Mac|Macintosh|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
window.location.replace('mobileurl');
/// or window.location.href = 'mobileurl';
}
答案 1 :(得分:2)
您正在以下行中迭代字符串数组:
const char[]
并为此使用变量for(job in jobList){
。
然后尝试在此变量上调用方法job
:
call