osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ci/+/38097?usp=email )
Change subject: …gerrit/comment_generate: make error more helpful ......................................................................
…gerrit/comment_generate: make error more helpful
The start of a stage may also not be found if the related -build job was not deployed. This was not obvious before, add a hint to the error message.
Change-Id: Iec5f4cde53b763bb6c814934abcc83e39518566f --- M scripts/jenkins-gerrit/comment_generate.py 1 file changed, 12 insertions(+), 5 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ci refs/changes/97/38097/1
diff --git a/scripts/jenkins-gerrit/comment_generate.py b/scripts/jenkins-gerrit/comment_generate.py index e127c4c..a2aec0e 100755 --- a/scripts/jenkins-gerrit/comment_generate.py +++ b/scripts/jenkins-gerrit/comment_generate.py @@ -6,6 +6,7 @@ import json import re import urllib.request +import sys
jenkins_url = "https://jenkins.osmocom.org" re_start_build = re.compile("Starting building: gerrit-[a-zA-Z-_0-9]* #[0-9]*") @@ -94,11 +95,17 @@ if stage.startswith("comment_"): # Jobs that run this script, not relevant for summary continue - assert stage in ret, f"found result for stage {stage}, but" \ - " didn't find where it was started. The" \ - " re_start_build regex probably needs to be adjusted" \ - " to match the related gerrit-*-build job.\n\n" \ - f"ret: {ret}" + if stage not in ret: + print(f"URL: {url}") + print() + print(f"ERROR: found result for stage {stage}, but didn't" + " find where it was started. Possible reasons:") + print("* The re_stat_build regex needs to be adjusted" + " to match the related gerrit-*-build job") + print("* The gerrit-*-build job has not been deployed," + " and therefore could not be started by the" + " gerrit-* job.") + sys.exit(1) ret[stage]["passed"] = (match.group(2) == "SUCCESS")
return ret