still flailing - try a random name
This commit is contained in:
parent
478ca98b0e
commit
318160b328
3 changed files with 9 additions and 3 deletions
|
@ -41,6 +41,7 @@ build_script:
|
|||
- python zip_daemon.py
|
||||
- dir dist
|
||||
- pip install PyGithub uritemplate
|
||||
- pip install -U requests[security]
|
||||
- python release_on_tag.py
|
||||
|
||||
test: off
|
||||
|
|
1
build.sh
1
build.sh
|
@ -84,6 +84,7 @@ if [ "$FULL_BUILD" == "true" ]; then
|
|||
# it to reliably work and it also seemed difficult to configure. Not proud of
|
||||
# this, but it seemed better to write my own.
|
||||
pip install PyGithub uritemplate
|
||||
pip install -U requests[security]
|
||||
python release_on_tag.py
|
||||
deactivate
|
||||
fi
|
||||
|
|
|
@ -4,6 +4,7 @@ import json
|
|||
import logging
|
||||
import os
|
||||
import platform
|
||||
import random
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
|
@ -89,15 +90,18 @@ def upload_asset(release, asset_to_upload, token):
|
|||
while count < 10:
|
||||
uploader = uploaders[count % len(uploaders)]
|
||||
try:
|
||||
return _upload_asset_requests(release, asset_to_upload, token, uploader)
|
||||
return _upload_asset(release, asset_to_upload, token, uploader)
|
||||
except Exception:
|
||||
log.exception('Failed to upload')
|
||||
count += 1
|
||||
|
||||
|
||||
def _upload_asset_requests(release, asset_to_upload, token, uploader):
|
||||
def _upload_asset(release, asset_to_upload, token, uploader):
|
||||
basename = os.path.basename(asset_to_upload)
|
||||
upload_uri = uritemplate.expand(release.upload_url, {'name': basename})
|
||||
upload_uri = uritemplate.expand(
|
||||
release.upload_url,
|
||||
{'name': ''.join([random.choice('abcdef') for _ in range(10)])}
|
||||
)
|
||||
output = uploader(upload_uri, asset_to_upload, token)
|
||||
if 'errors' in output:
|
||||
raise Exception(output)
|
||||
|
|
Loading…
Reference in a new issue