do not propose a new keystone config file if already approved
Borrowing from common_translation_update.sh, the config file proposal should behave the same way. if there is already an approved job, then we can wait to propose a new revision once it has been merged. Moved the original code that perfoms the check into common.sh and named it check_already_approved. Change-Id: I48180f8580a54749248a25505edbc1303457e2e4
This commit is contained in:
@@ -57,3 +57,34 @@ EOF
|
|||||||
COMMIT_MSG=$INITIAL_COMMIT_MSG
|
COMMIT_MSG=$INITIAL_COMMIT_MSG
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Check to see if $CHANGE_ID is already approved, if it is, don't bother
|
||||||
|
# proposing another.
|
||||||
|
function check_already_approved {
|
||||||
|
local CHANGE_ID=$1
|
||||||
|
|
||||||
|
# If the open change an already approved, let's not queue a new
|
||||||
|
# patch but let's merge the other patch first.
|
||||||
|
# This solves the problem that when the gate pipeline backup
|
||||||
|
# reaches roughly a day, no matter how quickly you approve the new
|
||||||
|
# update it will always get sniped out of the gate by another.
|
||||||
|
# It also helps, when you approve close to the time this job is
|
||||||
|
# run.
|
||||||
|
if [ -n "$CHANGE_ID" ]; then
|
||||||
|
# Use the JSON format since it is very compact and easy to grep
|
||||||
|
change_info=$(ssh -p 29418 proposal-bot@review.openstack.org gerrit query --current-patch-set --format=JSON $CHANGE_ID)
|
||||||
|
# Check for:
|
||||||
|
# 1) Workflow approval (+1)
|
||||||
|
# 2) no -1/-2 by Jenkins
|
||||||
|
# 3) no -2 by reviewers
|
||||||
|
# 4) no Workflow -1 (WIP)
|
||||||
|
#
|
||||||
|
if echo $change_info|grep -q '{"type":"Workflow","description":"Workflow","value":"1"' \
|
||||||
|
&& ! echo $change_info|grep -q '{"type":"Verified","description":"Verified","value":"-[12]","grantedOn":[0-9]*,"by":{"name":"Jenkins","username":"jenkins"}}' \
|
||||||
|
&& ! echo $change_info|grep -q '{"type":"Code-Review","description":"Code-Review","value":"-2"' \
|
||||||
|
&& ! echo $change_info|grep -q '{"type":"Workflow","description":"Workflow","value":"-1"' ; then
|
||||||
|
echo "Job already approved, exiting"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
@@ -173,30 +173,9 @@ EOF
|
|||||||
# exists and will always set COMMIT_MSG.
|
# exists and will always set COMMIT_MSG.
|
||||||
setup_commit_message $FULL_PROJECT proposal-bot $branch $TOPIC "$INITIAL_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
|
# Function check_already_approved will quit the proposal process if there
|
||||||
# patch but let's merge the other patch first.
|
# is already an approved job with the same CHANGE_ID
|
||||||
# This solves the problem that when the gate pipeline backup
|
check_already_approved $CHANGE_ID
|
||||||
# reaches roughly a day, no matter how quickly you approve the new
|
|
||||||
# update it will always get sniped out of the gate by another.
|
|
||||||
# It also helps, when you approve close to the time this job is
|
|
||||||
# run.
|
|
||||||
if [ -n "$CHANGE_ID" ]; then
|
|
||||||
# Use the JSON format since it is very compact and easy to grep
|
|
||||||
change_info=$(ssh -p 29418 proposal-bot@review.openstack.org gerrit query --current-patch-set --format=JSON $CHANGE_ID)
|
|
||||||
# Check for:
|
|
||||||
# 1) Workflow approval (+1)
|
|
||||||
# 2) no -1/-2 by Jenkins
|
|
||||||
# 3) no -2 by reviewers
|
|
||||||
# 4) no Workflow -1 (WIP)
|
|
||||||
#
|
|
||||||
if echo $change_info|grep -q '{"type":"Workflow","description":"Workflow","value":"1"' \
|
|
||||||
&& ! echo $change_info|grep -q '{"type":"Verified","description":"Verified","value":"-[12]","grantedOn":[0-9]*,"by":{"name":"Jenkins","username":"jenkins"}}' \
|
|
||||||
&& ! echo $change_info|grep -q '{"type":"Code-Review","description":"Code-Review","value":"-2"' \
|
|
||||||
&& ! echo $change_info|grep -q '{"type":"Workflow","description":"Workflow","value":"-1"' ; then
|
|
||||||
echo "Job already approved, exiting"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Propose patch using COMMIT_MSG
|
# Propose patch using COMMIT_MSG
|
||||||
|
@@ -27,6 +27,11 @@ setup_git
|
|||||||
# exists and will always set COMMIT_MSG.
|
# exists and will always set COMMIT_MSG.
|
||||||
setup_commit_message $PROJECT $USERNAME $BRANCH $TOPIC "$INITIAL_COMMIT_MSG"
|
setup_commit_message $PROJECT $USERNAME $BRANCH $TOPIC "$INITIAL_COMMIT_MSG"
|
||||||
|
|
||||||
|
# Function check_already_approved will quit the proposal process if there
|
||||||
|
# is already an approved job with the same CHANGE_ID
|
||||||
|
check_already_approved $CHANGE_ID
|
||||||
|
|
||||||
|
|
||||||
tox -e genconfig
|
tox -e genconfig
|
||||||
RET=$?
|
RET=$?
|
||||||
if [ "$RET" -ne "0" ] ; then
|
if [ "$RET" -ne "0" ] ; then
|
||||||
|
Reference in New Issue
Block a user