mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-25 19:21:06 +00:00
ci: Wait for cerbero pipeline to finish
So we are sure the pipeline is marked as failed if the cerbero sub pipeline fails See https://gitlab.com/gitlab-org/gitlab/-/issues/341737 for details Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/946>
This commit is contained in:
parent
ef05946837
commit
37d7e9a22d
3 changed files with 68 additions and 6 deletions
|
@ -891,15 +891,17 @@ cerbero trigger:
|
||||||
stage: build
|
stage: build
|
||||||
image: $FEDORA_IMAGE
|
image: $FEDORA_IMAGE
|
||||||
script:
|
script:
|
||||||
- curl --request POST
|
- python3 -m pip install --user python-gitlab
|
||||||
--form token=${CI_JOB_TOKEN}
|
- ci/gitlab/trigger_cerbero_pipeline.py
|
||||||
--form ref=main
|
|
||||||
--form "variables[CI_GSTREAMER_URL]=$CI_PROJECT_URL"
|
variables:
|
||||||
--form "variables[CI_GSTREAMER_REF_NAME]=$CI_COMMIT_REF_NAME"
|
# Use GST_UPSTREAM_BRANCH
|
||||||
https://gitlab.freedesktop.org/api/v4/projects/1340/trigger/pipeline
|
UPSTREAM_BRANCH: 'main'
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
- changes:
|
- changes:
|
||||||
- .gitlab-ci.yml
|
- .gitlab-ci.yml
|
||||||
|
- ci/gitlab/tigger_cerbero_pipeline.py
|
||||||
- subprojects/gst-devtools/**/*
|
- subprojects/gst-devtools/**/*
|
||||||
- subprojects/gst-editing-services/**/*
|
- subprojects/gst-editing-services/**/*
|
||||||
- subprojects/gst-libav/**/*
|
- subprojects/gst-libav/**/*
|
||||||
|
|
|
@ -3,3 +3,4 @@ subprojects/gstreamer-rs/
|
||||||
subprojects/gstreamer-rs-sys/
|
subprojects/gstreamer-rs-sys/
|
||||||
subprojects/gst-plugins-rs/
|
subprojects/gst-plugins-rs/
|
||||||
subprojects/gstreamer-sharp/
|
subprojects/gstreamer-sharp/
|
||||||
|
subprojects/gst-integration-testsuites/medias
|
||||||
|
|
59
ci/gitlab/trigger_cerbero_pipeline.py
Executable file
59
ci/gitlab/trigger_cerbero_pipeline.py
Executable file
|
@ -0,0 +1,59 @@
|
||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
import time
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import gitlab
|
||||||
|
|
||||||
|
CERBERO_ID = 1340
|
||||||
|
|
||||||
|
class Status:
|
||||||
|
FAILED = 'failed'
|
||||||
|
MANUAL = 'manual'
|
||||||
|
CANCELED = 'canceled'
|
||||||
|
SUCCESS = 'success'
|
||||||
|
SKIPPED = 'skipped'
|
||||||
|
CREATED = 'created'
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def is_finished(cls, state):
|
||||||
|
return state in [
|
||||||
|
cls.FAILED,
|
||||||
|
cls.MANUAL,
|
||||||
|
cls.CANCELED,
|
||||||
|
cls.SUCCESS,
|
||||||
|
cls.SKIPPED,
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def fprint(msg):
|
||||||
|
print(msg, end="")
|
||||||
|
sys.stdout.flush()
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
gl = gitlab.Gitlab(
|
||||||
|
"https://gitlab.freedesktop.org/",
|
||||||
|
private_token=os.environ.get('GITLAB_API_TOKEN'),
|
||||||
|
job_token=os.environ.get('CI_JOB_TOKEN')
|
||||||
|
)
|
||||||
|
|
||||||
|
cerbero = gl.projects.get(CERBERO_ID)
|
||||||
|
pipe = cerbero.trigger_pipeline(
|
||||||
|
token=os.environ['CI_JOB_TOKEN'],
|
||||||
|
ref=os.environ["UPSTREAM_BRANCH"],
|
||||||
|
variables={
|
||||||
|
"CI_GSTREAMER_URL": os.environ["CI_PROJECT_URL"],
|
||||||
|
"CI_GSTREAMER_REF_NAME": os.environ["CI_COMMIT_REF_NAME"],
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
fprint(f'Cerbero pipeline running at {pipe.web_url} ')
|
||||||
|
while True:
|
||||||
|
time.sleep(15)
|
||||||
|
pipe.refresh()
|
||||||
|
if Status.is_finished(pipe.status):
|
||||||
|
fprint(f": {pipe.status}\n")
|
||||||
|
sys.exit(0 if pipe.status == Status.SUCCESS else 1)
|
||||||
|
else:
|
||||||
|
fprint(".")
|
||||||
|
|
Loading…
Reference in a new issue