use of org.fakekoji.jobmanager.model.TestJobConfiguration in project jenkins-scm-koji-plugin by judovana.
the class ReverseJDKProjectParser method parseJDKTestProjectJobs.
public Result<JDKTestProject, String> parseJDKTestProjectJobs(Set<TestJob> jobs) {
return validateJobs(jobs, getTestJobValidator()).flatMap(projectRepresentingJob -> {
final Set<BuildPlatformConfig> buildPlatforms = new HashSet<>();
for (final TestJob job : jobs) {
final String platformProvider = job.getPlatformProvider();
final Platform bp = job.getBuildPlatform();
final Map<String, String> bv = variantsMapToStringMap(job.getBuildVariants());
final Platform tp = job.getPlatform();
final Task tt = job.getTask();
final Map<String, String> tv = variantsMapToStringMap(job.getVariants());
final VariantsConfig testVariants;
final BuildPlatformConfig bpc = findOrCreatePlatform(buildPlatforms, bp.getId());
final VariantsConfig buildVariants = findOrCreateVariants(bpc.getVariants(), bv);
final PlatformConfig testPlatform = findOrCreatePlatform(buildVariants.getPlatforms(), tp.getId(), platformProvider);
final TaskConfig task = findOrCreateTask(testPlatform.getTasks(), tt.getId());
final Optional<VariantsConfig> tvOptional = findVariants(task.getVariants(), tv);
if (tvOptional.isPresent()) {
return Result.err("Duplicate job: " + job.getName());
} else {
testVariants = new VariantsConfig(tv);
task.getVariants().add(testVariants);
}
}
return Result.ok(new JDKTestProject(projectRepresentingJob.getProjectName(), projectRepresentingJob.getProduct(), projectRepresentingJob.getBuildProviders().stream().map(BuildProvider::getId).collect(Collectors.toSet()), projectRepresentingJob.getProjectSubpackageBlacklist(), projectRepresentingJob.getProjectSubpackageWhitelist(), new TestJobConfiguration(buildPlatforms), projectRepresentingJob.getProjectVariables()));
});
}
Aggregations