Search in sources :

Example 6 with HubIntegrationException

use of com.blackducksoftware.integration.hub.exception.HubIntegrationException in project hub-docker-inspector by blackducksoftware.

the class Output method uploadBdioFiles.

private String uploadBdioFiles(final Config config) throws IntegrationException {
    String pathToDirContainingBdio = null;
    pathToDirContainingBdio = programPaths.getHubDockerOutputPath();
    logger.debug(String.format("Uploading BDIO files from %s", pathToDirContainingBdio));
    String bdioFilename = null;
    final List<File> bdioFiles = findBdioFiles(pathToDirContainingBdio);
    if (bdioFiles.size() == 0) {
        logger.warn("No BDIO Files generated");
    } else if (bdioFiles.size() > 1) {
        throw new HubIntegrationException(String.format("Found %d BDIO files in %s", bdioFiles.size(), pathToDirContainingBdio));
    } else {
        bdioFilename = bdioFiles.get(0).getName();
        logger.info(String.format("Uploading BDIO to Hub: %d files; first file: %s", bdioFiles.size(), bdioFiles.get(0).getAbsolutePath()));
        uploadBdioFiles(bdioFiles);
    }
    return bdioFilename;
}
Also used : ResultFile(com.blackducksoftware.integration.hub.imageinspector.result.ResultFile) File(java.io.File) HubIntegrationException(com.blackducksoftware.integration.hub.exception.HubIntegrationException)

Aggregations

HubIntegrationException (com.blackducksoftware.integration.hub.exception.HubIntegrationException)6 DockerClient (com.github.dockerjava.api.DockerClient)3 IntegrationException (com.blackducksoftware.integration.exception.IntegrationException)2 File (java.io.File)2 ImageNameResolver (com.blackducksoftware.integration.hub.imageinspector.name.ImageNameResolver)1 ResultFile (com.blackducksoftware.integration.hub.imageinspector.result.ResultFile)1 NotificationEvent (com.blackducksoftware.integration.hub.notification.NotificationEvent)1 RestConnection (com.blackducksoftware.integration.hub.rest.RestConnection)1 InspectImageCmd (com.github.dockerjava.api.command.InspectImageCmd)1 InspectImageResponse (com.github.dockerjava.api.command.InspectImageResponse)1 PullImageCmd (com.github.dockerjava.api.command.PullImageCmd)1 NotFoundException (com.github.dockerjava.api.exception.NotFoundException)1 Image (com.github.dockerjava.api.model.Image)1 Info (com.github.dockerjava.api.model.Info)1 PullImageResultCallback (com.github.dockerjava.core.command.PullImageResultCallback)1 LinkedList (java.util.LinkedList)1