functions: add defaults for ZUUL_BRANCH & ZUUL_REF

When running periodic jobs, ZUUL_BRANCH & ZUUL_REF are empty because we
don't have any reference or branch set for the jobs.
To not make zuul failing when cloning Puppet modules, let's set defaults
values:

ZUUL_BRANCH default to master (we are running tests against master now)
If we need to test stable branches, we'll revisit later but it would be
a bigger change (job names, etc).

ZUUL_REF default to None.

Change-Id: I34b298230bc174a3fdd431095043543c4c223296
This commit is contained in:
Emilien Macchi 2016-04-20 09:38:56 -04:00
parent 86b6b1f3c0
commit 48ab117d2e

View File

@ -17,8 +17,8 @@ install_external() {
# #
# - ``PUPPETFILE_DIR`` must be set to Puppet modules directory # - ``PUPPETFILE_DIR`` must be set to Puppet modules directory
# - ``SCRIPT_DIR`` must be set to script path # - ``SCRIPT_DIR`` must be set to script path
# - ``ZUUL_REF`` must be set to Zuul ref # - ``ZUUL_REF`` must be set to Zuul ref. Fallback to 'None'.
# - ``ZUUL_BRANCH`` must be set to Zuul branch # - ``ZUUL_BRANCH`` must be set to Zuul branch. Fallback to 'master'.
# - ``ZUUL_URL`` must be set to Zuul URL # - ``ZUUL_URL`` must be set to Zuul URL
install_openstack() { install_openstack() {
cat > clonemap.yaml <<EOF cat > clonemap.yaml <<EOF
@ -27,6 +27,10 @@ clonemap:
dest: '$PUPPETFILE_DIR/\2' dest: '$PUPPETFILE_DIR/\2'
EOF EOF
# Periodic jobs run without ref on master
ZUUL_REF=${ZUUL_REF:-None}
ZUUL_BRANCH=${ZUUL_BRANCH:-master}
local project_names=$(awk '{ if ($1 == ":git") print $3 }' \ local project_names=$(awk '{ if ($1 == ":git") print $3 }' \
${SCRIPT_DIR}/Puppetfile0 | tr -d "'," | cut -d '/' -f 4- | xargs ${SCRIPT_DIR}/Puppetfile0 | tr -d "'," | cut -d '/' -f 4- | xargs
) )