File TODO changed (mode: 100644) (index 3a70d08..26efbee) |
60 |
60 |
Seems we are cloning the namespace, before knowing if the user can push! |
Seems we are cloning the namespace, before knowing if the user can push! |
61 |
61 |
|
|
62 |
62 |
== FOR OTHER RELEASE == |
== FOR OTHER RELEASE == |
|
63 |
|
[ ] We may want to not log at all the first line when a bot connects and the load is big. |
|
64 |
|
[ ] dnf install: |
|
65 |
|
Error in POSTIN scriptlet in rpm package catab+rocketgit |
|
66 |
|
Running scriptlet: rocketgit-0.73-1.noarch 2/2 |
|
67 |
|
Glob pattern passed to enable, but globs are not supported for this. |
|
68 |
|
Invalid unit name "rocketgit-worker@*.service" escaped as "rocketgit-worker@\x2a.service". |
|
69 |
|
[ ] Maybe I should not restore whole repo dir! Takes too much! |
63 |
70 |
[ ] Use SELinux booleans to restrict more the VM env. |
[ ] Use SELinux booleans to restrict more the VM env. |
64 |
71 |
[ ] Convert builder and worker to systemd serices (sockets). |
[ ] Convert builder and worker to systemd serices (sockets). |
65 |
72 |
[ ] webhook: allow user to select pkg repos which should be enabled. |
[ ] webhook: allow user to select pkg repos which should be enabled. |
File inc/builder.inc.php changed (mode: 100644) (index 6c170da..a4b69e3) |
... |
... |
function rg_builder_done($db, $job, $s) |
124 |
124 |
$env = $req['env']; |
$env = $req['env']; |
125 |
125 |
// TODO: sometimes, done is not present |
// TODO: sometimes, done is not present |
126 |
126 |
if (isset($s['done'])) |
if (isset($s['done'])) |
127 |
|
$labels[] = 'worker_elap/' . ($s['done'] - $s['start']) . 's'; |
|
|
127 |
|
$labels[] = 'worker_elap/' . ($s['done'] - intval($s['start'])) . 's'; |
128 |
128 |
$labels[] = 'wait_time/' . ($job['worker_sent'] - $job['itime']) . 's'; |
$labels[] = 'wait_time/' . ($job['worker_sent'] - $job['itime']) . 's'; |
129 |
129 |
$labels[] = 'date/' . gmdate('Y-m-d', $job['itime']); |
$labels[] = 'date/' . gmdate('Y-m-d', $job['itime']); |
130 |
130 |
$labels[] = 'time/' . gmdate('H:i', $job['itime']); |
$labels[] = 'time/' . gmdate('H:i', $job['itime']); |
File root/index.php changed (mode: 100644) (index 0095cfd..3ecfb2e) |
... |
... |
$user = ""; $repo = ""; $organization = 0; // TODO: those are really used? |
88 |
88 |
$rg['proto'] = isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : ''; |
$rg['proto'] = isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : ''; |
89 |
89 |
$rg['ua'] = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ""; |
$rg['ua'] = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ""; |
90 |
90 |
if ((rg_load() > 50) && rg_is_bot($rg['ua'])) { |
if ((rg_load() > 50) && rg_is_bot($rg['ua'])) { |
91 |
|
header($rg['proto'] . ' 429 Too many requests'); |
|
|
91 |
|
header($rg['proto'] . ' 429 Too many requests (bot)'); |
92 |
92 |
echo 'Too many requests. Please slow down.' . "\n"; |
echo 'Too many requests. Please slow down.' . "\n"; |
93 |
93 |
exit(0); |
exit(0); |
94 |
94 |
} |
} |
|
... |
... |
rg_debug_set(rg_state_get($db, 'debug')); |
131 |
131 |
$lim = rg_rate_limit($db); |
$lim = rg_rate_limit($db); |
132 |
132 |
if (($lim == 0) && (rg_debug() == 0)) { |
if (($lim == 0) && (rg_debug() == 0)) { |
133 |
133 |
rg_log('Too many requests'); |
rg_log('Too many requests'); |
134 |
|
header($rg['proto'] . ' 429 Too many requests'); |
|
|
134 |
|
header($rg['proto'] . ' 429 Too many requests (lim)'); |
135 |
135 |
echo 'Too many requests. Please slow down.' . "\n"; |
echo 'Too many requests. Please slow down.' . "\n"; |
136 |
136 |
exit(0); |
exit(0); |
137 |
137 |
} else if ($lim > 0) |
} else if ($lim > 0) |
File scripts/worker.php changed (mode: 100644) (index 6889003..073a328) |
... |
... |
function load_config($file) |
233 |
233 |
} |
} |
234 |
234 |
|
|
235 |
235 |
if (!isset($i['pkg_cmd'])) { |
if (!isset($i['pkg_cmd'])) { |
236 |
|
$x = explode('-', $name, 3); $x = $x[0]; $y = isset($x[1]) ? $x[1] : ''; |
|
|
236 |
|
$q = explode('-', $name, 3); $x = $q[0]; $y = isset($q[1]) ? $q[1] : ''; |
237 |
237 |
if ((strcasecmp($x, 'debian') == 0) || (strcasecmp($x, 'ubuntu') == 0)) { |
if ((strcasecmp($x, 'debian') == 0) || (strcasecmp($x, 'ubuntu') == 0)) { |
238 |
238 |
$i['pkg_cmd'] = 'apt --assume-yes --ignore-hold' |
$i['pkg_cmd'] = 'apt --assume-yes --ignore-hold' |
239 |
239 |
. ' --allow-downgrades --allow-remove-essential' |
. ' --allow-downgrades --allow-remove-essential' |
|
... |
... |
function load_config($file) |
258 |
258 |
unset($conf['env'][$name]); |
unset($conf['env'][$name]); |
259 |
259 |
continue; |
continue; |
260 |
260 |
} |
} |
|
261 |
|
|
|
262 |
|
rg_log('Set pkg_cmd to [' . $i['pkg_cmd'] . ']' |
|
263 |
|
. ' for name [' . $name . ']; x=[' . $x . '] y=[' . $y . ']'); |
261 |
264 |
} |
} |
262 |
265 |
} |
} |
263 |
266 |
unset($i); |
unset($i); |
|
... |
... |
function start_worker_build_tools($job, &$reason, &$reason2) |
414 |
417 |
. "\n" |
. "\n" |
415 |
418 |
. 'function rg_notify()' . "\n" |
. 'function rg_notify()' . "\n" |
416 |
419 |
. '{' . "\n" |
. '{' . "\n" |
417 |
|
. ' echo "M${@}" > /dev/virtio-ports/rgw' . "\n" |
|
|
420 |
|
. ' echo "M${@}" > /dev/virtio-ports/rgw &' . "\n" // TODO: CentOS 7, for example, returns "Resource busy" |
|
421 |
|
. ' echo "M${@}" >> /mnt/status/history' . "\n" |
418 |
422 |
. '}' . "\n" |
. '}' . "\n" |
419 |
423 |
. "\n" |
. "\n" |
420 |
424 |
. 'function rg_notify_err()' . "\n" |
. 'function rg_notify_err()' . "\n" |
|
... |
... |
function rg_job_extract_info(&$job) |
2348 |
2352 |
$pkg_subrepo_dirty[] = $id; |
$pkg_subrepo_dirty[] = $id; |
2349 |
2353 |
} |
} |
2350 |
2354 |
|
|
|
2355 |
|
$_x = @file_get_contents($job['main'] . '/root/T_DONE'); |
|
2356 |
|
if ($_x === FALSE) |
|
2357 |
|
$_done = time(); |
|
2358 |
|
else |
|
2359 |
|
$_done = intval($_x); |
|
2360 |
|
|
2351 |
2361 |
$job['status'] = array( |
$job['status'] = array( |
2352 |
2362 |
'vm_start' => $vm_start, |
'vm_start' => $vm_start, |
2353 |
2363 |
'build_sh_start' => $build_sh_start, |
'build_sh_start' => $build_sh_start, |
|
... |
... |
function rg_job_extract_info(&$job) |
2356 |
2366 |
'start' => @trim(file_get_contents($job['main'] . '/root/T_START')), |
'start' => @trim(file_get_contents($job['main'] . '/root/T_START')), |
2357 |
2367 |
'net_ok' => @trim(file_get_contents($job['main'] . '/root/T_NET_OK')), |
'net_ok' => @trim(file_get_contents($job['main'] . '/root/T_NET_OK')), |
2358 |
2368 |
'pkgs_ok' => @trim(file_get_contents($job['main'] . '/root/T_PKGS_OK')), |
'pkgs_ok' => @trim(file_get_contents($job['main'] . '/root/T_PKGS_OK')), |
2359 |
|
'done' => @trim(file_get_contents($job['main'] . '/root/T_DONE')) || time(), |
|
|
2369 |
|
'done' => $_done, |
2360 |
2370 |
'labels' => $labels, |
'labels' => $labels, |
2361 |
2371 |
'pkg_subrepo_dirty' => $pkg_subrepo_dirty |
'pkg_subrepo_dirty' => $pkg_subrepo_dirty |
2362 |
2372 |
); |
); |
|
... |
... |
while(1) { |
2645 |
2655 |
|
|
2646 |
2656 |
$name = 'rg-worker-' . $conf['id'] . '-' . $jid; |
$name = 'rg-worker-' . $conf['id'] . '-' . $jid; |
2647 |
2657 |
|
|
|
2658 |
|
if (!isset($job['state'])) |
|
2659 |
|
$job['state'] = RG_JOB_INIT; |
|
2660 |
|
|
2648 |
2661 |
while ($job['state'] == RG_JOB_INIT) { |
while ($job['state'] == RG_JOB_INIT) { |
2649 |
2662 |
// TODO: how this could happen?! |
// TODO: how this could happen?! |
2650 |
2663 |
$k = array_search($name, $vms); |
$k = array_search($name, $vms); |
|
... |
... |
while(1) { |
2691 |
2704 |
xchan_open($job); |
xchan_open($job); |
2692 |
2705 |
$stats['jobs']++; |
$stats['jobs']++; |
2693 |
2706 |
} else if (!isset($job['helper_start']) |
} else if (!isset($job['helper_start']) |
2694 |
|
|| ($job['helper_start'] + 30 < time())) { |
|
|
2707 |
|
|| ($job['helper_start'] + 300 < time())) { |
2695 |
2708 |
// TODO: we should check if pid is still valid? |
// TODO: we should check if pid is still valid? |
2696 |
|
rg_log($jid . ': Waited 30s without the VM to show up!' |
|
|
2709 |
|
rg_log($jid . ': Waited 300s without the VM to show up!' |
2697 |
2710 |
. ' Set state to INIT.'); |
. ' Set state to INIT.'); |
2698 |
2711 |
$job['state'] = RG_JOB_INIT; |
$job['state'] = RG_JOB_INIT; |
2699 |
2712 |
continue; |
continue; |