[gnome-runtime-images/buildah: 3/3] always build the images, and only push on master



commit cbc13cde27a9c77030267d9de4866308c5955fb0
Author: Abderrahim Kitouni <akitouni gnome org>
Date:   Thu Apr 9 17:59:00 2020 +0100

    always build the images, and only push on master

 .gitlab-ci.yml | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index c5aa520..f56cd5d 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -30,7 +30,11 @@ default:
         - echo ${DOCKERFILE} / ${DOCKERIMAGE}
 
         - buildah bud -f ${DOCKERFILE} -t ${DOCKERIMAGE} .
-        - buildah push ${DOCKERIMAGE}
+        # push only on master branch
+        - |
+          if [ $CI_COMMIT_REF_NAME == master ]; then
+              buildah push ${DOCKERIMAGE}
+          fi
     after_script:
         # don't try to use systemd/journald
         - |
@@ -40,10 +44,6 @@ default:
           END
         - podman run --rm ${DOCKERIMAGE} flatpak list --columns=application,branch,arch,active,size
         - buildah inspect --format "{{.FromImageID}}" ${DOCKERIMAGE}
-    only:
-        - master
-        - triggers
-        - schedules
 
 base:
     stage: base
@@ -64,7 +64,7 @@ flat-manager-client:
 # branch it is based on
 .sdk_template:
     script:
-        # build and push the flatpak sdk image
+        # build the flatpak sdk image
         - |
           CONTAINER=$(buildah from ${CI_REGISTRY_IMAGE}/base)
 
@@ -73,9 +73,8 @@ flat-manager-client:
 
           buildah commit $CONTAINER ${CI_REGISTRY_IMAGE}/gnome:${BRANCH}
 
-        - buildah push ${CI_REGISTRY_IMAGE}/gnome:${BRANCH}
 
-        # build and push the rust_bundle image
+        # build the rust_bundle image
         - |
           CONTAINER=$(buildah from ${CI_REGISTRY_IMAGE}/gnome:${BRANCH})
 
@@ -84,11 +83,12 @@ flat-manager-client:
 
           buildah commit $CONTAINER ${CI_REGISTRY_IMAGE}/rust_bundle:${BRANCH}
 
-        - buildah push ${CI_REGISTRY_IMAGE}/rust_bundle:${BRANCH}
-    only:
-        - master
-        - triggers
-        - schedules
+        # push only on master branch
+        - |
+          if [ $CI_COMMIT_REF_NAME == master ]; then
+              buildah push ${CI_REGISTRY_IMAGE}/gnome:${BRANCH}
+              buildah push ${CI_REGISTRY_IMAGE}/rust_bundle:${BRANCH}
+          fi
 
 
 gnome:master:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]