Fetching pipeline script from Git

359 views
Skip to first unread message

Tomasz Szandała

unread,
Feb 16, 2016, 6:50:00 AM2/16/16
to Jenkins Users
Greetings, All,
I have the following script fetched from Git using Pipeline Git plugin. Unortunatelly I'm getting the following error:



org.kohsuke.stapler.NoStaplerConstructorException: There's no @DataBoundConstructor on any constructor of class org.jenkinsci.plugins.workflow.cps.steps.ParallelStep
	at org.kohsuke.stapler.ClassDescriptor.loadConstructorParamNames(ClassDescriptor.java:177)

Th fetched script:
import hudson.FilePath

def make_all(currentBuild){
String[] arr = getProperty("MODULES_LIST").split(",");
currentBuild.description = basic_desc
main_build = build("MAINBUILD")
buildClosures = []

for (int i=0; i<arr.length; i++) {
    println "adding "+arr[i]
    String tmpserv=arr[i].replaceAll("\"","")
    def curClosure = {
        println "Scheduling "+tmpserv.replaceAll("\"","")       
        retry (2) {       
          tmp_build = build("parrallel_test",
             "MODULE": arr[i],
            "MAIN_BUILD_NUM": main_build.number
                )
        }
            tmp_build.build.artifacts.each {
              //copying artifacts
        }                                  
    jobs_done += 1
    currentBuild.description = "Subjobs done: " + jobs_done.toString() +"/" + total_jobs.toString() + " "
    }
    buildClosures.add(curClosure)
}
parallel(buildClosures)
}
return this;

And the fetching script:

def factory = fileLoader.fromGit('factory.groovy',
        'git_path', 'master', null, '');
       
factory.make_all(currentBuild)


Baptiste Mathus

unread,
Feb 16, 2016, 8:49:57 AM2/16/16
to jenkins...@googlegroups.com
Hi, the `parallel` step actually expects a map, not an array/list.

That is, should be:

 `buildClosures = []` 

and something like

buildClosures.put("the subbuild $i", curClosure)

Cheers

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/60d08754-ed16-482e-93c8-bc09bbc1c6d4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages