Package de.taimos.pipeline.aws.utils
Class S3Utils
java.lang.Object
de.taimos.pipeline.aws.utils.S3Utils
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleandoesObjectExist(software.amazon.awssdk.services.s3.S3Client s3Client, String bucket, String key) v2 dropped v1's doesObjectExist convenience method, so this restores it.static <T> TjoinTransfer(CompletableFuture<T> future) Waits for a transfer, unwrapping the failure and staying interruptible.
-
Method Details
-
joinTransfer
Waits for a transfer, unwrapping the failure and staying interruptible. Two reasons not to call join() directly. It wraps whatever went wrong in a CompletionException, where v1's waitForCompletion threw the AmazonS3Exception itself, so a Jenkinsfile could catch the S3 error and the log showed the service message rather than a wrapper. And join() is not interruptible: it records the interrupt and keeps waiting, so aborting a build would leave the transfer running - on an agent, against a workspace Jenkins believes is free. get() throws InterruptedException, which the callers already declare.- Throws:
InterruptedException
-
doesObjectExist
public static boolean doesObjectExist(software.amazon.awssdk.services.s3.S3Client s3Client, String bucket, String key) v2 dropped v1's doesObjectExist convenience method, so this restores it. v1 implemented it as getObjectMetadata plus "treat any 404 as absent", which means a missing bucket answered false rather than throwing, and a 403 propagated. Catching NoSuchKeyException alone would not reproduce that - a missing bucket raises NoSuchBucketException instead - so the status code is what is matched on, exactly as v1 did.
-