@Override public void pull(final String image, final RegistryAuth registryAuth) throws DockerException, InterruptedException { pull(image, registryAuth, new LoggingPullHandler(image)); }
@Override public void pull(final String image, final ProgressHandler handler) throws DockerException, InterruptedException { pull(image, registryAuthSupplier.authFor(image), handler); }
@Override public void pull(final String image) throws DockerException, InterruptedException { pull(image, new LoggingPullHandler(image)); }
@Override public void pull(final String image, final RegistryAuth registryAuth) throws DockerException, InterruptedException { pull(image, registryAuth, new LoggingPullHandler(image)); }
@Override public void pull(final String image, final ProgressHandler handler) throws DockerException, InterruptedException { pull(image, registryAuthSupplier.authFor(image), handler); }
@Override public void pull(final String image) throws DockerException, InterruptedException { pull(image, new LoggingPullHandler(image)); }
public void pullImage(String name) throws Exception { log.info("Pulling image " + name); this.client.pull(name, (message) -> { if (message.progressDetail() != null) { Long current = message.progressDetail().current(); Long total = message.progressDetail().total(); log.info("Pulling image " + name + " " + current + " / " + total); } else { log.info(message); } }); }
/** * Pull the given virtual resource. * * @param virtualResource the virtual resource * @param image the image */ void pullImage(VirtualResource virtualResource, String image) { RetryPolicy retryPolicy = new RetryPolicy() .retryOn(Throwable.class) .withDelay(virtualResource.delay(), virtualResource.unit()) .withMaxRetries(virtualResource.maxRetries()); Failsafe.with(retryPolicy) .onRetry(throwable -> LoggingUtil.INSTANCE.warn( "Retrying pull request of image '{}'", image, throwable)) .onFailure(throwable -> LoggingUtil.INSTANCE.error( "Image image '{}' could not be pulled: ", image, throwable)) .run(() -> client.pull(image, new AnsiProgressHandler())); }
@Override public Statement apply(Statement statement, Description description) { try { DefaultDockerClient client = DefaultDockerClient.fromEnv() .connectTimeoutMillis(5000L) .readTimeoutMillis(20000L) .registryAuthSupplier(new FixedRegistryAuthSupplier()) .build(); client.ping(); client.pull(IMAGE); client.close(); } catch (Throwable t) { Assume.assumeNoException(t); } return wrappedRule.apply(statement, description); }