Bug 1603988 - Part 1: Avoid to fail system-symbols-mac-upload-symbols when no symbols to upload r=marco,gsvelto

Currently, when task system-symbols-mac doesn't produce artifacts because of no data, then the task system-symbols-mac-upload-symbols is failing too.
So this patch aims to not fail the task in such a case.

Differential Revision: https://phabricator.services.mozilla.com/D59848

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Calixte Denizet 2020-02-04 10:06:07 +00:00
Родитель 52e5cf9fdf
Коммит 99c6342b1a
2 изменённых файлов: 26 добавлений и 4 удалений

Просмотреть файл

@ -23,7 +23,7 @@ job-template:
SYMBOL_SECRET: "project/releng/gecko/build/level-{level}/gecko-symbol-upload"
run:
using: mach
mach: {artifact-reference: "python toolkit/crashreporter/tools/upload_symbols.py <build/public/build/target.crashreporter-symbols.zip>"}
mach: {artifact-reference: "python toolkit/crashreporter/tools/upload_symbols.py <build/public/build/target.crashreporter-symbols.zip> --ignore-missing"}
sparse-profile: upload-symbols
scopes:
- secrets:get:project/releng/gecko/build/level-{level}/gecko-symbol-upload

Просмотреть файл

@ -68,11 +68,33 @@ def main():
description='Upload symbols in ZIP using token from Taskcluster secrets service.')
parser.add_argument('zip',
help='Symbols zip file - URL or path to local file')
parser.add_argument('--ignore-missing',
help='No error on missing files',
action='store_true')
args = parser.parse_args()
if not args.zip.startswith('http') and not os.path.isfile(args.zip):
log.error('Error: zip file "{0}" does not exist!'.format(args.zip))
return 1
def check_file_exists(url):
for i, _ in enumerate(redo.retrier(attempts=MAX_RETRIES), start=1):
try:
resp = requests.head(url, allow_redirects=True)
return resp.status_code == requests.codes.ok
except requests.exceptions.RequestException as e:
log.error('Error: {0}'.format(e))
log.info('Retrying...')
return False
if args.zip.startswith('http'):
is_existing = check_file_exists(args.zip)
else:
is_existing = os.path.isfile(args.zip)
if not is_existing:
if args.ignore_missing:
log.info('Zip file "{0}" does not exist!'.format(args.zip))
return 0
else:
log.error('Error: zip file "{0}" does not exist!'.format(args.zip))
return 1
secret_name = os.environ.get('SYMBOL_SECRET')
if secret_name is not None: