Unify usages of checking for existing changes (2/2)
Use function setup_commit_message everywhere to avoid duplication of these lines. Also, document the side effects of the function in the invocation. Change-Id: I3b77a232467b536b62b5c61d30705deeb11e725e
This commit is contained in:
parent
b0ea5a3bbe
commit
f5145cf8ee
@ -157,6 +157,8 @@ EOF
|
||||
# See if there is an open change in the zanata/translations
|
||||
# topic. If so, get the change id for the existing change for use
|
||||
# in the commit msg.
|
||||
# Function setup_commit_message will set CHANGE_ID if a change
|
||||
# exists and will always set COMMIT_MSG.
|
||||
setup_commit_message $FULL_PROJECT proposal-bot $branch $TOPIC "$INITIAL_COMMIT_MSG"
|
||||
|
||||
# If the open change an already approved, let's not queue a new
|
||||
|
@ -23,30 +23,9 @@ SUCCESS=0
|
||||
|
||||
setup_git
|
||||
|
||||
change_id=""
|
||||
# See if there is an open change in the detect-dead-links topic
|
||||
# If so, get the change id for the existing change for use in the
|
||||
# commit msg.
|
||||
change_info=$(ssh -p 29418 $USERNAME@review.openstack.org gerrit query --current-patch-set status:open project:$PROJECT topic:$TOPIC owner:$USERNAME)
|
||||
previous=$(echo "$change_info" | grep "^ number:" | awk '{print $2}')
|
||||
if [ -n "$previous" ]; then
|
||||
change_id=$(echo "$change_info" | grep "^change" | awk '{print $2}')
|
||||
# read return a non zero value when it reaches EOF. Because we use a
|
||||
# heredoc here it will always reach EOF and return a nonzero value.
|
||||
# Disable -e temporarily to get around the read.
|
||||
# The reason we use read is to allow for multiline variable content
|
||||
# and variable interpolation. Simply double quoting a string across
|
||||
# multiple lines removes the newlines.
|
||||
set +e
|
||||
read -d '' COMMIT_MSG <<EOF
|
||||
$INITIAL_COMMIT_MSG
|
||||
|
||||
Change-Id: $change_id
|
||||
EOF
|
||||
set -e
|
||||
else
|
||||
COMMIT_MSG=$INITIAL_COMMIT_MSG
|
||||
fi
|
||||
# Function setup_commit_message will set CHANGE_ID if a change
|
||||
# exists and will always set COMMIT_MSG.
|
||||
setup_commit_message $PROJECT $USERNAME $BRANCH $TOPIC "$INITIAL_COMMIT_MSG"
|
||||
|
||||
git review -s
|
||||
python /usr/local/jenkins/slave_scripts/check_app_catalog_yaml.py
|
||||
|
@ -97,30 +97,10 @@ for PROJECT in $PROJECTS; do
|
||||
|
||||
# don't bother with this project if there's not a usable branch
|
||||
if [ -n "$BRANCH" ] ; then
|
||||
change_id=""
|
||||
# See if there is an open change in the openstack/requirements topic
|
||||
# If so, get the change id for the existing change for use in the
|
||||
# commit msg.
|
||||
change_info=$(ssh -p 29418 $USERNAME@review.openstack.org gerrit query --current-patch-set status:open project:$PROJECT topic:$TOPIC owner:$USERNAME branch:$BRANCH)
|
||||
previous=$(echo "$change_info" | grep "^ number:" | awk '{print $2}')
|
||||
if [ -n "$previous" ]; then
|
||||
change_id=$(echo "$change_info" | grep "^change" | awk '{print $2}')
|
||||
# read return a non zero value when it reaches EOF. Because we use a
|
||||
# heredoc here it will always reach EOF and return a nonzero value.
|
||||
# Disable -e temporarily to get around the read.
|
||||
# The reason we use read is to allow for multiline variable content
|
||||
# and variable interpolation. Simply double quoting a string across
|
||||
# multiple lines removes the newlines.
|
||||
set +e
|
||||
read -d '' COMMIT_MSG <<EOF
|
||||
$INITIAL_COMMIT_MSG
|
||||
|
||||
Change-Id: $change_id
|
||||
EOF
|
||||
set -e
|
||||
else
|
||||
COMMIT_MSG=$INITIAL_COMMIT_MSG
|
||||
fi
|
||||
# Function setup_commit_message will set CHANGE_ID if a change
|
||||
# exists and will always set COMMIT_MSG.
|
||||
setup_commit_message $PROJECT $USERNAME $BRANCH $TOPIC "$INITIAL_COMMIT_MSG"
|
||||
|
||||
git checkout -B ${BRANCH} -t origin/${BRANCH}
|
||||
# Need to set the git config in each repo as we shouldn't
|
||||
|
@ -23,31 +23,9 @@ SUCCESS=0
|
||||
|
||||
setup_git
|
||||
|
||||
change_id=""
|
||||
# See if there is an open change, if so, get the change id for the
|
||||
# existing change for use in the commit message.
|
||||
change_info=$(ssh -p 29418 $USERNAME@review.openstack.org gerrit query --current-patch-set status:open project:$PROJECT owner:$USERNAME branch:$BRANCH topic:$TOPIC)
|
||||
previous=$(echo "$change_info" | grep "^ number:" | awk '{print $2}')
|
||||
if [ "x${previous}" != "x" ] ; then
|
||||
change_id=$(echo "$change_info" | grep "^change" | awk '{print $2}')
|
||||
# read returns a non zero value when it reaches EOF. Because we use a
|
||||
# heredoc here it will always reach EOF and return a nonzero value.
|
||||
# Disable -e temporarily to get around the read.
|
||||
# The reason we use read is to allow for multiline variable content
|
||||
# and variable interpolation. Simply double quoting a string across
|
||||
# multiple lines removes the newlines.
|
||||
set +e
|
||||
read -d '' COMMIT_MSG <<EOF
|
||||
$INITIAL_COMMIT_MSG
|
||||
|
||||
Change-Id: $change_id
|
||||
EOF
|
||||
set -e
|
||||
else
|
||||
COMMIT_MSG=$INITIAL_COMMIT_MSG
|
||||
fi
|
||||
|
||||
echo "Setting commit message to: $COMMIT_MSG"
|
||||
# Function setup_commit_message will set CHANGE_ID if a change
|
||||
# exists and will always set COMMIT_MSG.
|
||||
setup_commit_message $PROJECT $USERNAME $BRANCH $TOPIC "$INITIAL_COMMIT_MSG"
|
||||
|
||||
tox -e genconfig
|
||||
RET=$?
|
||||
|
Loading…
Reference in New Issue
Block a user