]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-build.git/commitdiff
ceph-dev-setup: prevent building branches that have slashes in their name 458/head
authorAlfredo Deza <adeza@redhat.com>
Fri, 2 Sep 2016 14:21:04 +0000 (10:21 -0400)
committerAlfredo Deza <adeza@redhat.com>
Fri, 2 Sep 2016 14:42:14 +0000 (10:42 -0400)
Signed-off-by: Alfredo Deza <adeza@redhat.com>
ceph-dev-setup/build/build

index aacaa7c3bced2fbb2b3f5c7ca3c511490c5b2d71..c967a5b9bf4ca9a5cc82ca2e85347eb000d4f6e9 100644 (file)
@@ -1,8 +1,17 @@
 #!/bin/bash -ex
 
-# split on '/' to get just 'wip-mybranch' when input is like: origin/wip-mybranch
+branch_slashes=$(grep -o "/" <<< ${GIT_BRANCH} | wc -l)
 BRANCH=`echo ${GIT_BRANCH} | rev | cut -d '/' -f 1 | rev`
 
+# Prevent building branches that have slashes in their name
+if [ "$((branch_slashes))" -gt 1 ] ; then
+    echo "Will refuse to build branch: ${GIT_BRANCH}"
+    echo "Invalid branch name (contains slashes): ${BRANCH}"
+    exit 1
+fi
+
+# split on '/' to get just 'wip-mybranch' when input is like: origin/wip-mybranch
+
 HOST=$(hostname --short)
 echo "Building on ${HOST}"
 echo "  DIST=${DIST}"