From 275c540984d885f6422f13cf2ec946ce86c48cf4 Mon Sep 17 00:00:00 2001
From: Xavier Claessens <xavier.claessens@collabora.com>
Date: Mon, 4 Oct 2021 20:24:58 -0400
Subject: [PATCH] ci: Update fedora image for cerbero trigger

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/931>
---
 .gitlab-ci.yml                        | 11 ++++-------
 ci/docker/fedora/prepare.sh           |  5 +++--
 ci/gitlab/trigger_cerbero_pipeline.py |  5 +++--
 3 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index d655aeae84..305c9baf88 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -24,7 +24,7 @@ variables:
   # If you are hacking on them or need a them to rebuild, its enough
   # to change any part of the string of the image you want.
   ###
-  FEDORA_TAG:  '2021-10-04.0'
+  FEDORA_TAG:  '2021-10-05.0'
   INDENT_TAG: '2021-10-04.0'
   WINDOWS_TAG: "2021-10-04.1"
 
@@ -760,17 +760,14 @@ build documentation:
 # https://gitlab.com/gitlab-org/gitlab/-/issues/341737
 cerbero trigger:
   stage: build
-  image: $FEDORA_IMAGE
+  extends:
+    - '.fedora image'
+    - '.fdo.suffixed-image@fedora'
   needs:
     - "fedora amd64 docker"
   script:
-    - python3 -m pip install --user python-gitlab
     - ci/gitlab/trigger_cerbero_pipeline.py
 
-  variables:
-    # Use GST_UPSTREAM_BRANCH
-    UPSTREAM_BRANCH: 'main'
-
   rules:
     - changes:
       - .gitlab-ci.yml
diff --git a/ci/docker/fedora/prepare.sh b/ci/docker/fedora/prepare.sh
index f3092bf7d4..9ab1d986fc 100644
--- a/ci/docker/fedora/prepare.sh
+++ b/ci/docker/fedora/prepare.sh
@@ -202,7 +202,8 @@ dnf builddep -y gstreamer1 \
     python3-gstreamer1
 
 dnf remove -y meson
-pip3 install meson==0.59.1 hotdoc
+pip3 install meson==0.59.1 hotdoc python-gitlab
+
 
 # Remove gst-devel packages installed by builddep above
 dnf remove -y "gstreamer1*devel"
@@ -252,4 +253,4 @@ echo "Removing DNF cache"
 dnf clean all
 
 rm -R /root/*
-rm -rf /var/cache/dnf /var/log/dnf*
\ No newline at end of file
+rm -rf /var/cache/dnf /var/log/dnf*
diff --git a/ci/gitlab/trigger_cerbero_pipeline.py b/ci/gitlab/trigger_cerbero_pipeline.py
index 5e89135da4..74a1f61739 100755
--- a/ci/gitlab/trigger_cerbero_pipeline.py
+++ b/ci/gitlab/trigger_cerbero_pipeline.py
@@ -7,6 +7,7 @@ import gitlab
 
 CERBERO_ID = 1340
 
+
 class Status:
     FAILED = 'failed'
     MANUAL = 'manual'
@@ -30,6 +31,7 @@ def fprint(msg):
     print(msg, end="")
     sys.stdout.flush()
 
+
 if __name__ == "__main__":
     gl = gitlab.Gitlab(
         "https://gitlab.freedesktop.org/",
@@ -40,7 +42,7 @@ if __name__ == "__main__":
     cerbero = gl.projects.get(CERBERO_ID)
     pipe = cerbero.trigger_pipeline(
         token=os.environ['CI_JOB_TOKEN'],
-        ref=os.environ["UPSTREAM_BRANCH"],
+        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"],
@@ -56,4 +58,3 @@ if __name__ == "__main__":
             sys.exit(0 if pipe.status == Status.SUCCESS else 1)
         else:
             fprint(".")
-