-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
scriptler@2.7 Jenkins 1.596
Trying to use the scriptlet as a regular Groovy script in support of plugins (such as Conditional step) that can only use a Groovy script and not a Scriptler script.
Thought that I could use the scriptlet as a regualr Groovy script and pass it command line arguments instead of the scriptlet parameters. You need to make small modifications to your scriptlet to work with command line arguments AND parameters. Every Groovy script has an implicit args String[] that represents the command line arguments passed into the script.
So if we had a hello.groovy scriptlet with one defined vName parameter. We would write a standard scriptlet as:
name=vName
println "Hello $name"
We could adapt this as follows to work with one command line argument like this:
>groovy hello.groovy John
name='' if (args){ name=args[0] }else{ name=vName } println "Hello $name"
When the code above is executed in a Jenkins Conditional Build setp as a Groovy script it works fine. But when you try to execute the script as a scriptlet, the implicit 'args' parameter is not recognized
You get a 'MissingPropertyException: No such property: args for class: Script1' error
- is related to
-
JENKINS-15975 Allow Scriptler to be used in Conditional BuildStep plugin
- Open