feat(deploy): commit-status reporting to Git providers

Report deploy status back to the Git provider as a commit status
(pending/success/failure) for git-sourced workloads (static + dockerfile).

- GitProvider.SetCommitStatus on gitea/github/gitlab over the existing
  SSRF-safe client; fixed "tinyforge" context so redeploys update one row.
  postJSON returns status-code-only errors (never echoes the upstream body,
  which a hostile provider could use to reflect the auth token into the
  best-effort log line).
- Best-effort deploy hook: pending on deploy start, success/failure on
  outcome, gated on a per-workload report_commit_status flag. Never fails or
  blocks a deploy; emits nothing on the unchanged-SHA short-circuit.
- UI ToggleSwitch (create + edit) + reportCommitStatus in sourceForms.ts
  + en/ru i18n.
- Tests: per-provider state mapping + request shape; reporter gating
  (enabled/disabled/empty-SHA/nil/error-swallow).

Reviewed via go-reviewer + security-reviewer (0 CRITICAL/HIGH; one MEDIUM
body-echo log-leak fixed).
This commit is contained in:
2026-05-29 11:37:56 +03:00
parent 410a131cec
commit 3071cda512
17 changed files with 1051 additions and 10 deletions
@@ -14,6 +14,7 @@
<script lang="ts">
import type { DockerfileFormState } from '$lib/workload/sourceForms';
import StaticDiscoveryWizard from '$lib/components/workload/StaticDiscoveryWizard.svelte';
import ToggleSwitch from '$lib/components/ToggleSwitch.svelte';
import { IconX } from '$lib/components/icons';
import { t } from '$lib/i18n';
@@ -136,6 +137,16 @@
<span>{$t('apps.new.dockerfilePortRequired')}</span>
</div>
{/if}
<label class="toggle-row">
<ToggleSwitch
bind:checked={form.reportCommitStatus}
label={$t('apps.new.sourceReportCommitStatus')}
/>
<span>
<strong>{$t('apps.new.sourceReportCommitStatus')}</strong>
{@html $t('apps.new.sourceReportCommitStatusDesc')}
</span>
</label>
<p class="hint image-form-foot">{$t('apps.new.dockerfileFoot')}</p>
</div>
@@ -165,6 +176,22 @@
margin: 0;
line-height: 1.45;
}
/* ── Commit-status toggle row (mirrors the static source form) ── */
.toggle-row {
display: flex;
align-items: flex-start;
gap: 0.55rem;
padding: 0.35rem 0;
font-size: 0.88rem;
color: var(--text-secondary);
cursor: pointer;
}
.toggle-row strong {
color: var(--text-primary);
}
.toggle-row :global(.toggle-switch) {
margin-top: 0.1rem;
}
.row {
display: grid;
grid-template-columns: 1fr 1fr;