Re: Junit test : seed job to maven Job DSL

2020-12-17 Thread Charles Moulliard
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/jwchtqkn5y76hrfrws7dqtqmgn/T/j 
> h5344303144116520886/workspace/test0
> Processing provided DSL script
> ERROR: java.io.IOException: Unable to read 
> /var/folders/t2/jwchtqkn5y76hrfrws7dqtqmgn/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)
>
> 
> 
>   false
>   
>   
>   false
>   false
>   
> false
>   false
>   
>   false
>   
> 
>   mavenJob('mvn-spring-boot-rest-http') {
> description 'A Maven Job compiling the project Spring Boot Rest 
> HTTP Example'
>
> parameters {
> gitParameter {
> name 'SELECTED_TAG'
> description 'The Git tag to checkout'
> type 'PT_TAG'
> defaultValue '2.3.4-2'
> branch ''
> branchFilter 'origin/(.*)'
> quickFilterEnabled false
> selectedValue 'DEFAULT'
> sortMode 'DESCENDING_SMART'
> tagFilter '*'
> useRepository '.*rest-http-example.git'
> listSize '10'
> }
> }
>
> scm {
> git {
> remote {
> url '
> https://github.com/snowdrop/rest-http-example.git'
> // branch('$SELECTED_TAG')
> branch('2.3.4-2')
> }
> }
> }
> rootPOM 'pom.xml'
> goals 'clean install'
> }
>   true
>   false
>   false
>   false
>   false
>   false
>   false
>   IGNORE
>   IGNORE
>   IGNORE
>   JENKINS_ROOT
> 
>   
>   
>   
> 
>
> excepted that the config.xml created from the UI includes this additional 
> parameter
>
> 
>
> 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.


Junit test : seed job to maven Job DSL

2020-12-17 Thread Charles Moulliard
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/jwchtqkn5y76hrfrws7dqtqmgn/T/j 
h5344303144116520886/workspace/test0
Processing provided DSL script
ERROR: java.io.IOException: Unable to read 
/var/folders/t2/jwchtqkn5y76hrfrws7dqtqmgn/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)



  false
  
  
  false
  false
  false
  false
  
  false
  

  mavenJob('mvn-spring-boot-rest-http') {
description 'A Maven Job compiling the project Spring Boot Rest 
HTTP Example'

parameters {
gitParameter {
name 'SELECTED_TAG'
description 'The Git tag to checkout'
type 'PT_TAG'
defaultValue '2.3.4-2'
branch ''
branchFilter 'origin/(.*)'
quickFilterEnabled false
selectedValue 'DEFAULT'
sortMode 'DESCENDING_SMART'
tagFilter '*'
useRepository '.*rest-http-example.git'
listSize '10'
}
}

scm {
git {
remote {
url 
'https://github.com/snowdrop/rest-http-example.git'
// branch('$SELECTED_TAG')
branch('2.3.4-2')
}
}
}
rootPOM 'pom.xml'
goals 'clean install'
}
  true
  false
  false
  false
  false
  false
  false
  IGNORE
  IGNORE
  IGNORE
  JENKINS_ROOT

  
  
  


excepted that the config.xml created from the UI includes this additional 
parameter



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.