Hi,
you can use the following lines in your Job DSL script to get a mapping of settings names to IDs.
import jenkins.model.Jenkins
Jenkins jenkins = Jenkins.getInstance()
def
mavenSettingsConfigProvider =
jenkins.getExtensionList("org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig\$MavenSettingsConfigProvider")[0]
Map<String, String> mavenSettings = mavenSettingsConfigProvider.allConfigs.collectEntries { [
it.name,
it.id] }
By coincidence, I opened a pull request for the Job DSL Plugin which add DSL support for Maven settings:
https://github.com/jenkinsci/job-dsl-plugin/pull/269I'm planning to release a new version of the Job DSL Plugin containing these changes in the next two weeks. In the meantime you can also use the latest SNAPSHOT build which already contains the changes:
http://repo.jenkins-ci.org/simple/snapshots/org/jenkins-ci/plugins/job-dsl/1.25-SNAPSHOT/Please use the Job DSL mailing list for any Job DSL questions:
https://groups.google.com/forum/?fromgroups#!forum/job-dsl-pluginDaniel
On Monday, August 18, 2014 10:32:07 AM UTC+2, Constantin Caraivan wrote:
Unfortunately, the config file provider uses generated IDs in the configuration:
<settings class="org.jenkinsci.plugins.configfiles.maven.job.MvnSettingsProvider" plugin="config-file-provider@2.7.5">
<settingsConfigId>org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig1408033012483</settingsConfigId>
</settings>
Short of hardcoding the ID (1408033012483) in the DSL, is there a way to get a plugin's configuration from the system Groovy? Ideally I'd like a way to interrogate Jenkins or the plugin about the configuration it stores based on the names I've given them.
Thank you,
_____________
Costin Caraivan