Commit ca23832a authored by Robert Lyon's avatar Robert Lyon

Allowing the initial commit we test to ignore the auto test fail

But not for any parents it has.
This is useful if we retrigger the test from jenkins
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 12d972e2
......@@ -6,6 +6,7 @@
*/
$git_commit_id = $argv[2];
$first_commit = $argv[3];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://reviews.mahara.org/changes/?q=' . $git_commit_id . '&o=LABELS&pp=0');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
......@@ -19,8 +20,15 @@ if ($content[0]->status == 'MERGED') {
echo 2;
exit;
}
// Now check to see if anyone has rejected this
if (empty($content[0]->labels->{'Verified'}->rejected) &&
// Now check to see if anyone has rejected this.
// We don't want to reject the patch if auto test has failed as we are re-testing now
// but we do want to reject patch if the parent has failed auto test.
if (!empty($first_commit) && empty($content[0]->labels->{'Verified'}->rejected) &&
empty($content[0]->labels->{'Code-Review'}->rejected)) {
echo 0;
}
else if (empty($content[0]->labels->{'Verified'}->rejected) &&
empty($content[0]->labels->{'Code-Review'}->rejected) &&
empty($content[0]->labels->{'Automated-Tests'}->rejected)) {
echo 0;
......
......@@ -16,23 +16,23 @@ echo "This patch is behind $GERRIT_BRANCH by $BEHINDBY commit(s)"
echo "########## Check the patch and its parents are not already rejected"
echo ""
# Fetch the last 30 git commit ids and check the ones that are not also present in origin
# This allows us to check the current patch and it's parents all the way back to a commit
# that exists in origin, ie the point that origin HEAD was at when the patch was made. If
# there are more than 30 steps to get to origin HEAD the check above will handle that.
# Fetch the git commit ids that exist between this commit and the origin
# that exists when the patch was made.
HEAD=`git rev-parse HEAD`
the_list=`git log --pretty=format:'%H' origin/$GERRIT_BRANCH..$HEAD`
firstcommit=1
while IFS= read -r line
do
# check if the commit or it's parents have been rejected
php=`which php`
outcome=`$php $HOME/mahara/mahara-scripts/jenkins/gerrit_query.php -- $line`
outcome=`$php $HOME/mahara/mahara-scripts/jenkins/gerrit_query.php -- $line $firstcommit`
if [ "$outcome" = "1" ]; then
echo "The patch with git commit id $line has been rejected"
exit 1;
else
echo "The patch with git commit id $line looks ok so we will continue"
fi
firstcommit=0
done <<< "$the_list"
echo ""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment