Last active
December 20, 2015 09:49
-
-
Save Firehed/6111019 to your computer and use it in GitHub Desktop.
Jenkins/Phabricator integration scripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/php | |
<?php | |
$url = $_ENV['BUILD_URL']; | |
$res= json_decode(file_get_contents($url . 'api/json')); | |
$silent = false; | |
$message = ''; | |
$action = 'reject'; // default no | |
switch ($res->result) { | |
case 'SUCCESS': | |
$message = 'Build ok!'; | |
$silent = true; | |
$action = 'none'; | |
break; | |
default: | |
$message = 'Build failed!'; | |
break; | |
} | |
$diff_id = $_ENV['DIFF_ID']; | |
// convert the diff_id into the Differential revision id | |
$arcarg = escapeshellarg(json_encode(array("diff_id"=>$diff_id))); | |
$json = `echo $arcarg | arc call-conduit differential.getdiff`; | |
$rev_id = json_decode($json)->response->revisionID; | |
$arcarg = escapeshellarg(json_encode(array("revision_id" => $rev_id, "message" => $message, "action" => $action, "silent" => $silent))); | |
// post the comment | |
`echo $arcarg | arc call-conduit differential.createcomment`; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "## Figuring out rev number" | |
REVNO=$(echo {\"diff_id\":$DIFF_ID} | arc call-conduit differential.getdiff | php -r '$d=json_decode(file_get_contents("php://stdin")); $r = $d->response->sourceControlBaseRevision; echo substr($r, strrpos($r, "@")+1);') | |
echo "## Updating to it" | |
svn up -r$REVNO | |
echo "## Patching" | |
arc patch --no-ansi --diff $DIFF_ID | |
# your code to run the build/tests here |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment