コード例 #1
0
 public function didRunWorkflow($command, ArcanistBaseWorkflow $workflow, $error_code)
 {
     // Default options don't terminate on failure, but that's what we want. In
     // the current case we use assertions intentionally as "terminate on failure
     // invariants".
     assert_options(ASSERT_BAIL, true);
     assert($workflow);
     assert(strlen($command) > 0);
     if ($command == DIFF_COMMAND && !$workflow->isRawDiffSource()) {
         $diffID = $workflow->getDiffId();
         // When submitting a diff this code path gets executed multiple times in
         // a row. We only care about the case when ID for the diff is provided
         // because that's what we need to apply the diff and trigger the tests.
         if (strlen($diffID) > 0) {
             assert(is_numeric($diffID));
             startTestsInSandcastle(true, $workflow, $diffID);
         }
     }
 }
コード例 #2
0
    }
    $command = array("name" => $runName, "steps" => array());
    $command["steps"][] = array("name" => "Generate determinator", "shell" => "echo " . $arg_encoded . " | base64 --decode | gzip -d" . " | base64 --decode", "determinator" => true, "user" => "root");
    // Submit to Sandcastle.
    $url = 'https://interngraph.intern.facebook.com/sandcastle/generate?' . 'command=SandcastleUniversalCommand' . '&vcs=rocksdb-git&revision=origin%2Fmaster&type=lego' . '&user='******'&alias=rocksdb-precommit' . '&command-args=' . urlencode(json_encode($command));
    // Fetch the configuration necessary to submit a successful HTTPS request.
    $sandcastle_config = getSandcastleConfig();
    $app = $sandcastle_config[0];
    $token = $sandcastle_config[1];
    $cmd = 'https_proxy= HTTPS_PROXY= curl -s -k -F app=' . $app . ' ' . '-F token=' . $token . ' "' . $url . '"';
    $output = shell_exec($cmd);
    assert(strlen($output) > 0);
    // Extract Sandcastle URL from the response.
    preg_match('/url": "(.+)"/', $output, $sandcastle_url);
    assert(count($sandcastle_url) > 0, "Unable to submit Sandcastle request.");
    assert(strlen($sandcastle_url[1]) > 0, "Unable to extract Sandcastle URL.");
    if ($applyDiff) {
        echo "\nSandcastle URL: " . $sandcastle_url[1] . "\n";
        // Ask Phabricator to display it on the diff UI.
        postURL($diffID, $sandcastle_url[1]);
    } else {
        echo "Continuous integration started Sandcastle tests. You can look at ";
        echo "the progress at:\n" . $sandcastle_url[1] . "\n";
    }
}
// Continuous run cript will set the environment variable and based on that
// we'll trigger the execution of tests in Sandcastle. In that case we don't
// need to apply any diffs and there's no associated workflow either.
if (getenv(ENV_POST_RECEIVE_HOOK)) {
    startTestsInSandcastle(false, NULL, NULL);
}