Add use existing branch confirmation and progress for file download (#6294)
* Add `use existing branch for release` confirmation. Otherwise, this message might go unnoticed and we might build the wrong binaries * Display the progress of downloaded artifacts so we can be sure the process is working
This commit is contained in:
committed by
GitHub
parent
491a6ef172
commit
ad2263f464
@@ -142,9 +142,14 @@ if not args.simulate:
|
||||
# open file to write in binary mode
|
||||
with open(target, "wb") as file:
|
||||
# get request
|
||||
response = requests.get(url, headers=headers)
|
||||
# write to file
|
||||
file.write(response.content)
|
||||
with requests.get(url, headers=headers, stream=True) as response:
|
||||
total = int(response.headers.get('Content-Length', 0))
|
||||
totalStr = "{0:.2f}".format(total / 1024 / 1024)
|
||||
for chunk in response.iter_content(chunk_size=65536):
|
||||
if chunk: # filter out keep-alive new chunks
|
||||
file.write(chunk)
|
||||
current = "{0:.2f}".format(file.tell() / 1024 / 1024)
|
||||
print(f"Downloaded {current}/{totalStr} MB", end="\r")
|
||||
print("Verifying file size...")
|
||||
# get the file size
|
||||
size = os.path.getsize(target)
|
||||
|
||||
@@ -131,7 +131,15 @@ git flow release start "${version}"
|
||||
# Note: in case the release is already started and the script is started again, checkout the release branch again.
|
||||
ret=$?
|
||||
if [[ $ret -ne 0 ]]; then
|
||||
printf "Mmh, it seems that the release is already started. Checking out the release branch...\n"
|
||||
printf "Mmh, it seems that the release is already started. I'm displaying the changes now:\n"
|
||||
git diff --stat "release/${version}" origin/main
|
||||
printf "Do you want to continue the release using its contents?\n\n"
|
||||
read -r -p "Continue (yes/no) default to yes? " doContinue
|
||||
doContinue=${doContinue:-yes}
|
||||
if [ "${doContinue}" == "no" ]; then
|
||||
printf "OK, exiting, you can start the release again with the command 'git flow release start %s'\n" "${version}"
|
||||
exit 1
|
||||
fi
|
||||
git checkout "release/${version}"
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user