|
31 | 31 | import java.util.HashMap; |
32 | 32 | import java.util.List; |
33 | 33 | import java.util.Map; |
| 34 | +import java.util.Objects; |
34 | 35 | import java.util.function.Supplier; |
35 | 36 | import land.oras.auth.AuthProvider; |
36 | 37 | import land.oras.auth.AuthStoreAuthenticationProvider; |
@@ -392,20 +393,25 @@ public Manifest pushArtifact( |
392 | 393 | manifest = manifest.withConfig(config); |
393 | 394 | } |
394 | 395 |
|
395 | | - // Push layers |
396 | | - List<Layer> layers = pushLayers(containerRef, false, paths); |
397 | | - |
398 | 396 | // Push the config like any other blob |
399 | 397 | Config pushedConfig = pushConfig(containerRef, config != null ? config : Config.empty()); |
| 398 | + String resolvedRegistry = pushedConfig.getRegistry(); |
| 399 | + Objects.requireNonNull(resolvedRegistry, "Pushed config must have a registry resolved"); |
| 400 | + |
| 401 | + // Build the resolved ref |
| 402 | + ContainerRef resolvedRef = containerRef.forRegistry(resolvedRegistry); |
| 403 | + |
| 404 | + // Push layers |
| 405 | + List<Layer> layers = pushLayers(resolvedRef, false, paths); |
400 | 406 |
|
401 | 407 | // Add layer and config |
402 | 408 | manifest = manifest.withLayers(layers).withConfig(pushedConfig); |
403 | 409 |
|
404 | 410 | // Push the manifest |
405 | | - manifest = pushManifest(containerRef, manifest); |
| 411 | + manifest = pushManifest(resolvedRef, manifest); |
406 | 412 | LOG.debug( |
407 | 413 | "Manifest pushed to: {}", |
408 | | - containerRef.withDigest(manifest.getDescriptor().getDigest())); |
| 414 | + resolvedRef.withDigest(manifest.getDescriptor().getDigest())); |
409 | 415 | return manifest; |
410 | 416 | } |
411 | 417 |
|
@@ -575,7 +581,7 @@ public Layer pushBlob(ContainerRef containerRef, byte[] data) { |
575 | 581 | } |
576 | 582 |
|
577 | 583 | handleError(response); |
578 | | - return Layer.fromData(containerRef, data); |
| 584 | + return Layer.fromData(ref, data); |
579 | 585 | } |
580 | 586 |
|
581 | 587 | /** |
|
0 commit comments