1818
1919import com .google .cloud .tools .jib .Timer ;
2020import com .google .cloud .tools .jib .async .AsyncStep ;
21- import com .google .cloud .tools .jib .async .NonBlockingSteps ;
2221import com .google .cloud .tools .jib .builder .BuildConfiguration ;
2322import com .google .cloud .tools .jib .cache .Cache ;
2423import com .google .cloud .tools .jib .cache .CacheReader ;
2524import com .google .cloud .tools .jib .cache .CacheWriter ;
2625import com .google .cloud .tools .jib .cache .CachedLayer ;
26+ import com .google .cloud .tools .jib .http .Authorization ;
2727import com .google .cloud .tools .jib .image .DescriptorDigest ;
2828import com .google .cloud .tools .jib .image .LayerPropertyNotFoundException ;
2929import com .google .cloud .tools .jib .registry .RegistryClient ;
3030import com .google .cloud .tools .jib .registry .RegistryException ;
3131import com .google .common .io .CountingOutputStream ;
32- import com .google .common .util .concurrent .Futures ;
3332import com .google .common .util .concurrent .ListenableFuture ;
3433import com .google .common .util .concurrent .ListeningExecutorService ;
3534import java .io .IOException ;
3635import java .util .concurrent .Callable ;
37- import java . util . concurrent . ExecutionException ;
36+ import javax . annotation . Nullable ;
3837
3938/** Pulls and caches a single base image layer. */
4039class PullAndCacheBaseImageLayerStep implements AsyncStep <CachedLayer >, Callable <CachedLayer > {
@@ -44,7 +43,7 @@ class PullAndCacheBaseImageLayerStep implements AsyncStep<CachedLayer>, Callable
4443 private final BuildConfiguration buildConfiguration ;
4544 private final Cache cache ;
4645 private final DescriptorDigest layerDigest ;
47- private final AuthenticatePullStep authenticatePullStep ;
46+ private final @ Nullable Authorization pullAuthorization ;
4847
4948 private final ListenableFuture <CachedLayer > listenableFuture ;
5049
@@ -53,15 +52,13 @@ class PullAndCacheBaseImageLayerStep implements AsyncStep<CachedLayer>, Callable
5352 BuildConfiguration buildConfiguration ,
5453 Cache cache ,
5554 DescriptorDigest layerDigest ,
56- AuthenticatePullStep authenticatePullStep ) {
55+ @ Nullable Authorization pullAuthorization ) {
5756 this .buildConfiguration = buildConfiguration ;
5857 this .cache = cache ;
5958 this .layerDigest = layerDigest ;
60- this .authenticatePullStep = authenticatePullStep ;
59+ this .pullAuthorization = pullAuthorization ;
6160
62- listenableFuture =
63- Futures .whenAllSucceed (authenticatePullStep .getFuture ())
64- .call (this , listeningExecutorService );
61+ listenableFuture = listeningExecutorService .submit (this );
6562 }
6663
6764 @ Override
@@ -70,13 +67,12 @@ public ListenableFuture<CachedLayer> getFuture() {
7067 }
7168
7269 @ Override
73- public CachedLayer call ()
74- throws IOException , RegistryException , LayerPropertyNotFoundException , ExecutionException {
70+ public CachedLayer call () throws IOException , RegistryException , LayerPropertyNotFoundException {
7571 try (Timer ignored =
7672 new Timer (buildConfiguration .getBuildLogger (), String .format (DESCRIPTION , layerDigest ))) {
7773 RegistryClient registryClient =
7874 new RegistryClient (
79- NonBlockingSteps . get ( authenticatePullStep ) ,
75+ pullAuthorization ,
8076 buildConfiguration .getBaseImageRegistry (),
8177 buildConfiguration .getBaseImageRepository ());
8278
0 commit comments