Run a systemGroovyCommand from DSL

44 views
Skip to first unread message

misha

unread,
Apr 4, 2017, 7:37:24 AM4/4/17
to job-dsl-plugin
Hello to everyone!

I'm trying to create a seed job using this DSL plugin, where one of the steps is running a groovy system script 

  steps {
    systemGroovy
{
      systemGroovyCommand
(readFileFromWorkspace('WorkspaceLocker.groovy')){        
     
}
      bindings
()
      classpath
()
   
}
 
}

So I get this error:

ERROR: (script, line 30) No signature of method: javaposse.jobdsl.plugin.structs.DescribableContext.bindings() is applicable for argument types: () values: []
Possible solutions: find(), findAll()


I'm new to groovy (more familiar with Java), so if anyone can shade some light on reasons of this failure - I appreciate it.
Note: my Jenkins version is 2.32.3

Thank you for any help

misha

unread,
Apr 4, 2017, 8:37:14 AM4/4/17
to job-dsl-plugin
So I found the answer here: https://jenkinsci.github.io/job-dsl-plugin/#path/job-steps-systemGroovyCommand

The correct syntax that worked for me was:
  steps {  
      systemGroovyCommand
(readFileFromWorkspace('WorkspaceLocker.groovy')){        
      binding
('test','value')
      classpath
()
     
}          
 
}

Reply all
Reply to author
Forward
0 new messages