diff --git a/taskcluster/ci/system-symbols-upload/kind.yml b/taskcluster/ci/system-symbols-upload/kind.yml index 7c0d8e3372db..e6df92f0e348 100644 --- a/taskcluster/ci/system-symbols-upload/kind.yml +++ b/taskcluster/ci/system-symbols-upload/kind.yml @@ -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 "} + mach: {artifact-reference: "python toolkit/crashreporter/tools/upload_symbols.py --ignore-missing"} sparse-profile: upload-symbols scopes: - secrets:get:project/releng/gecko/build/level-{level}/gecko-symbol-upload diff --git a/toolkit/crashreporter/tools/upload_symbols.py b/toolkit/crashreporter/tools/upload_symbols.py index 906acd39eda0..bf1d325204d6 100644 --- a/toolkit/crashreporter/tools/upload_symbols.py +++ b/toolkit/crashreporter/tools/upload_symbols.py @@ -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: