use of net.nemerosa.ontrack.model.structure.Build in project ontrack by nemerosa.
the class SCMUtilsServiceImpl method getBranchInfo.
@Override
public SCMIssueCommitBranchInfo getBranchInfo(Optional<Build> buildAfterCommit, SCMIssueCommitBranchInfo branchInfo) {
SCMIssueCommitBranchInfo info = branchInfo;
if (buildAfterCommit.isPresent()) {
Build build = buildAfterCommit.get();
// Gets the build view
BuildView buildView = structureService.getBuildView(build, true);
// Adds it to the list
info = info.withBuildView(buildView);
// Collects the promotions for the branch
info = info.withBranchStatusView(structureService.getEarliestPromotionsAfterBuild(build));
}
// OK
return info;
}
use of net.nemerosa.ontrack.model.structure.Build in project ontrack by nemerosa.
the class BuildSVNInformationExtension method getInformation.
@Override
public Optional<EntityInformation> getInformation(ProjectEntity entity) {
if (entity instanceof Build) {
Build build = (Build) entity;
// Gets the branch SVN information
Property<SVNBranchConfigurationProperty> branchConfigurationProperty = propertyService.getProperty(build.getBranch(), SVNBranchConfigurationPropertyType.class);
Property<SVNProjectConfigurationProperty> projectConfigurationProperty = propertyService.getProperty(build.getBranch().getProject(), SVNProjectConfigurationPropertyType.class);
if (branchConfigurationProperty.isEmpty() || projectConfigurationProperty.isEmpty()) {
return Optional.empty();
} else {
// Loads the repository
SVNRepository repository = svnService.getRepository(projectConfigurationProperty.getValue().getConfiguration().getName());
// Gets the build history
try (Transaction ignored = transactionService.start()) {
return Optional.of(new EntityInformation(this, svnChangeLogService.getBuildSVNHistory(repository, build)));
}
}
} else {
return Optional.empty();
}
}
Aggregations