-
New Feature
-
Resolution: Fixed
-
Major
-
None
-
Jenkins 1.531
I have only been a user of this awesome plugin for a short time, but I am hitting a wall with a need.
I am trying to dev a dsl groovy script that will create a job that uses the Mercurial scm, but also uses the new credentials ability. I know the groovy code to get the credentials ID, but I can't seem to get it working in through the Job DSL plugin. Can anyone help? I think the issue that I am running into may require a change to the plugin, but I would like to see what the community thinks.
Here is what I know will get me the credentials ID for the "foobar" credentials:
def creds = com.cloudbees.plugins.credentials.CredentialsProvider.lookupCredentials(
com.cloudbees.plugins.credentials.common.StandardUsernameCredentials.class,
Jenkins.instance,
null,
null
);
for (c in creds) {
if (c.description == "foobar")
}
But when I put this into a dsl, I get the following:
FATAL: No such property: com for class: test
Possible solutions: jm
groovy.lang.MissingPropertyException: No such property: com for class: test
Possible solutions: jm
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:50)
at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:49)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:231)
at test.run(test.dsl:21)
at javaposse.jobdsl.dsl.DslScriptLoader.runDslEngineForParent(DslScriptLoader.java:68)
at javaposse.jobdsl.dsl.DslScriptLoader.runDslEngine(DslScriptLoader.java:92)
at javaposse.jobdsl.plugin.ExecuteDslScripts.perform(ExecuteDslScripts.java:159)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:782)
at hudson.model.Build$BuildExecution.build(Build.java:199)
at hudson.model.Build$BuildExecution.doRun(Build.java:160)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:567)
at hudson.model.Run.execute(Run.java:1604)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:246)
Any pointers or ways of positive guidance is much appreciated! Thanks!