summary refs log tree commit diff
path: root/jenkins/clone.sh
diff options
context:
space:
mode:
authorMark Haines <mjark@negativecurvature.net>2016-08-02 20:42:30 +0100
committerGitHub <noreply@github.com>2016-08-02 20:42:30 +0100
commit9a2f296fa2e6bd42f10b12a81dba2279b8482fcc (patch)
treeac940939078a457cdc86653b219eb936b2bc6195 /jenkins/clone.sh
parentMerge pull request #971 from matrix-org/erikj/fed_state (diff)
downloadsynapse-9a2f296fa2e6bd42f10b12a81dba2279b8482fcc.tar.xz
Factor out some of the code shared between the sytest scripts (#974)
* Factor out some of the code shared between the different sytest jenkins scripts

* Exclude jenkins from the MANIFEST

* Fix dendron build

* Missing new line

* Poke jenkins

* Export the PORT_BASE and PORT_COUNT

* Poke jenkins
Diffstat (limited to 'jenkins/clone.sh')
-rwxr-xr-xjenkins/clone.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/jenkins/clone.sh b/jenkins/clone.sh
new file mode 100755
index 0000000000..f56d076ea9
--- /dev/null
+++ b/jenkins/clone.sh
@@ -0,0 +1,24 @@
+#! /bin/bash
+
+NAME=$1
+PROJECT=$2
+BASE=".$NAME-base"
+
+# update our clone
+if [ ! -d .$NAME-base ]; then
+  git clone $PROJECT $BASE --mirror
+else
+  (cd $BASE; git fetch -p)
+fi
+
+rm -rf $NAME
+git clone $BASE $NAME --shared
+
+: ${GIT_BRANCH:="origin/$(git rev-parse --abbrev-ref HEAD)"}
+cd $NAME
+# check out the relevant branch
+git checkout "${GIT_BRANCH}" || (
+    echo >&2 "No ref ${GIT_BRANCH} found, falling back to develop"
+    git checkout "origin/develop"
+)
+git clean -df .