use of org.fakekoji.jobmanager.JenkinsJobTemplateBuilder in project jenkins-scm-koji-plugin by judovana.
the class BuildJob method generateTemplate.
@Override
public String generateTemplate() throws IOException {
// TODO: do this better
final Map<TaskVariant, TaskVariantValue> variants = new HashMap<TaskVariant, TaskVariantValue>() {
{
putAll(getVariants());
put(new TaskVariant("buildPlatform", "", Task.Type.BUILD, "", 0, Collections.emptyMap(), false), new TaskVariantValue(getPlatform().getId(), ""));
}
};
return XML_DECLARATION + new JenkinsJobTemplateBuilder(JenkinsJobTemplateBuilder.loadTemplate(TASK_JOB_TEMPLATE), this).buildBuildProvidersTemplate(getBuildProviders()).buildFakeKojiXmlRpcApiTemplate(getProjectName(), variants, JenkinsJobTemplateBuilder.fillBuildPlatform(getPlatform(), getTask().getFileRequirements()), false).buildTriggerTemplate(getTask().getScmPollSchedule()).buildScriptTemplate(getTask(), getPlatformProvider(), getPlatform(), getScriptsRoot(), getExportedVariables()).buildPostBuildTasks(getTask().getXmlTemplate()).prettyPrint();
}
use of org.fakekoji.jobmanager.JenkinsJobTemplateBuilder in project jenkins-scm-koji-plugin by judovana.
the class TestJob method generateKojiTemplate.
private String generateKojiTemplate() throws IOException {
final List<String> subpackageBlacklist;
final List<String> subpackageWhitelist;
if (getTask().getFileRequirements().getBinary().equals(Task.BinaryRequirements.BINARIES)) {
// this is workaround
// only one task is known to require binaries, and that requires them all
// if ever listing will need filtering also on BINARIES
// BINARIES and BINARIES_ALL mayb need to be introduced
subpackageBlacklist = Arrays.asList();
subpackageWhitelist = Arrays.asList(".*");
} else {
subpackageBlacklist = Stream.of(projectSubpackageBlacklist, getTask().getRpmLimitation().getBlacklist(), getBuildVariants().values().stream().map(TaskVariantValue::getSubpackageBlacklist).map(list -> list.orElse(Collections.emptyList())).flatMap(List::stream).collect(Collectors.toList())).flatMap(List::stream).distinct().collect(Collectors.toList());
subpackageWhitelist = Stream.of(projectSubpackageWhitelist, getTask().getRpmLimitation().getWhitelist(), getBuildVariants().values().stream().map(TaskVariantValue::getSubpackageWhitelist).map(list -> list.orElse(Collections.emptyList())).flatMap(List::stream).collect(Collectors.toList())).flatMap(List::stream).distinct().collect(Collectors.toList());
}
return XML_DECLARATION + new JenkinsJobTemplateBuilder(loadTemplate(TASK_JOB_TEMPLATE), this).buildBuildProvidersTemplate(getBuildProviders()).buildKojiXmlRpcApiTemplate(getProduct().getPackageName(), getBuildPlatform(), getTask().getFileRequirements(), subpackageBlacklist, subpackageWhitelist).buildScriptTemplate(getTask(), getPlatformProvider(), getPlatform(), getScriptsRoot(), getExportedVariables()).buildTriggerTemplate(getTask().getScmPollSchedule()).buildPostBuildTasks(getTask().getXmlTemplate()).prettyPrint();
}
Aggregations