jervis icon indicating copy to clipboard operation
jervis copied to clipboard

Preserve credentials on multibranch pipeline jobs

Open samrocketman opened this issue 7 years ago • 0 comments

Multibranch pipelines overwrite their own configuration. If the configuration exists, then we want to preserve some specific values. For example, credentials or other configurations.

Here's an example of getting existing credentials and converting it to XML as plain text.

import hudson.util.DescribableList
import hudson.util.XStream2
import jenkins.model.Jenkins

XStream2 xs = new XStream2()
xs.alias('properties', DescribableList.class)
xs.toXML(Jenkins.instance.getItemByFullName('samrocketman/jervis').properties)

samrocketman avatar Apr 17 '18 07:04 samrocketman