use of javaposse.jobdsl.plugin.DslExtensionMethod in project promoted-builds-plugin by jenkinsci.
the class PromotionsExtensionPoint method promotions.
@DslExtensionMethod(context = PropertiesContext.class)
public Object promotions(Runnable closure, DslEnvironment dslEnvironment) throws FormException, IOException {
PromotionsContext context = new PromotionsContext(dslEnvironment);
executeInContext(closure, context);
dslEnvironment.put("processNames", context.names);
JobPropertyImpl jobProperty = new JobPropertyImpl(context.names);
Map<String, JobDslPromotionProcess> promotionProcesses = new HashMap<String, JobDslPromotionProcess>();
for (String processName : context.names) {
PromotionContext promotionContext = context.promotionContexts.get(processName);
JobDslPromotionProcess jobDslPromotionProcess = new JobDslPromotionProcess();
jobDslPromotionProcess.setName(processName);
jobDslPromotionProcess.setIcon(promotionContext.getIcon());
jobDslPromotionProcess.setAssignedLabel(promotionContext.getRestrict());
jobDslPromotionProcess.setBuildSteps(promotionContext.getActions());
jobDslPromotionProcess.setConditions(promotionContext.getConditions());
promotionProcesses.put(processName, jobDslPromotionProcess);
}
dslEnvironment.put("promotionProcesses", promotionProcesses);
return jobProperty;
}
Aggregations