From 0d2829d955a9cf18f146cbda47a118c423af901f Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Wed, 22 Apr 2020 09:20:56 +0200 Subject: [PATCH] ci: add deploy jobs triggering gst-plugins-rs image updates Those jobs will trigger a rebuild of gst-plugins-rs when our images are updated. --- .gitlab-ci.yml | 54 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 751f7163a..ab0cdfe64 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -17,7 +17,7 @@ # Updating the nightly image should be done by simply running a scheduled ci # pipeline on the upstream repo with the $UPDATE_NIGHTLY variable defined. -.templates_sha: &templates_sha acda94e139030dc2caa058118956225e55bbec5f +.templates_sha: &templates_sha 1f82c62c196cd53d168b74e85b0a19ea48c1e2b9 include: - project: 'freedesktop/ci-templates' @@ -34,6 +34,7 @@ stages: - "lint" - "test" - "extras" + - "deploy" .debian:10: variables: @@ -117,6 +118,57 @@ update-nightly: - .dist-debian-container - .debian:10-nightly +# GST_PLUGINS_RS_TOKEN is a variable of type 'Var' defined in gstreamer-rs CI +# settings and containing a gst-plugins-rs pipeline trigger token +.plugins-update: + stage: deploy + script: + - | + # FDO_DISTRIBUTION_IMAGE still has indirections + - echo $FDO_DISTRIBUTION_IMAGE + - DISTRO_IMAGE=$(eval echo ${FDO_DISTRIBUTION_IMAGE}) + - echo $DISTRO_IMAGE + # retrieve the infos from the registry + - JSON_IMAGE=$(skopeo inspect docker://$DISTRO_IMAGE) + - IMAGE_PIPELINE_ID=$(echo $JSON_IMAGE | jq -r '.Labels["fdo.pipeline_id"]') + - echo $IMAGE_PIPELINE_ID + - echo $CI_PIPELINE_ID + - | + if [[ x"$IMAGE_PIPELINE_ID" == x"$CI_PIPELINE_ID" ]]; then + echo "Image has been updated, notify gst-plugins-rs" + curl -X POST -F "token=$GST_PLUGINS_RS_TOKEN" -F "ref=fdo-template" -F "variables[UPDATE_IMG]=$UPDATE_IMG" https://gitlab.freedesktop.org/api/v4/projects/1400/trigger/pipeline + else + echo "Image has not been updated, ignore" + fi + rules: + - if: '$CI_COMMIT_REF_NAME == "master" && $CI_PROJECT_PATH == "gstreamer/gstreamer-rs"' + +# Those jobs need to use another image as ours doesn't have 'skopeo' +# and it's not easily installable in Debian stable for now. +plugins-update-stable: + extends: + - .plugins-update + - .img-stable + image: registry.freedesktop.org/freedesktop/ci-templates/buildah:2020-03-04 + variables: + UPDATE_IMG: "stable" + +plugins-update-1-40: + extends: + - .plugins-update + - .img-1-40 + image: registry.freedesktop.org/freedesktop/ci-templates/buildah:2020-03-04 + variables: + UPDATE_IMG: "1-40" + +plugins-update-nightly: + extends: + - .plugins-update + - .img-nightly + image: registry.freedesktop.org/freedesktop/ci-templates/buildah:2020-03-04 + variables: + UPDATE_IMG: "nightly" + .cargo test: stage: "test" script: