gitlab CI: work around collapsed multiline commands in the rebuild check
authorPeter Hutterer <peter.hutterer@who-t.net>
Mon, 28 Oct 2019 23:39:39 +0000 (09:39 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Tue, 5 Nov 2019 01:00:16 +0000 (11:00 +1000)
Multiline commands are currently collapsed with no way of uncollapsing them
(https://gitlab.com/gitlab-org/gitlab-runner/issues/3392), so we never see the
skopeo invocations. Work around this by touching a file when scheduled and
using that to break up the conditions.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
.gitlab-ci.yml

index 45e0a12b472b199f81f43a93977ce4d83bba8752..750fbe86bc41896ac9a4ff4241fb39e53da87ad5 100644 (file)
@@ -139,17 +139,14 @@ variables:
     # get the full container image name (DISTRIB_VERSION still has indirections)
     - IMAGE=$(eval echo "$DISTRIB_FLAVOR/$DISTRIB_VERSION:$TAG")
 
-    - |
-      # force rebuild if schedule, reuse otherwise
-      if [[ $CI_PIPELINE_SOURCE != "schedule" ]] ;
-      then
-        # pull the latest upstream image if it exists
-        skopeo copy docker://$CI_REGISTRY/$UPSTREAM_REPO/$IMAGE \
-                    docker://$CI_REGISTRY_IMAGE/$IMAGE && exit 0 || true ;
-
-        # check if our image is already in the current registry
-        skopeo inspect docker://$CI_REGISTRY_IMAGE/$IMAGE > /dev/null && exit 0 || true ;
-      fi
+    # force rebuild if schedule, reuse otherwise
+    - if [[ $CI_PIPELINE_SOURCE == "schedule" ]] ; then touch .scheduled; fi
+    # pull the latest upstream image if it exists
+    - test -e .scheduled || skopeo copy docker://$CI_REGISTRY/$UPSTREAM_REPO/$IMAGE
+                  docker://$CI_REGISTRY_IMAGE/$IMAGE && exit 0 || true ;
+
+    # check if our image is already in the current registry
+    - test -e .scheduled || skopeo inspect docker://$CI_REGISTRY_IMAGE/$IMAGE > /dev/null && exit 0 || true ;
 
 fedora:30@qemu-prep:
   extends: .fedora@qemu-build