use of org.jboss.pnc.model.BuildConfiguration in project pnc by project-ncl.
the class DefaultBuildCoordinator method checkIfAnyBuildConfigurationNeedsARebuild.
private void checkIfAnyBuildConfigurationNeedsARebuild(BuildSetTask buildSetTask, BuildConfigurationSet buildConfigurationSet, boolean checkImplicitDependencies, boolean temporaryBuild, AlignmentPreference alignmentPreference) {
Set<BuildConfiguration> buildConfigurations = buildConfigurationSet.getBuildConfigurations();
int requiresRebuild = buildConfigurations.size();
log.debug("There are {} configurations in a set {}.", requiresRebuild, buildConfigurationSet.getId());
Set<Integer> processedDependenciesCache = new HashSet<>();
for (BuildConfiguration buildConfiguration : buildConfigurations) {
BuildConfigurationAudited buildConfigurationAudited = datastoreAdapter.getLatestBuildConfigurationAuditedInitializeBCDependencies(buildConfiguration.getId());
if (!datastoreAdapter.requiresRebuild(buildConfigurationAudited, checkImplicitDependencies, temporaryBuild, alignmentPreference, processedDependenciesCache)) {
requiresRebuild--;
}
}
if (requiresRebuild == 0) {
updateBuildSetTaskStatus(buildSetTask, BuildSetStatus.NO_REBUILD_REQUIRED, "All build configs were previously built");
}
}
use of org.jboss.pnc.model.BuildConfiguration in project pnc by project-ncl.
the class BuildTriggererImpl method doTriggerBuild.
private BuildSetTask doTriggerBuild(final int buildConfigId, OptionalInt buildConfigurationRevision, BuildOptions buildOptions) throws BuildConflictException, CoreException {
BuildSetTask buildSetTask;
if (buildConfigurationRevision.isPresent()) {
final BuildConfigurationAudited buildConfigurationAudited = buildConfigurationAuditedRepository.queryById(new IdRev(buildConfigId, buildConfigurationRevision.getAsInt()));
Preconditions.checkArgument(buildConfigurationAudited != null, "Can't find Build Configuration with id=" + buildConfigId + ", rev=" + buildConfigurationRevision.getAsInt());
buildSetTask = buildCoordinator.build(hibernateLazyInitializer.initializeBuildConfigurationAuditedBeforeTriggeringIt(buildConfigurationAudited), user.currentUser(), buildOptions);
} else {
final BuildConfiguration buildConfiguration = buildConfigurationRepository.queryById(buildConfigId);
Preconditions.checkArgument(buildConfiguration != null, "Can't find Build Configuration with id=" + buildConfigId);
buildSetTask = buildCoordinator.build(hibernateLazyInitializer.initializeBuildConfigurationBeforeTriggeringIt(buildConfiguration), user.currentUser(), buildOptions);
}
logger.info("Started build of Build Configuration {}. Build Tasks: {}", buildConfigId, buildSetTask.getBuildTasks().stream().map(BuildTask::getId).collect(Collectors.joining()));
return buildSetTask;
}
use of org.jboss.pnc.model.BuildConfiguration in project pnc by project-ncl.
the class ProductVersionProviderImpl method store.
@Override
public ProductVersion store(ProductVersion restEntity) {
validateBeforeSaving(restEntity);
org.jboss.pnc.model.ProductVersion productVersionRestDb = mapper.toEntity(restEntity);
Product product = productRepository.queryById(Integer.valueOf(restEntity.getProduct().getId()));
productVersionRestDb.generateBrewTagPrefix(product.getAbbreviation(), restEntity.getVersion(), systemConfig.getBrewTagPattern());
org.jboss.pnc.model.ProductVersion productVersion = repository.save(productVersionRestDb);
for (BuildConfiguration bc : productVersionRestDb.getBuildConfigurations()) {
bc.setProductVersion(productVersion);
}
repository.flushAndRefresh(productVersion);
return mapper.toDTO(productVersion);
}
use of org.jboss.pnc.model.BuildConfiguration in project pnc by project-ncl.
the class GroupConfigurationProviderImpl method archive.
private void archive(String groupConfigurationId) throws DTOValidationException {
ValidationBuilder.validateObject(WhenUpdating.class).validateAgainstRepository(repository, Integer.valueOf(groupConfigurationId), true);
BuildConfigurationSet buildConfigurationSet = repository.queryById(Integer.valueOf(groupConfigurationId));
buildConfigurationSet.setArchived(true);
// if a build group is archived, unlink the build group from the build configurations is associated with
for (BuildConfiguration bc : buildConfigurationSet.getBuildConfigurations()) {
bc.removeBuildConfigurationSet(buildConfigurationSet);
buildConfigurationRepository.save(bc);
buildConfigurationSet.removeBuildConfiguration(bc);
}
repository.save(buildConfigurationSet);
}
use of org.jboss.pnc.model.BuildConfiguration in project pnc by project-ncl.
the class GroupConfigurationProviderImpl method removeConfiguration.
@Override
public void removeConfiguration(String id, String configId) {
BuildConfigurationSet buildConfigSet = repository.queryById(Integer.valueOf(id));
BuildConfiguration buildConfig = buildConfigurationRepository.queryById(Integer.valueOf(configId));
ValidationBuilder.validateObject(buildConfigSet, WhenUpdating.class).validateCondition(buildConfigSet != null, "No build configuration set exists with id: " + id).validateCondition(buildConfig != null, "No build configuration exists with id: " + configId);
if (buildConfigSet.getBuildConfigurations().contains(buildConfig)) {
buildConfigSet.removeBuildConfiguration(buildConfig);
repository.save(buildConfigSet);
}
}
Aggregations