[tracker-oci-images/sam/podman: 7/7] Only push on master



commit 1174e8b0e2c2ef487296bca8258d3a48d03c08ab
Author: Sam Thursfield <sam afuera me uk>
Date:   Wed Dec 11 15:14:36 2019 +0100

    Only push on master

 .gitlab-ci.yml | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 4bd046c..c9ed9b9 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -20,7 +20,13 @@ variables:
     - sed -i '/^mountopt =.*/d' /etc/containers/storage.conf
 
     - podman build --cgroup-manager=cgroupfs --format=docker --pull -f ${DOCKERFILE} -t ${IMAGE} 
${CONTEXT_DIR}
-    - podman push --creds $CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD ${IMAGE}
+
+    - |
+      if [ "$CI_COMMIT_REF_NAME" = "master" ]; then
+          podman push --creds $CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD ${IMAGE}
+      else
+          echo "Not pushing image, as we are on non-master branch $CI_COMMIT_REF_NAME"
+      fi
 
 # Expects $ARCH variable which should be the architexcture of the image ex. x86_64
 # Expects $DISTRO_NAME variable which should be the name of the distro image ex. ubuntu


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