From 3f90dca733c54e33b90aa10dcc10d4bf10bc03fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Thu, 11 Apr 2024 14:13:24 +0100 Subject: [PATCH] ci: trigger_cerbero_pipeline: improve error in case of insufficient permissions Part-of: --- ci/gitlab/trigger_cerbero_pipeline.py | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/ci/gitlab/trigger_cerbero_pipeline.py b/ci/gitlab/trigger_cerbero_pipeline.py index 6390fa30ef..4a95f39e90 100755 --- a/ci/gitlab/trigger_cerbero_pipeline.py +++ b/ci/gitlab/trigger_cerbero_pipeline.py @@ -91,11 +91,26 @@ if __name__ == "__main__": variables['MESON_COMMIT'] = meson_commit del variables['CI_GSTREAMER_TRIGGERED'] - pipe = cerbero.trigger_pipeline( - token=os.environ['CI_JOB_TOKEN'], - ref=cerbero_branch, - variables=variables, - ) + try: + pipe = cerbero.trigger_pipeline( + token=os.environ['CI_JOB_TOKEN'], + ref=cerbero_branch, + variables=variables, + ) + except gitlab.exceptions.GitlabCreateError as e: + if e.response_code == 400: + exit(''' + + Could not start cerbero sub-pipeline due to insufficient permissions. + + This is not a problem and is expected if you are not a GStreamer + developer with merge permission in the cerbero project. + + When your Merge Request is assigned to Marge (our merge bot), it + will trigger the cerbero sub-pipeline with the correct permissions. + ''') + else: + exit(f'Could not create cerbero sub-pipeline. Error: {e}') fprint(f'Cerbero pipeline running at {pipe.web_url} ') while True: