use of javaposse.jobdsl.plugin.JenkinsJobManagement in project configuration-as-code-plugin by jenkinsci.
the class JenkinsConfigurator method describe.
@Override
public Set<Attribute> describe() {
final Set<Attribute> attributes = super.describe();
final Jenkins jenkins = Jenkins.getInstance();
attributes.add(new PersistedListAttribute<Cloud>("clouds", jenkins.clouds, Cloud.class));
attributes.add(new Attribute<String>("jobs", String.class).multiple(true).setter((target, attribute, value) -> {
JenkinsJobManagement mng = new JenkinsJobManagement(System.out, new EnvVars(), null, null, LookupStrategy.JENKINS_ROOT);
for (String script : (List<String>) value) {
new JenkinsDslScriptLoader(mng).runScript(script);
}
}));
// Check for unclassified Descriptors
final ExtensionList<Descriptor> descriptors = jenkins.getExtensionList(Descriptor.class);
for (Descriptor descriptor : descriptors) {
if (descriptor.getGlobalConfigPage() != null && descriptor.getCategory() instanceof GlobalConfigurationCategory.Unclassified) {
final DescriptorConfigurator configurator = new DescriptorConfigurator(descriptor);
attributes.add(new Attribute(configurator.getName(), configurator.getTarget()).setter(NOOP));
}
}
// Add remoting security, all legwork will be done by a configurator
attributes.add(new Attribute("remotingSecurity", AdminWhitelistRule.class).setter(NOOP));
return attributes;
}
Aggregations