diff --git a/jenkins/scripts/common_translation_update.sh b/jenkins/scripts/common_translation_update.sh index da5bf0cdae..3b45b600c3 100644 --- a/jenkins/scripts/common_translation_update.sh +++ b/jenkins/scripts/common_translation_update.sh @@ -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 diff --git a/jenkins/scripts/propose_app_catalog_update.sh b/jenkins/scripts/propose_app_catalog_update.sh index 7052845424..b6818093c5 100755 --- a/jenkins/scripts/propose_app_catalog_update.sh +++ b/jenkins/scripts/propose_app_catalog_update.sh @@ -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 diff --git a/jenkins/scripts/propose_update.sh b/jenkins/scripts/propose_update.sh index 5008b45f0a..09b9c0b112 100755 --- a/jenkins/scripts/propose_update.sh +++ b/jenkins/scripts/propose_update.sh @@ -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 diff --git a/jenkins/scripts/propose_updated_config_file.sh b/jenkins/scripts/propose_updated_config_file.sh index 1bd6f6c989..21e57e9ee3 100755 --- a/jenkins/scripts/propose_updated_config_file.sh +++ b/jenkins/scripts/propose_updated_config_file.sh @@ -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=$?