use of org.jboss.pnc.dto.tasks.RepositoryCreationResult in project pnc by project-ncl.
the class SCMRepositoryProviderImpl method repositoryCreationCompleted.
@Override
public void repositoryCreationCompleted(RepositoryCreationResult result) {
if (result.getStatus().isSuccess()) {
Consumer<RepositoryCreated> onRepositoryCreated = event -> {
log.debug("Repository created: {}", event);
if (result.getJobType().equals(JobNotificationType.BUILD_CONFIG_CREATION)) {
buildConfigurationProvider.createBuildConfigurationWithRepository(result.getTaskId().toString(), event.getRepositoryId(), result.getBuildConfiguration());
}
notifySCMRepositoryCreated(event);
};
onRepoCloneSuccess(result.getInternalScmUrl(), result.getTaskId(), onRepositoryCreated, result.getJobType(), result.getExternalUrl(), result.isPreBuildSyncEnabled());
} else {
String eventType;
if (!result.isRepoCreatedSuccessfully()) {
eventType = BpmEventType.RC_REPO_CREATION_ERROR.toString();
} else {
eventType = BpmEventType.RC_REPO_CLONE_ERROR.toString();
}
org.jboss.pnc.bpm.model.RepositoryConfiguration repositoryConfiguration = org.jboss.pnc.bpm.model.RepositoryConfiguration.builder().externalUrl(result.getExternalUrl()).preBuildSyncEnabled(result.isPreBuildSyncEnabled()).build();
RepositoryCreationProcess repositoryCreationProcess = RepositoryCreationProcess.builder().repositoryConfiguration(repositoryConfiguration).build();
notifier.sendMessage(new RepositoryCreationFailure(result.getJobType(), eventType, repositoryCreationProcess, result.getTaskId().toString()));
}
}
Aggregations