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-dsl@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/f2e86a34-a04e-4b7b-adea-41e4b7b77c34n%40googlegroups.com.

Reply via email to