Create clone map outside workspace in zuul-.*-prep

Since zuul-cloner needs a clone map to tell it to clone the tested
project as the job workspace, and git won't clone into a non-empty
directory, the clone map needs to be written outside the workspace.
Use a temporary file, and clean it up with an exit trap in case this
macro is used on long-lived job workers.

Change-Id: I40ebd3dbb9123edce973d8ddaa06f0f804e16c56
This commit is contained in:
Jeremy Stanley 2015-07-14 18:03:13 +00:00
parent e73a602903
commit 0c057f9bb2

View File

@ -26,12 +26,17 @@
builders:
- shell: |
#!/bin/bash -xe
cat > clonemap.yaml << EOF
CLONEMAP=`mktemp`
function cleanup {
rm -f $CLONEMAP
}
trap cleanup EXIT
cat > $CLONEMAP << EOF
clonemap:
- name: $ZUUL_PROJECT
dest: .
EOF
/usr/zuul-env/bin/zuul-cloner -m clonemap.yaml --cache-dir /opt/git \
/usr/zuul-env/bin/zuul-cloner -m $CLONEMAP --cache-dir /opt/git \
git://git.openstack.org $ZUUL_PROJECT
- builder:
@ -39,7 +44,12 @@
builders:
- shell: |
#!/bin/bash -xe
cat > clonemap.yaml << EOF
CLONEMAP=`mktemp`
function cleanup {
rm -f $CLONEMAP
}
trap cleanup EXIT
cat > $CLONEMAP << EOF
clonemap:
- name: $ZUUL_PROJECT
dest: .
@ -51,7 +61,7 @@
if [ "$BRANCH_OVERRIDE" != "default" ] ; then
export ZUUL_BRANCH=$BRANCH_OVERRIDE
fi
/usr/zuul-env/bin/zuul-cloner -m clonemap.yaml --cache-dir /opt/git \
/usr/zuul-env/bin/zuul-cloner -m $CLONEMAP --cache-dir /opt/git \
git://git.openstack.org $ZUUL_PROJECT
- builder: