Fix REFNAME in propose_update.sh

ZUUL_REFNAME is not set in periodic pipelines.

Provide optionally branch and use that one instead if REFNAME is not set
to mimic how the script was used in v2.

Change-Id: I3a514b5ffd9d0797c1bd43a0762bd5709630b1cd
This commit is contained in:
Andreas Jaeger
2017-10-17 20:01:04 +02:00
parent a6f91a843a
commit bf61f85cf8
2 changed files with 11 additions and 3 deletions

View File

@@ -20,6 +20,7 @@ if [ -z "$OWN_PROJECT" ] ; then
echo "usage: $0 project"
exit 1
fi
if [ "$OWN_PROJECT" == "requirements" ] ; then
INITIAL_COMMIT_MSG="Updated from global requirements"
TOPIC="openstack/requirements"
@@ -87,9 +88,16 @@ fi
USERNAME="proposal-bot"
ALL_SUCCESS=0
# In periodic pipelines, ZUUL_REFNAME is not set, use BRANCH_NAME
# instead here. The JJB scripts in v2 set always ZUUL_REFNAME, in v3
# we pass in the branch as additional parameter.
if [ -z "$ZUUL_REFNAME" ] ; then
echo "No ZUUL_REFNAME set, exiting."
exit 1
BRANCH_NAME=$2
if [ -z "$BRANCH_NAME" ] ; then
echo "usage: $0 project branch"
exit 1
fi
ZUUL_REFNAME=$BRANCH_NAME
fi
setup_git

View File

@@ -2,7 +2,7 @@
tasks:
- name: Run propose_update.sh script
command: "{{ ansible_user_dir }}/scripts/propose_update.sh {{ update_target }}"
command: "{{ ansible_user_dir }}/scripts/propose_update.sh {{ update_target }} {{zuul.branch}}"
args:
chdir: "src/{{ zuul.project.canonical_name }}"
environment: '{{ zuul | zuul_legacy_vars }}'