ghale / gradle-jenkins-plugin

Gradle plugin to programmatically configure Jenkins jobs.
123 stars 42 forks source link

Allow pretty printing for remoteJenkinsItems (default=false) #64

Closed u3r closed 8 years ago

u3r commented 8 years ago

When pulling the initial configuration off of an exiting jenkins it is nice to have human readable xml.

ghale commented 8 years ago

Thanks for the contribution! I should have some time this week to merge it.

u3r commented 8 years ago

I've done some tests - you are right: jenkins really does not like pretty printed xml. The xml handling could be improved by some conditional formatting to get good templates:

 XmlNodePrinter(preserveWhitespace:true)

should fix that - but I don't have patch ready right now.

u3r commented 8 years ago

I have added config options to preserve whitespace as mentioned above. Defaults are false for dumpJenkinsJobs (to preserve compatibility) and true for dumpRemoteJenkinsJobs (if enabled via prettyPrint = true). So one can easily configure a jenkins job, dump it with the command and use it as template without manual reformatting while still being more readable than the one-line xml.

I don't mind defaults changing - take your pick on what you like.

donalhenry commented 8 years ago

I've had good luck with the u3r:master branch. With prettyPrint = true and prettyPrintPreserveWhitespace = false, I was able to quickly capture the configuration for a Jenkins server by running the dumpRemoteJenkinsItems task, storing the XML files locally, and verify that these files are correct by running the validateJenkinsItems task.

ghale commented 8 years ago

Thanks for the contribution! This is in v1.3.2.