From fa32770e9661d0383ff6e18344e32ade6ccb22bf Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 20 Oct 2020 09:25:51 +0200 Subject: [PATCH] Add --ignoreErrors argument to be able to bypass some errors --- tools/release/download_buildkite_artifacts.py | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/tools/release/download_buildkite_artifacts.py b/tools/release/download_buildkite_artifacts.py index 4439c2fb8c..067a1a4dfe 100755 --- a/tools/release/download_buildkite_artifacts.py +++ b/tools/release/download_buildkite_artifacts.py @@ -45,6 +45,10 @@ parser.add_argument('-e', '--expecting', type=int, help='the expected number of artifacts. If omitted, no check will be done.') +parser.add_argument('-i', + '--ignoreErrors', + help='Ignore errors that can be ignored. Build state and number of artifacts.', + action="store_true") parser.add_argument('-d', '--directory', default="", @@ -91,9 +95,14 @@ print(" git commit : \"%s\"" % data0.get('commit')) print(" git commit message : \"%s\"" % data0.get('message')) print(" build state : %s" % data0.get('state')) +error = False + if data0.get('state') != 'passed': print("❌ Error, the build is in state '%s', and not 'passed'" % data0.get('state')) - exit(1) + if args.ignoreErrors: + error = True + else: + exit(1) ### Fetch artifacts list @@ -110,8 +119,11 @@ data = json.loads(r.content.decode()) print(" %d artifact(s) found." % len(data)) if args.expecting is not None and args.expecting != len(data): - print("Error, expecting %d artifacts and found %d." % (args.expecting, len(data))) - exit(1) + print("❌ Error, expecting %d artifacts and found %d." % (args.expecting, len(data))) + if args.ignoreErrors: + error = True + else: + exit(1) if args.verbose: print("Json data:") @@ -128,8 +140,6 @@ else: if not args.simulate: os.mkdir(targetDir) -error = False - for elt in data: if args.verbose: print() @@ -157,7 +167,7 @@ for elt in data: print("❌ Checksum mismatch: expecting %s and get %s" % (elt.get("sha1sum"), hash)) if error: - print("❌ Error(s) occurred, check the log") + print("❌ Error(s) occurred, please check the log") exit(1) else: print("Done!")