ci: trigger_cerbero_pipeline: improve error in case of insufficient permissions

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6608>
This commit is contained in:
Tim-Philipp Müller 2024-04-11 14:13:24 +01:00 committed by GStreamer Marge Bot
parent d002acdd0c
commit 3f90dca733

View file

@ -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: