TUN-7392: Ignore release checksum upload if asset already uploaded
This commit is contained in:
parent
76391434c2
commit
50a0c44cee
|
@ -170,11 +170,13 @@ def upload_asset(release, filepath, filename, release_version, kv_account_id, na
|
||||||
uploaded = False
|
uploaded = False
|
||||||
for asset in assets:
|
for asset in assets:
|
||||||
if asset.name == filename:
|
if asset.name == filename:
|
||||||
logging.info("asset already uploaded, skipping upload")
|
|
||||||
uploaded = True
|
uploaded = True
|
||||||
break
|
break
|
||||||
|
|
||||||
if not uploaded:
|
if uploaded:
|
||||||
|
logging.info("asset already uploaded, skipping upload")
|
||||||
|
return
|
||||||
|
|
||||||
release.upload_asset(filepath, name=filename)
|
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)
|
# check and extract if the file is a tar and gzipped file (as is the case with the macos builds)
|
||||||
|
@ -195,6 +197,7 @@ def upload_asset(release, filepath, filename, release_version, kv_account_id, na
|
||||||
pkg_hash = get_sha256(binary_path)
|
pkg_hash = get_sha256(binary_path)
|
||||||
send_hash(pkg_hash, filename, release_version, kv_account_id, namespace_id, kv_api_token)
|
send_hash(pkg_hash, filename, release_version, kv_account_id, namespace_id, kv_api_token)
|
||||||
|
|
||||||
|
def move_asset(filepath, filename):
|
||||||
# create the artifacts directory if it doesn't exist
|
# create the artifacts directory if it doesn't exist
|
||||||
artifact_path = os.path.join(os.getcwd(), 'artifacts')
|
artifact_path = os.path.join(os.getcwd(), 'artifacts')
|
||||||
if not os.path.isdir(artifact_path):
|
if not os.path.isdir(artifact_path):
|
||||||
|
@ -225,6 +228,7 @@ def main():
|
||||||
binary_path = os.path.join(args.path, filename)
|
binary_path = os.path.join(args.path, filename)
|
||||||
upload_asset(release, binary_path, filename, args.release_version, args.kv_account_id, args.namespace_id,
|
upload_asset(release, binary_path, filename, args.release_version, args.kv_account_id, args.namespace_id,
|
||||||
args.kv_api_token)
|
args.kv_api_token)
|
||||||
|
move_asset(binary_path, filename)
|
||||||
else:
|
else:
|
||||||
upload_asset(release, args.path, args.name, args.release_version, args.kv_account_id, args.namespace_id,
|
upload_asset(release, args.path, args.name, args.release_version, args.kv_account_id, args.namespace_id,
|
||||||
args.kv_api_token)
|
args.kv_api_token)
|
||||||
|
|
Loading…
Reference in New Issue