Search in sources :

Example 1 with Build

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;
}
Also used : BuildView(net.nemerosa.ontrack.model.structure.BuildView) Build(net.nemerosa.ontrack.model.structure.Build) SCMIssueCommitBranchInfo(net.nemerosa.ontrack.extension.scm.model.SCMIssueCommitBranchInfo)

Example 2 with Build

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();
    }
}
Also used : Transaction(net.nemerosa.ontrack.tx.Transaction) SVNProjectConfigurationProperty(net.nemerosa.ontrack.extension.svn.property.SVNProjectConfigurationProperty) Build(net.nemerosa.ontrack.model.structure.Build) SVNBranchConfigurationProperty(net.nemerosa.ontrack.extension.svn.property.SVNBranchConfigurationProperty) EntityInformation(net.nemerosa.ontrack.extension.api.model.EntityInformation) SVNRepository(net.nemerosa.ontrack.extension.svn.db.SVNRepository)

Aggregations

Build (net.nemerosa.ontrack.model.structure.Build)2 EntityInformation (net.nemerosa.ontrack.extension.api.model.EntityInformation)1 SCMIssueCommitBranchInfo (net.nemerosa.ontrack.extension.scm.model.SCMIssueCommitBranchInfo)1 SVNRepository (net.nemerosa.ontrack.extension.svn.db.SVNRepository)1 SVNBranchConfigurationProperty (net.nemerosa.ontrack.extension.svn.property.SVNBranchConfigurationProperty)1 SVNProjectConfigurationProperty (net.nemerosa.ontrack.extension.svn.property.SVNProjectConfigurationProperty)1 BuildView (net.nemerosa.ontrack.model.structure.BuildView)1 Transaction (net.nemerosa.ontrack.tx.Transaction)1