Viewing Jenkins Jobs' Configuration as XML

Featured image for sharing metadata for article

Today I've been working with the Jenkins Job DSL plugin, which although great, doesn't provide native bindings for all the properties you'd want.

So I found myself needing to get the raw XML to then apply that using the configure block. I fortunately had the Job Configuration History plugin to provide the XML handily for me, but I wondered if there was something better.

It turns out that if you have the Job/ExtendedRead permission, you can simply browse to /config.xml on a given job. For instance

Job URL:   http://localhost:8080/job/production-deploy/
Conig URL: http://localhost:8080/job/production-deploy/config.xml

For some strange reason, it is not possible to set the permission in the Global Security Configuration UI, so you need the Extended Read Permission plugin to expose it in the UI. An alternative is to have the Confiure permission, but this can be a bit more risky if you want to lock down the ability to change your jobs, especially if you want to be moving to purely Job configuration as code.

But do note that this has the potential to expose configuration or secrets that aren't stored in Jenkins' credentials management, or in a proper secrets management solution, as well job configuration details you do not wish to share.

Written by Jamie Tanna's profile image Jamie Tanna on , and last updated on .

Content for this article is shared under the terms of the Creative Commons Attribution Non Commercial Share Alike 4.0 International, and code is shared under the Apache License 2.0.

#blogumentation #jenkins #job-dsl #nablopomo.

This post was filed under articles.

This post is part of the series nablopomo-2019.

Interactions with this post

Interactions with this post

Below you can find the interactions that this page has had using WebMention.

Have you written a response to this post? Let me know the URL:

Do you not have a website set up with WebMention capabilities? You can use Comment Parade.