Removing some parameters through DSL is not reflected in live-job

177 views
Skip to first unread message

Squalou Jenkins

unread,
Feb 11, 2016, 7:20:03 AM2/11/16
to job-dsl-plugin
Hi,

I'm using last 'long term support' version of jenkins, and DSL plugin 1.42.

Apparently the 'update / remove' of some parameters is not always working, I was wondering if someone faced this kehavior.

Example :

use this :

job("foobar"){
 description("some job")
}

run it, it creates a job with a decription.

Now change to :
job("foobar"){
}

run it : the job is updated both in jenkins 'live', and in config.xml : no more description, xml is set to <description/>

==> Cool ! it works.


Now do the same with

job("foobar"){
customWorkspace('${WORKSPACE}/${JOB_NAME}/${BUILD_NUMBER}')
}

=> creates a job with a customworkspace

job("foobar"){
}

=> the xml is updated, *but not* the 'live' job in running jenkins.


Now, for fun I tried a massive extermination configure block :

job("foobar"){
    configure { project ->
        def anode = project
        def unodes=[]
 
       anode.each{
            unodes.add(it)
        }
       
        unodes.each{
            println 'deleting configuration node : ['+it.name().toString()+']'
            project.remove(project / it.name().toString())
        }
     }
}


Guess what : the confg.xml is empty, ok, but the 'live' job is completely unaffected.



Am I missing something here ?

Do I need to 'force reload' something ? (and no, sorry but no, I can't reboot jenkins, that's not an option for reasons I won't loose time explaining)



thaks for any insight about this !

Daniel Spilker

unread,
Feb 11, 2016, 7:27:24 AM2/11/16
to job-dsl...@googlegroups.com
Hi,

this is a known issue in Jenkins and the underlying XStream library. See https://issues.jenkins-ci.org/browse/JENKINS-26825 and the linked issues.

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-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/85a2c541-c989-49dc-bf91-bd05bbb1a42b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Squalou Jenkins

unread,
Feb 11, 2016, 7:41:16 AM2/11/16
to job-dsl-plugin
Thanks !

that was fast, sorry I didn't find it myself  :-)
Reply all
Reply to author
Forward
0 new messages