-
New Feature
-
Resolution: Not A Defect
-
Minor
-
None
Hello,
Would there be possible to have the possibility of provisioning config files inside jenkins programmatically (not just from the GUI)? Using groovy syntax via a pipeline?
For example, I tried doing it by accessing the java classes provided by the plugin, but with no luck (I looked in the source files...but, I have 0 experience in java so that says about all of it)
I tried something like this:
def filePath = 'path/to/new/cfg.file'
def gitContent = readFile(filePath).trim()
def folder = Jenkins.instance.getItemByFullName(FOLDER_PATH, Folder.class)
if (folder == null) {
error "Folder not found: ${FOLDER_PATH}"
}
def store = ConfigFiles.get()
def configFile = store.getById(CONFIG_FILE_ID)
if (configFile == null)
def newConfig = new CustomConfig(CONFIG_FILE_ID, "cfgfile.properties", "Updated config file", configFile.providerId, gitContent)
store.save(newConfig)
And it didn't work.
Thanks!