|
|
|
@ -12,7 +12,6 @@ define("ENV_HTTPS_APP_VALUE", "HTTPS_APP_VALUE"); |
|
|
|
|
define("ENV_HTTPS_TOKEN_VALUE", "HTTPS_TOKEN_VALUE"); |
|
|
|
|
|
|
|
|
|
define("PRIMARY_TOKEN_FILE", '/home/krad/.sandcastle'); |
|
|
|
|
define("SECONDARY_TOKEN_FILE", '$HOME/.sandcastle'); |
|
|
|
|
define("CONT_RUN_ALIAS", "leveldb"); |
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////// |
|
|
|
@ -25,9 +24,7 @@ function postURL($diffID, $url) { |
|
|
|
|
$cmd = 'echo \'{"diff_id": "' . $diffID . '", ' |
|
|
|
|
. '"name":"click here for sandcastle tests for D' . $diffID . '", ' |
|
|
|
|
. '"link":"' . $url . '"}\' | ' |
|
|
|
|
. 'no_proxy=facebook.com,tfbnw.net,fb.com ' |
|
|
|
|
. 'http_proxy=fwdproxy.any.facebook.com:8080 ' |
|
|
|
|
. 'https_proxy=fwdproxy.any.facebook.com:8080 arc call-conduit ' |
|
|
|
|
. 'arc call-conduit ' |
|
|
|
|
. 'differential.updateunitresults'; |
|
|
|
|
shell_exec($cmd); |
|
|
|
|
} |
|
|
|
@ -41,9 +38,7 @@ function buildUpdateTestStatusCmd($diffID, $test, $status) { |
|
|
|
|
$cmd = 'echo \'{"diff_id": "' . $diffID . '", ' |
|
|
|
|
. '"name":"' . $test . '", ' |
|
|
|
|
. '"result":"' . $status . '"}\' | ' |
|
|
|
|
. 'no_proxy=facebook.com,tfbnw.net,fb.com ' |
|
|
|
|
. 'http_proxy=fwdproxy.any.facebook.com:8080 ' |
|
|
|
|
. 'https_proxy=fwdproxy.any.facebook.com:8080 arc call-conduit ' |
|
|
|
|
. 'arc call-conduit ' |
|
|
|
|
. 'differential.updateunitresults'; |
|
|
|
|
return $cmd; |
|
|
|
|
} |
|
|
|
@ -108,8 +103,7 @@ function getSteps($applyDiff, $diffID, $username, $test) { |
|
|
|
|
// Patch the code (keep your fingures crossed). |
|
|
|
|
$patch = array( |
|
|
|
|
"name" => "Patch " . $diffID, |
|
|
|
|
"shell" => "no_proxy=facebook.com,tfbnw.net,fb.com " |
|
|
|
|
."HTTPS_PROXY=fwdproxy:8080 arc --arcrc-file ~/.arcrc " |
|
|
|
|
"shell" => "arc --arcrc-file ~/.arcrc " |
|
|
|
|
. "patch --nocommit --diff " . $diffID, |
|
|
|
|
"user" => "root" |
|
|
|
|
); |
|
|
|
@ -178,6 +172,8 @@ function getSteps($applyDiff, $diffID, $username, $test) { |
|
|
|
|
function getSandcastleConfig() { |
|
|
|
|
$sandcastle_config = array(); |
|
|
|
|
|
|
|
|
|
$cwd = getcwd(); |
|
|
|
|
$cwd_token_file = "{$cwd}/.sandcastle"; |
|
|
|
|
// This is a case when we're executed from a continuous run. Fetch the values |
|
|
|
|
// from the environment. |
|
|
|
|
if (getenv(ENV_POST_RECEIVE_HOOK)) { |
|
|
|
@ -188,20 +184,20 @@ function getSandcastleConfig() { |
|
|
|
|
// configuration files. |
|
|
|
|
for ($i = 0; $i < 50; $i++) { |
|
|
|
|
if (file_exists(PRIMARY_TOKEN_FILE) || |
|
|
|
|
file_exists(SECONDARY_TOKEN_FILE)) { |
|
|
|
|
file_exists($cwd_token_file)) { |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
// If we failed to fetch the tokens, sleep for 0.2 second and try again |
|
|
|
|
usleep(200000); |
|
|
|
|
} |
|
|
|
|
assert(file_exists(PRIMARY_TOKEN_FILE) || |
|
|
|
|
file_exists(SECONDARY_TOKEN_FILE)); |
|
|
|
|
file_exists($cwd_token_file)); |
|
|
|
|
|
|
|
|
|
// Try the primary location first, followed by a secondary. |
|
|
|
|
if (file_exists(PRIMARY_TOKEN_FILE)) { |
|
|
|
|
$cmd = 'cat ' . PRIMARY_TOKEN_FILE; |
|
|
|
|
} else { |
|
|
|
|
$cmd = 'cat ' . SECONDARY_TOKEN_FILE; |
|
|
|
|
$cmd = 'cat ' . $cwd_token_file; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
assert(strlen($cmd) > 0); |
|
|
|
@ -305,7 +301,7 @@ function getSandcastleConfig() { |
|
|
|
|
// Submit to Sandcastle. |
|
|
|
|
$url = 'https://interngraph.intern.facebook.com/sandcastle/generate?' |
|
|
|
|
.'command=SandcastleUniversalCommand' |
|
|
|
|
.'&vcs=rocksdb-git&revision=origin%2Fmaster&type=lego' |
|
|
|
|
.'&vcs=rocksdb-int-git&revision=origin%2Fmaster&type=lego' |
|
|
|
|
.'&user=' . $username . '&alias=rocksdb-precommit' |
|
|
|
|
.'&command-args=' . urlencode(json_encode($command)); |
|
|
|
|
|
|
|
|
@ -315,7 +311,7 @@ function getSandcastleConfig() { |
|
|
|
|
$app = $sandcastle_config[0]; |
|
|
|
|
$token = $sandcastle_config[1]; |
|
|
|
|
|
|
|
|
|
$cmd = 'https_proxy= HTTPS_PROXY= curl -s -k -F app=' . $app . ' ' |
|
|
|
|
$cmd = 'curl -s -k -F app=' . $app . ' ' |
|
|
|
|
. '-F token=' . $token . ' "' . $url . '"'; |
|
|
|
|
|
|
|
|
|
$output = shell_exec($cmd); |
|
|
|
|