Commit f7887431 authored by Robert Lyon's avatar Robert Lyon

Reject test run if the patchset isn't the most current

This happens if the job is added to jenkins queue and then patchset is
updated/rebased before the job is run.

Patch will stop running tests on obsolete patchset
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent ca23832a
......@@ -8,7 +8,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_URL, 'https://reviews.mahara.org/changes/?q=' . $git_commit_id . '&o=LABELS&o=CURRENT_REVISION&pp=0');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$content = curl_exec($ch);
curl_close($ch);
......@@ -21,6 +21,12 @@ if ($content[0]->status == 'MERGED') {
exit;
}
// Check that the patch we are testing is the latest (current) patchset in series
if ($content[0]->current_revision != $git_commit_id) {
echo 3;
exit;
}
// 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.
......
......@@ -29,6 +29,9 @@ do
if [ "$outcome" = "1" ]; then
echo "The patch with git commit id $line has been rejected"
exit 1;
elif [ "$outcome" = "3" ]; then
echo "The patch with git commit id $line is not the latest (current) patch"
exit 1;
else
echo "The patch with git commit id $line looks ok so we will continue"
fi
......
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