use of org.jboss.pnc.executor.exceptions.BuildProcessException in project pnc by project-ncl.
the class DefaultBuildExecutor method destroyEnvironment.
private void destroyEnvironment(BuildExecutionSession buildExecutionSession) {
try {
RunningEnvironment runningEnvironment = buildExecutionSession.getRunningEnvironment();
if (runningEnvironment != null) {
userLog.info("Destroying build environment.");
buildExecutionSession.setStatus(BuildExecutionStatus.BUILD_ENV_DESTROYING);
runningEnvironment.destroyEnvironment();
userLog.info("Build environment destroyed.");
buildExecutionSession.setStatus(BuildExecutionStatus.BUILD_ENV_DESTROYED);
} else {
userLog.warn("Unable to destroy environment. Most likely due to cancelled operation.");
}
} catch (Throwable e) {
throw new BuildProcessException(e);
}
}
use of org.jboss.pnc.executor.exceptions.BuildProcessException in project pnc by project-ncl.
the class DefaultBuildExecutor method retrieveRepositoryManagerResults.
private Void retrieveRepositoryManagerResults(DefaultBuildExecutionSession buildExecutionSession) {
try {
if (!buildExecutionSession.hasFailed() && !buildExecutionSession.isCanceled()) {
ProcessStageUtils.logProcessStageBegin(BuildExecutionStatus.COLLECTING_RESULTS_FROM_REPOSITORY_MANAGER.toString(), "Collecting results from repository manager ...");
buildExecutionSession.setStatus(BuildExecutionStatus.COLLECTING_RESULTS_FROM_REPOSITORY_MANAGER);
RunningEnvironment runningEnvironment = buildExecutionSession.getRunningEnvironment();
if (runningEnvironment == null) {
return null;
}
RepositorySession repositorySession = runningEnvironment.getRepositorySession();
if (repositorySession == null) {
return null;
}
RepositoryManagerResult repositoryManagerResult = repositorySession.extractBuildArtifacts(true);
buildExecutionSession.setRepositoryManagerResult(repositoryManagerResult);
if (repositoryManagerResult.getCompletionStatus().isFailed()) {
buildExecutionSession.setStatus(BuildExecutionStatus.COLLECTING_RESULTS_FROM_REPOSITORY_MANAGER_COMPLETED_WITH_ERROR);
} else {
buildExecutionSession.setStatus(BuildExecutionStatus.COLLECTING_RESULTS_FROM_REPOSITORY_MANAGER_COMPLETED_SUCCESS);
}
}
} catch (Throwable e) {
throw new BuildProcessException(e, buildExecutionSession.getRunningEnvironment());
} finally {
ProcessStageUtils.logProcessStageEnd(BuildExecutionStatus.COLLECTING_RESULTS_FROM_REPOSITORY_MANAGER.toString(), "Collected results from repository manager.");
}
return null;
}
use of org.jboss.pnc.executor.exceptions.BuildProcessException in project pnc by project-ncl.
the class DefaultBuildExecutor method setUpEnvironment.
private CompletableFuture<Void> setUpEnvironment(DefaultBuildExecutionSession buildExecutionSession, RepositorySession repositorySession, DebugData debugData) {
if (buildExecutionSession.isCanceled()) {
return null;
}
ProcessStageUtils.logProcessStageBegin(BuildExecutionStatus.BUILD_ENV_SETTING_UP.toString(), "Setting up build environment ...");
buildExecutionSession.setStatus(BuildExecutionStatus.BUILD_ENV_SETTING_UP);
BuildExecutionConfiguration buildExecutionConfiguration = buildExecutionSession.getBuildExecutionConfiguration();
try {
EnvironmentDriver envDriver = environmentDriverFactory.getDriver(buildExecutionConfiguration.getSystemImageType());
StartedEnvironment startedEnv = envDriver.startEnvironment(buildExecutionConfiguration.getSystemImageId(), buildExecutionConfiguration.getSystemImageRepositoryUrl(), buildExecutionConfiguration.getSystemImageType(), repositorySession, debugData, buildExecutionSession.getAccessToken(), buildExecutionConfiguration.isTempBuild(), buildExecutionConfiguration.getGenericParameters());
buildExecutionSession.setCancelHook(startedEnv::cancel);
return waitForEnvironmentInitialization(buildExecutionSession, startedEnv);
} catch (Throwable e) {
throw new BuildProcessException(e);
}
}
Aggregations