From aec1d8f6535ad30dcaf5c50f774a2760d7524f89 Mon Sep 17 00:00:00 2001 From: Devin Carr Date: Tue, 25 Apr 2023 13:31:28 -0700 Subject: [PATCH] TUN-7392: Ignore duplicate artifact uploads for github release --- github_release.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/github_release.py b/github_release.py index e59a0cbf..10657e48 100755 --- a/github_release.py +++ b/github_release.py @@ -166,7 +166,16 @@ def parse_args(): def upload_asset(release, filepath, filename, release_version, kv_account_id, namespace_id, kv_api_token): logging.info("Uploading asset: %s", filename) - release.upload_asset(filepath, name=filename) + assets = release.get_assets() + uploaded = False + for asset in assets: + if asset.name == filename: + logging.info("asset already uploaded, skipping upload") + uploaded = True + break + + if not uploaded: + release.upload_asset(filepath, name=filename) # check and extract if the file is a tar and gzipped file (as is the case with the macos builds) binary_path = filepath @@ -182,6 +191,7 @@ def upload_asset(release, filepath, filename, release_version, kv_account_id, na binary_path = os.path.join(os.getcwd(), 'cfd', 'cloudflared') # send the sha256 (the checksum) to workers kv + logging.info("Uploading sha256 checksum for: %s", filename) pkg_hash = get_sha256(binary_path) send_hash(pkg_hash, filename, release_version, kv_account_id, namespace_id, kv_api_token)