mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-20 05:10:11 +01:00
ci,marge_queue: handle GitLab auth exception
Signed-off-by: Sergi Blanch Torne <sergi.blanch.torne@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37395>
This commit is contained in:
parent
c2763a1992
commit
1d38792d62
1 changed files with 11 additions and 1 deletions
|
|
@ -15,10 +15,12 @@ import sys
|
|||
from dataclasses import dataclass, field
|
||||
from datetime import datetime, timedelta, timezone
|
||||
from dateutil import parser
|
||||
from traceback import print_exc
|
||||
from typing import Optional
|
||||
|
||||
import gitlab
|
||||
from gitlab.base import RESTObjectList
|
||||
from gitlab.exceptions import GitlabAuthenticationError
|
||||
from gitlab.v4.objects import Project, ProjectMergeRequest
|
||||
from gitlab_common import read_token, pretty_duration
|
||||
|
||||
|
|
@ -201,7 +203,15 @@ def main():
|
|||
f"{mr:<{MR_ID_PADDING}} {title}"
|
||||
)
|
||||
while True:
|
||||
try:
|
||||
n_mrs = get_merge_queue(project).n_merge_requests_enqueued
|
||||
except GitlabAuthenticationError as autherror:
|
||||
if autherror.response_code == 401: # 401 Unauthorized
|
||||
print(f"Alert! Tool action requires authentication. Use the --token argument")
|
||||
else:
|
||||
print(f"Alert! Something went wrong: {autherror.responce_body}")
|
||||
print_exc()
|
||||
sys.exit(-1)
|
||||
|
||||
print(f"Job waiting: {n_mrs}")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue