having trouble with managedscript

38 views
Skip to first unread message

wh

unread,
Sep 13, 2016, 7:29:55 PM9/13/16
to job-dsl-plugin
in one of my job:

....

steps {
     managedScriptConfigFile('package_info') {
           content"......"
     }
    
     managedScript("package_info") {
           .....
     }
}
.....



and I will get the following error:

Expected no exception to be thrown, but got 'javaposse.jobdsl.dsl.DslScriptException'
	at spock.lang.Specification.noExceptionThrown(Specification.java:118)
	at com.dslexample.JobScriptsSpec.test script #file.name(JobScriptsSpec.groovy:29)
Caused by: javaposse.jobdsl.dsl.DslScriptException: (script, line 141) managed script with name 'package_info' not found
	at javaposse.jobdsl.dsl.Preconditions.checkNotNull(Preconditions.groovy:54)
	at javaposse.jobdsl.dsl.helpers.step.StepContext.managedScript(StepContext.groovy:1050)
	at script.run_closure1_closure6(script:141)
	at script.run_closure1_closure6(script)
	at javaposse.jobdsl.dsl.ContextHelper.executeInContext(ContextHelper.groovy:16)
	at javaposse.jobdsl.dsl.Job.steps(Job.groovy:626)
	at script.run_closure1(script:45)
	at groovy.lang.Closure.call(Closure.java:411)
	at groovy.lang.Closure.call(Closure.java:427)
	at javaposse.jobdsl.dsl.JobParent.processItem(JobParent.groovy:134)
	at javaposse.jobdsl.dsl.JobParent.freeStyleJob(JobParent.groovy:46)
	at javaposse.jobdsl.dsl.JobParent.job(JobParent.groovy:38)
	at script.run(script:3)
	at javaposse.jobdsl.dsl.DslScriptLoader.runScriptEngine(DslScriptLoader.groovy:129)
	at javaposse.jobdsl.dsl.DslScriptLoader.runScriptsWithClassLoader_closure1(DslScriptLoader.groovy:78)
	at groovy.lang.Closure.call(Closure.java:411)
	at groovy.lang.Closure.call(Closure.java:427)
	at javaposse.jobdsl.dsl.DslScriptLoader.runScriptsWithClassLoader(DslScriptLoader.groovy:68)
	at javaposse.jobdsl.dsl.DslScriptLoader.runScripts(DslScriptLoader.groovy:44)
	at javaposse.jobdsl.dsl.DslScriptLoader.runScript(DslScriptLoader.groovy:58)
	at javaposse.jobdsl.dsl.DslScriptLoader.runDslEngine(DslScriptLoader.groovy:182)
	at com.dslexample.JobScriptsSpec.test script #file.name(JobScriptsSpec.groovy:26)

Daniel Spilker

unread,
Sep 14, 2016, 2:46:42 AM9/14/16
to job-dsl...@googlegroups.com
That is a known issue, see https://issues.jenkins-ci.org/browse/JENKINS-33630. The ticket also mentions a workaround.

Daniel

--
You received this message because you are subscribed to the Google Groups "job-dsl-plugin" group.
To unsubscribe from this group and stop receiving emails from it, send an email to job-dsl-plugin+unsubscribe@googlegroups.com.
To post to this group, send email to job-dsl-plugin@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/job-dsl-plugin/7e4e4052-23d8-4474-bf48-120d7ab40cea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Message has been deleted

wh

unread,
Sep 14, 2016, 1:34:48 PM9/14/16
to job-dsl-plugin
I separated them into 2 scripts:

script1.groovy
....
steps {
     managedScriptConfigFile('package_info') {
           content"......"
     }
}    


script2.groovy
....
steps {
     managedScript("package_info") {
           .....
     }
}
.....

Still having the same problem :(

Andrew McLaughlin

unread,
Sep 19, 2016, 3:05:37 AM9/19/16
to job-dsl...@googlegroups.com
According to the docs, the managedScriptConfigFile() call should not appear within the jobs/steps context. It belongs at the top level in your jobs script. I suspect that is why it cannot be found when you call manafagedScript()...



-- 
You received this message because you are subscribed to the Google Groups "job-dsl-plugin" group.
To unsubscribe from this group and stop receiving emails from it, send an email to job-dsl-plugi...@googlegroups.com.
To post to this group, send email to job-dsl...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/job-dsl-plugin/7a81a4ef-9748-4550-b5b2-1c6e1284c02b%40googlegroups.com.

wh

unread,
Sep 20, 2016, 4:36:58 PM9/20/16
to job-dsl-plugin
Just tried to move it outside of job/steps, still complaining :(

Andrew McLaughlin

unread,
Sep 20, 2016, 6:23:45 PM9/20/16
to job-dsl...@googlegroups.com
Try putting it in the same script where you are referencing it…

Andrew

wh

unread,
Sep 20, 2016, 6:42:01 PM9/20/16
to job-dsl-plugin
test still fails after I upgraded job-dsl-plugin to 1.51, but I disabled test ( gradlew -x test) in jenkins and generated the jobs fine though. Not sure if it's a bug or not.

Thanks,
Wayne
Reply all
Reply to author
Forward
0 new messages