From 516be493d967c7c2ae7740b39e4381fb828656fc Mon Sep 17 00:00:00 2001 From: Benjy Weinberger Date: Wed, 11 Nov 2020 12:42:57 -0800 Subject: [PATCH] Detect delete markers in our s3 cache of native_engine.so. (#11140) If an object was deleted, it may still have a non-current version. [ci skip-rust] [ci skip-build-wheels] --- build-support/bin/bootstrap_and_deploy_ci_pants_pex.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build-support/bin/bootstrap_and_deploy_ci_pants_pex.py b/build-support/bin/bootstrap_and_deploy_ci_pants_pex.py index 71095ba02ba..ca653e5a28c 100755 --- a/build-support/bin/bootstrap_and_deploy_ci_pants_pex.py +++ b/build-support/bin/bootstrap_and_deploy_ci_pants_pex.py @@ -124,7 +124,7 @@ def native_engine_so_in_s3_cache(*, aws_bucket: str, native_engine_so_aws_key: s if not ls_output: return False versions = json.loads(ls_output).get("Versions") - if versions is None: + if not versions: return False if len(versions) > 1: die( @@ -133,6 +133,10 @@ def native_engine_so_in_s3_cache(*, aws_bucket: str, native_engine_so_aws_key: s "in Slack so that we may investigate how this happened and delete the duplicate " "copy from S3." ) + if not versions[0]["IsLatest"]: + # If the single version is not the latest, it means there is a delete marker that + # supersedes it. + return False return True