Skip to content

Commit aec1d8f

Browse files
committed
TUN-7392: Ignore duplicate artifact uploads for github release
1 parent c7f343a commit aec1d8f

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

github_release.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,16 @@ def parse_args():
166166

167167
def upload_asset(release, filepath, filename, release_version, kv_account_id, namespace_id, kv_api_token):
168168
logging.info("Uploading asset: %s", filename)
169-
release.upload_asset(filepath, name=filename)
169+
assets = release.get_assets()
170+
uploaded = False
171+
for asset in assets:
172+
if asset.name == filename:
173+
logging.info("asset already uploaded, skipping upload")
174+
uploaded = True
175+
break
176+
177+
if not uploaded:
178+
release.upload_asset(filepath, name=filename)
170179

171180
# check and extract if the file is a tar and gzipped file (as is the case with the macos builds)
172181
binary_path = filepath
@@ -182,6 +191,7 @@ def upload_asset(release, filepath, filename, release_version, kv_account_id, na
182191
binary_path = os.path.join(os.getcwd(), 'cfd', 'cloudflared')
183192

184193
# send the sha256 (the checksum) to workers kv
194+
logging.info("Uploading sha256 checksum for: %s", filename)
185195
pkg_hash = get_sha256(binary_path)
186196
send_hash(pkg_hash, filename, release_version, kv_account_id, namespace_id, kv_api_token)
187197

0 commit comments

Comments
 (0)