mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-15 22:01:27 +00:00
ci: Fix project URL when triggering cerbero pipelines
When merge request pipelines are triggered on the gstreamer namespace, CI_PROJECT_URL will be gitlab.[...]/gstreamer/gstreamer but we need to use gitlab.[...]/$USER/gstreamer because that's where the source branch is located. This exhibits as cerbero pipelines failing because it can't find the specified branch: https://gitlab.freedesktop.org/gstreamer/cerbero/-/pipelines/639379 Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2764>
This commit is contained in:
parent
d0ed9fdab5
commit
095da4c521
1 changed files with 14 additions and 3 deletions
|
@ -8,7 +8,6 @@ import gitlab
|
|||
CERBERO_PROJECT = 'gstreamer/cerbero'
|
||||
|
||||
|
||||
|
||||
class Status:
|
||||
FAILED = 'failed'
|
||||
MANUAL = 'manual'
|
||||
|
@ -40,12 +39,24 @@ if __name__ == "__main__":
|
|||
job_token=os.environ.get('CI_JOB_TOKEN'))
|
||||
|
||||
cerbero = gl.projects.get(CERBERO_PROJECT)
|
||||
|
||||
# CI_PROJECT_URL is not necessarily the project where the branch we need to
|
||||
# build resides, for instance merge request pipelines can be run on
|
||||
# 'gstreamer' namespace. Fetch the branch name in the same way, just in
|
||||
# case it breaks in the future.
|
||||
if 'CI_MERGE_REQUEST_SOURCE_PROJECT_URL' in os.environ:
|
||||
project_url = os.environ['CI_MERGE_REQUEST_SOURCE_PROJECT_URL']
|
||||
project_branch = os.environ['CI_MERGE_REQUEST_SOURCE_BRANCH_NAME']
|
||||
else:
|
||||
project_url = os.environ['CI_PROJECT_URL']
|
||||
project_branch = os.environ['CI_COMMIT_REF_NAME']
|
||||
|
||||
pipe = cerbero.trigger_pipeline(
|
||||
token=os.environ['CI_JOB_TOKEN'],
|
||||
ref=os.environ["GST_UPSTREAM_BRANCH"],
|
||||
variables={
|
||||
"CI_GSTREAMER_URL": os.environ["CI_PROJECT_URL"],
|
||||
"CI_GSTREAMER_REF_NAME": os.environ["CI_COMMIT_REF_NAME"],
|
||||
"CI_GSTREAMER_URL": project_url,
|
||||
"CI_GSTREAMER_REF_NAME": project_branch,
|
||||
# This tells cerbero CI that this is a pipeline started via the
|
||||
# trigger API, which means it can use a deps cache instead of
|
||||
# building from scratch.
|
||||
|
|
Loading…
Reference in a new issue