Avatar of simon3270
Flag for United Kingdom of Great Britain and Northern Ireland asked on

Jenkins throws missing method exception when one job calls another job

I'm running Jenkins 2.277.1, and trying to get one job to call another.

The main job (written using DSL), creates a list of identifiers (in this case, of clusters we want to shut down). It then tries to call a "shutdown a cluster" job for each of those clusters.

The call to start the jobs is in groovy. The "ssm_list" variable contains a list of items, with the cluster name and manifest name separated by an underscore (this was inherited code!). The bare bones of the script are as follows. I've tried changing the parameter types so that they match the ones in the job being called (e.g. the "listGitBranches"), or generic (e.g.. "string"), but no combinations seem to work. I've also tried wrapping the call in "wrap([$class: 'BuildUser']) {", and wrapping the job in parentheses ("build(job:...)". The "cluster-shutdown-branch" job is in the same directory on the Jenkins server as the calling one. The job has many more parameters than I am providing, but the rest all have useful default values.  I have the "Pipeline: Build Step" plugin v2.15 installed. 

        stage ('Run shutdown job based on the list'){
            agent none
            steps {
                script {
                    ssm_list.each {
                        def split_vars = it.split('_')
                        echo "Shutting down ${split_vars[0]}"
                            build job: 'cluster-shutdown-branch', parameters: [string(name: 'CLUSTER_NAME', value: split_vars[0], listGitBranches(name: 'MANIFEST_BRANCH', value: split_vars[1])

Open in new window

The error I get starts:

hudson.remoting.ProxyException: groovy.lang.MissingMethodException: No signature of method: build.call() is applicable for argument types: (java.util.LinkedHashMap) values: [[job:cluster-shutdown-cmp-branch, parameters:[@string(name=CLUSTER_NAME,value=din-6453h), ...], ...]]
Possible solutions: wait(), any(), wait(long), main([Ljava.lang.String;), any(groovy.lang.Closure), each(groovy.lang.Closure)
   at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:58)
   at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:64)
   at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:54)
   at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
   at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
   at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:163)
   at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:23)
   at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:158)
   at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:143)

Open in new window

Any suggestions of where I should look for the problem?

Java* JenkinsDevOpsREST* Groovy

Avatar of undefined
Last Comment

8/22/2022 - Mon

Please post any - preferably all - Java code involved in your problem space.

I have no java code, I'm just writing Jenkins DSL and Groovy code. All of the java is in Jenkins (a.k.a Hudson) code.

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes