qa.staging.devdrupal.org version of script
[sandbox/scor/1889654.git] / kick_pifr.php
1 <?php
2
3 define('DRUPAL_ROOT', getcwd());
4
5 require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
6 drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
7
8 ini_set('display_errors', TRUE);
9
10 include(DRUPAL_ROOT . '/includes/xmlrpc.inc');
11
12 // Need to trim whitespace, or the key doesn't match up to a client
13 $key = trim(file_get_contents('key.txt'));
14
15 $batch = array(
16 'branches' => array(),
17 'files' => array(),
18 'projects' => array(),
19 );
20
21 $batch['projects'][] = array(
22 'client_identifier' => 3060,
23 'name' => 'Drupal core (security testing)',
24 'repository_type' => 'git',
25 'repository_url' => 'git://git.drupal.org/project/drupal.git',
26 'link' => 'http://code.example.com',
27 );
28
29 $batch['branches'][] = array(
30 // Project identifier represents the Project NID on drupal.org
31 'project_identifier' => 3060,
32 // Client identifier represents the Release NID on drupal.org
33 //'client_identifier' => 572834, // 8.x-dev
34 'client_identifier' => 156281, // 7.x-dev
35 //'client_identifier' => 97386, // 6.x-dev
36 // VCS identifier represents the actual branch / tag name to checkout
37 'vcs_identifier' => '7.x',
38 'plugin_argument' => array(
39 // 'drupal.core.version' => '8',
40 'drupal.core.version' => '7',
41 // 'drupal.core.version' => '6',
42 ),
43 'test' => FALSE,
44 'link' => 'http://code.example.com/example-branch',
45 );
46
47 $batch['files'][] = array(
48 // Branch identifier is the same as 'client identifier' above
49 'branch_identifier' => 156281,
50 // Client identifier is a unique identifier for this file (fid)
51 'client_identifier' => 19487298,
52 'file_url' => 'http://drupal.org/files/dropbutton-1799498-45.patch',
53 );
54
55 echo "Sending request to http://qa.staging.devdrupal.org/xmlrpc.php\n";
56 // Need to prefix http auth username/password for staging
57 // Modified to use D6 xmlrpc function signature
58 if ($response = xmlrpc('http://drupal:drupal@qa.staging.devdrupal.org/xmlrpc.php', 'pifr.queue', $key, $batch)) {
59
60 foreach (array_merge($response['branches'], $response['files']) as $test) {
61 $tests[] = l('#' . $test, 'pifr/test/' . $test);
62 }
63
64 if ($tests) {
65 echo theme('item_list', $tests);
66 }
67 else {
68 echo 'No test(s) queued. The tests are most likely already queued.';
69 }
70 }
71 else {
72 echo("XMLRPC Call Failed");
73 }
74
75 // The response is something like this,
76 // http://qa.drupal.org/pifr/test/377058
77 // Array
78 // (
79 // [branches] => Array
80 // (
81 // [716] => 377053
82 // )
83 //
84 // [files] => Array
85 // (
86 // [19487298] => 377058
87 // )
88 //
89 // )
90