Skip to content

Commit

Permalink
Cleanup OciPushTask
Browse files Browse the repository at this point in the history
  • Loading branch information
SgtSilvio committed Jul 10, 2024
1 parent 1e2a7f4 commit 9258ee8
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/main/kotlin/io/github/sgtsilvio/gradle/oci/OciPushTask.kt
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,15 @@ abstract class OciPushTask @Inject constructor(
}
}
}
val config = image.config
val config = image.config.data
val configDigest = config.digest
val sourceBlob = blobs[configDigest]
blobFutures += if (sourceBlob == null) {
val bytes = config.data.bytes
val bytes = config.bytes
val sender: NettyOutbound.() -> Publisher<Void> = { sendByteArray(bytes.toMono()) }
val future = CompletableFuture<Unit>()
blobs[configDigest] = Blob(configDigest, config.size, sender, imageName, imageName, future)
blobs[configDigest] =
Blob(configDigest, bytes.size.toLong(), sender, imageName, imageName, future)
future
} else if (sourceBlob.imageName == imageName) {
sourceBlob.future
Expand All @@ -158,19 +159,16 @@ abstract class OciPushTask @Inject constructor(
}
future
}
val manifest = image.manifest
val manifestDigest = manifest.digest
val manifestMediaType = manifest.mediaType
val manifestBytes = manifest.data.bytes
val manifest = image.manifest.data
val manifestFuture = CompletableFuture<Unit>()
manifestFutures += manifestFuture
CompletableFuture.allOf(*blobFutures.toTypedArray()).thenRun {
context.pushService.get().pushManifest(
context,
imageName,
manifestDigest.toString(),
manifestMediaType,
manifestBytes,
manifest.digest.toString(),
manifest.mediaType,
manifest.bytes,
manifestFuture,
)
}
Expand Down

0 comments on commit 9258ee8

Please sign in to comment.