FYI: I can, of course, create the job and build it using the `config.xml` 
generated on a jenkins instance running locally -> `java -jar 
jenkins-cli.jar -s http://localhost:8080 create-job maven-seed-job2 < 
seed-maven-job2.xml`

So I suspect a problem with the Job DSL Plugin when the job build is 
scheduled with the "ExecuteDslScripts". But If no stacktrace is reported, 
then it will very hard to figure out the issue
On Thursday, December 17, 2020 at 11:54:39 AM UTC+1 Charles Moulliard wrote:

> Hi
>
> I created a Junit test case which is available here:  
> https://github.com/ch007m/jenkins-job-dsl/blob/31efa049a95c333a8dba9b01ff2aa281b3520e34/src/test/java/dev/snowdrop/MavenJobDSLTest.java#L25-L53
>  
> where a seed job is created to populate a mavenJob using the DSL groovy 
> file provided 
>
> But when it is executed; the job build fails and reports this error
>
> Legacy code started this job.  No cause information is available
> Running as SYSTEM
> Building in workspace /var/folders/t2/jwchtqkn5y76hrfrws7dqtqm0000gn/T/j 
> h5344303144116520886/workspace/test0
> Processing provided DSL script
> ERROR: java.io.IOException: Unable to read 
> /var/folders/t2/jwchtqkn5y76hrfrws7dqtqm0000gn/T/j 
> h5344303144116520886/jobs/mvn-spring-boot-rest-http/config.xml
> Finished: FAILURE
>
> The error comes from the fact that the job "mvn-spring-boot-rest-http" 
> has not been created under the "jobs" folder. the jobs folder only contains 
> a "test0" folder.
>
> How can I investigate the problem and fix that ? 
>
> If I check the config.xml file generated, it looks good (vs same 
> config.xml file created using the UI)
>
> <?xml version='1.1' encoding='UTF-8'?>
> <project>
>   <keepDependencies>false</keepDependencies>
>   <properties/>
>   <scm class="hudson.scm.NullSCM"/>
>   <canRoam>false</canRoam>
>   <disabled>false</disabled>
>   
> <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
>   <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
>   <triggers/>
>   <concurrentBuild>false</concurrentBuild>
>   <builders>
>     <javaposse.jobdsl.plugin.ExecuteDslScripts>
>       <scriptText>mavenJob(&apos;mvn-spring-boot-rest-http&apos;) {
>     description &apos;A Maven Job compiling the project Spring Boot Rest 
> HTTP Example&apos;
>
>     parameters {
>         gitParameter {
>             name &apos;SELECTED_TAG&apos;
>             description &apos;The Git tag to checkout&apos;
>             type &apos;PT_TAG&apos;
>             defaultValue &apos;2.3.4-2&apos;
>             branch &apos;&apos;
>             branchFilter &apos;origin/(.*)&apos;
>             quickFilterEnabled false
>             selectedValue &apos;DEFAULT&apos;
>             sortMode &apos;DESCENDING_SMART&apos;
>             tagFilter &apos;*&apos;
>             useRepository &apos;.*rest-http-example.git&apos;
>             listSize &apos;10&apos;
>         }
>     }
>
>     scm {
>         git {
>             remote {
>                 url &apos;
> https://github.com/snowdrop/rest-http-example.git&apos;
>                 // branch(&apos;$SELECTED_TAG&apos;)
>                 branch(&apos;2.3.4-2&apos;)
>             }
>         }
>     }
>     rootPOM &apos;pom.xml&apos;
>     goals &apos;clean install&apos;
> }</scriptText>
>       <usingScriptText>true</usingScriptText>
>       <sandbox>false</sandbox>
>       <ignoreExisting>false</ignoreExisting>
>       <ignoreMissingFiles>false</ignoreMissingFiles>
>       <failOnMissingPlugin>false</failOnMissingPlugin>
>       <failOnSeedCollision>false</failOnSeedCollision>
>       <unstableOnDeprecation>false</unstableOnDeprecation>
>       <removedJobAction>IGNORE</removedJobAction>
>       <removedViewAction>IGNORE</removedViewAction>
>       <removedConfigFilesAction>IGNORE</removedConfigFilesAction>
>       <lookupStrategy>JENKINS_ROOT</lookupStrategy>
>     </javaposse.jobdsl.plugin.ExecuteDslScripts>
>   </builders>
>   <publishers/>
>   <buildWrappers/>
> </project>
>
> excepted that the config.xml created from the UI includes this additional 
> parameter
>
> <javaposse.jobdsl.plugin.ExecuteDslScripts plugin="job...@1.77">
>
> Cheers
>
> Charles
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/000da4cd-8384-4417-b3f0-def8986ef8d7n%40googlegroups.com.

Reply via email to