How to remove a build step

43 views
Skip to first unread message

ru...@zollsoft.de

unread,
Aug 4, 2016, 2:09:36 AM8/4/16
to job-dsl-plugin
Can we delete a build step ?

This is a piece of our job template, which has one build step too much.

<?xml version="1.0" encoding="UTF-8"?><project>
  ...
   
<builders>
       
<hudson.plugins.copyartifact.CopyArtifact plugin="copyar...@1.38.1">
           
<project> ...
            ...
           
<doNotFingerprintArtifacts>false</doNotFingerprintArtifacts>
       
</hudson.plugins.copyartifact.CopyArtifact>
       ....


The copyartifact step:
    <hudson.plugins.copyartifact.CopyArtifact ...

should be removed by the seed job.

It this possible ?
Thank you,
Ruben

Daniel Spilker

unread,
Aug 8, 2016, 7:50:06 PM8/8/16
to job-dsl...@googlegroups.com
You can use a configure block (https://github.com/jenkinsci/job-dsl-plugin/wiki/The-Configure-Block) to remove XML elements from the generated config.

See this thread for details:
https://groups.google.com/d/msg/job-dsl-plugin/n4VDwdxeUGg/8c4AAVrWEgAJ


--
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/58c68061-9105-460c-904b-13706aa663d4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Message has been deleted

ru...@zollsoft.de

unread,
Aug 9, 2016, 5:40:34 AM8/9/16
to job-dsl-plugin
Thank you Daniel,
That works well. In my example, it looks like:

  configure { project ->
   
...
   
Node n = project / builders / 'hudson.plugins.copyartifact.CopyArtifact'
   
(project / builders).remove(n)
 
}  
(Remark: This works because there is exactly one 'hudson.plugins.copyartifact.CopyArtifact' node. As soon as we introduce another one, a probably need to distinguish them by their attributes.)
Reply all
Reply to author
Forward
0 new messages