1
0
mirror of git://f0xx.org/ac/ac-be-builder synced 2026-08-12 18:12:50 +03:00

Builder: monotonic OTA versions, duration UI, OTA publish fixes.

VersionAllocator for AA.BB.CC.DDDD, build elapsed display, branded QR alerts, shared cache env, and auto_deploy when auto_ota is set.
This commit is contained in:
Anton Afanasyeu
2026-08-12 14:08:12 +02:00
parent ef6718a5f2
commit e8039aab78
12 changed files with 548 additions and 21 deletions

View File

@@ -1,4 +1,5 @@
<?php declare(strict_types=1);
$build = BuildDuration::annotate($build);
$artifacts = json_decode($build['artifacts_json'] ?? '{}', true) ?: [];
$params = json_decode($build['params_json'] ?? '{}', true) ?: [];
$status = (string) ($build['status'] ?? '');
@@ -24,6 +25,15 @@ $stepLabels = [
<p class="muted build-status-line" id="build-status-line">
<span id="build-status-icon"><?= build_status_icon($status) ?></span>
<span id="build-status-text">Status: <strong><?= h($status) ?></strong> · Phase: <?= h($phase) ?>
<?php if (($build['duration_label'] ?? '—') !== '—'): ?>
· <span id="build-duration-label" data-duration-kind="<?= h((string) ($build['duration_kind'] ?? '')) ?>"><?php
$dk = (string) ($build['duration_kind'] ?? '');
if ($dk === 'elapsed'): ?>Running for <?= h($build['duration_label']) ?><?php
elseif ($dk === 'final'): ?>Took <?= h($build['duration_label']) ?><?php
else: ?><?= h($build['duration_label']) ?><?php endif; ?></span>
<?php else: ?>
· <span id="build-duration-label" data-duration-kind="none" hidden></span>
<?php endif; ?>
<?php if (!empty($build['error_message'])): ?>
· <span class="error-text" id="build-error-message"><?= h($build['error_message']) ?></span>
<?php endif; ?>
@@ -94,6 +104,18 @@ docker exec -it <?= h($sshContainer) ?> bash</pre>
<dt>Git SHA</dt><dd><code><?= h($build['git_sha'] ?? '—') ?></code></dd>
<dt>OTA channel</dt><dd><?= h($build['ota_channel'] ?? '—') ?></dd>
<dt>Gradle task</dt><dd><code><?= h($params['gradle_task'] ?? '—') ?></code></dd>
<dt>Started</dt><dd><?= h($build['started_at'] ?? '—') ?> UTC</dd>
<dt>Finished</dt><dd><?= h($build['finished_at'] ?? '—') ?> UTC</dd>
<dt>Duration</dt><dd id="build-duration-detail"><?php
$dk = (string) ($build['duration_kind'] ?? '');
if ($dk === 'elapsed') {
echo 'Running for ' . h($build['duration_label']);
} elseif ($dk === 'final') {
echo h($build['duration_label']);
} else {
echo h($build['duration_label']);
}
?></dd>
</dl>
</div>

View File

@@ -7,6 +7,7 @@
<ul id="build-health-list">
<li>Docker: <strong id="build-health-docker"><?= h($health['docker'] ?? 'unknown') ?></strong></li>
<li>CI image version: <code><?= h($health['ci_version'] ?? '') ?></code></li>
<li>Next build version: <code id="build-next-version"><?= h($health['next_version'] ?? '') ?></code> <span class="muted">(build # auto-increments)</span></li>
<li>Running builds: <span id="build-health-running"><?= (int) ($health['running'] ?? 0) ?></span></li>
<li>Passed (7d): <?= (int) ($health['passed_7d'] ?? 0) ?> · Failed (7d): <?= (int) ($health['failed_7d'] ?? 0) ?></li>
</ul>
@@ -25,12 +26,18 @@
<option value="stable">stable / prod</option>
</select></label>
</div>
<fieldset class="build-form-grid" style="margin-top:10px;border:none;padding:0">
<legend class="muted" style="margin-bottom:6px">Version (AA.BB.CC.DDDD — build counter is automatic)</legend>
<label>Major (AA)<input name="ota_major" type="number" min="0" max="99" placeholder="auto" title="Leave empty for pipeline default"></label>
<label>Minor (BB)<input name="ota_minor" type="number" min="0" max="99" placeholder="auto"></label>
<label>Patch (CC)<input name="ota_patch" type="number" min="0" max="99" placeholder="auto"></label>
</fieldset>
<div class="build-form-checks">
<label><input type="checkbox" name="run_tests" checked> Unit tests</label>
<label><input type="checkbox" name="run_native" checked> Native codecs</label>
<label><input type="checkbox" name="run_apk" checked> APK output</label>
<label><input type="checkbox" name="auto_ota"> Create OTA artifacts</label>
<label><input type="checkbox" name="auto_deploy"> Publish OTA to mount</label>
<label><input type="checkbox" name="auto_ota" id="build-auto-ota"> Create OTA artifacts &amp; publish</label>
<input type="hidden" name="auto_deploy" value="0">
</div>
<div class="build-form-grid" style="margin-top:10px">
<label><input type="checkbox" name="notify_on_fail" checked> Alert me if this build fails</label>
@@ -57,6 +64,7 @@
<th>Phase</th>
<th>Branch/ref</th>
<th>Channel</th>
<th>Duration</th>
<th>Created</th>
</tr>
</thead>
@@ -82,6 +90,7 @@
<td class="build-phase-cell" data-build-phase-cell="<?= (int) $b['id'] ?>"><?= h($b['phase']) ?></td>
<td><?= h($b['git_ref'] ?? $b['branch'] ?? '—') ?></td>
<td><?= h($b['ota_channel'] ?? '—') ?></td>
<td class="build-duration-cell" data-build-id="<?= (int) $b['id'] ?>" data-duration-kind="<?= h((string) ($b['duration_kind'] ?? '')) ?>" data-duration-started="<?= h((string) ($b['duration_started_at'] ?? '')) ?>"><?= h($b['duration_label'] ?? '—') ?></td>
<td><?= h($b['created_at'] ?? '') ?></td>
</tr>
<?php endforeach; ?>

View File

@@ -29,7 +29,10 @@ $navUser = is_array($user) ? trim((string) ($user['username'] ?? '')) : '';
<body data-base-path="<?= h(Auth::basePath()) ?>"
data-view="<?= h($view ?? 'home') ?>"
<?= (($view ?? '') === 'build' && !empty($build['id'])) ? ' data-build-id="' . (int) $build['id'] . '"' : '' ?>
<?= (($view ?? '') === 'build' && !empty($build['status'])) ? ' data-build-status="' . h((string) $build['status']) . '"' : '' ?>>
<?= (($view ?? '') === 'build' && !empty($build['status'])) ? ' data-build-status="' . h((string) $build['status']) . '"' : '' ?>
<?= (($view ?? '') === 'build' && !empty($build['duration_started_at'])) ? ' data-build-started-at="' . h((string) $build['duration_started_at']) . '"' : '' ?>
<?= (($view ?? '') === 'build' && !empty($build['duration_finished_at'])) ? ' data-build-finished-at="' . h((string) $build['duration_finished_at']) . '"' : '' ?>
<?= (($view ?? '') === 'build' && !empty($build['duration_kind'])) ? ' data-duration-kind="' . h((string) $build['duration_kind']) . '"' : '' ?>>
<div class="shell">
<?php platform_render_nav_shell([
'project_base' => $projectBase,