mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-01 22:21:13 +00:00
585d719bd1
Now we will pick up the right gstreamer branch + namespace when building an image, and also the right (matching, if any) cerbero branch + namespace. This solves the bootstrapping issue when doing an image update that requires coordination between gstreamer and cerbero. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5043>
27 lines
921 B
Python
27 lines
921 B
Python
#!/usr/bin/python3
|
|
|
|
import os
|
|
import gitlab
|
|
|
|
|
|
server = 'https://gitlab.freedesktop.org'
|
|
gl = gitlab.Gitlab(server)
|
|
branch = os.environ.get('DEFAULT_BRANCH', 'main')
|
|
project = f'gstreamer/cerbero'
|
|
# We do not want to run on (often out of date) user upstream branch
|
|
if os.environ["CI_COMMIT_REF_NAME"] != os.environ['DEFAULT_BRANCH']:
|
|
try:
|
|
try_project = f'{os.environ["CI_PROJECT_NAMESPACE"]}/cerbero'
|
|
match_branch = os.environ["CI_COMMIT_REF_NAME"]
|
|
# Search for matching branches, return only if the branch name matches
|
|
# exactly
|
|
proj = gl.projects.get(try_project)
|
|
for b in proj.branches.list(search=match_branch, iterator=True):
|
|
if match_branch == b.name:
|
|
project = try_project
|
|
branch = b.name
|
|
break
|
|
except gitlab.exceptions.GitlabGetError:
|
|
pass
|
|
|
|
print(f'-b {branch} {server}/{project}', end='')
|