mirror of
https://github.com/go-gitea/gitea.git
synced 2026-05-23 05:42:33 +09:00
## Fixes #36983 ## Summary 1. Add transitional `Cancelling` status (between `Running` and `Cancelled`); cancel flow marks active tasks `Cancelling`, runner finalizes to `Cancelled` on terminal result. 2. Taskless jobs cancel directly (no runner to finalize). 3. Runner-protocol responses map `Cancelling` → `RESULT_CANCELLED`. 4. Run/job aggregation treats `Cancelling` as active. 5. Status mapping/aggregation tests + en-US locale added. **Problem** When a workflow was cancelled from the UI, jobs were marked cancelled immediately, which could skip post-run cleanup behavior. ## Solution Use a transitional status path: Running → Cancelling → Cancelled This allows runner finalization and cleanup path execution before final terminal state. **Testing** > 1. go test -tags "sqlite sqlite_unlock_notify" ./models/actions -run "TestAggregateJobStatus|TestStatusAsResult|TestStatusFromResult" > 2. go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.11.4 run ./models/actions/... ./routers/api/actions/runner/... ## Related - act_runner: https://gitea.com/gitea/act_runner/pulls/825 — independent; this PR's capability gate keeps legacy runners on the immediate-cancel path. The new flow activates only for runners that advertise the `cancelling` capability. Co-authored-by: Nicolas <bircni@icloud.com> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Claude (Opus 4.7) <noreply@anthropic.com> Co-authored-by: Zettat123 <zettat123@gmail.com> Co-authored-by: Giteabot <teabot@gitea.io>
73 lines
1.6 KiB
TypeScript
73 lines
1.6 KiB
TypeScript
// see "models/actions/status.go", if it needs to be used somewhere else, move it to a shared file like "types/actions.ts"
|
|
export type ActionsStatus = 'unknown' | 'waiting' | 'running' | 'cancelling' | 'success' | 'failure' | 'cancelled' | 'skipped' | 'blocked';
|
|
export type ActionsArtifactStatus = 'expired' | 'completed';
|
|
|
|
export type ActionsRun = {
|
|
repoId: number,
|
|
link: string,
|
|
viewLink: string,
|
|
title: string,
|
|
titleHTML: string,
|
|
status: ActionsStatus,
|
|
canCancel: boolean,
|
|
canApprove: boolean,
|
|
canRerun: boolean,
|
|
canRerunFailed: boolean,
|
|
canDeleteArtifact: boolean,
|
|
done: boolean,
|
|
workflowID: string,
|
|
workflowLink: string,
|
|
isSchedule: boolean,
|
|
runAttempt: number,
|
|
attempts: Array<ActionsRunAttempt>,
|
|
duration: string,
|
|
triggeredAt: number,
|
|
triggerEvent: string,
|
|
jobs: Array<ActionsJob>,
|
|
commit: {
|
|
localeCommit: string,
|
|
localePushedBy: string,
|
|
shortSHA: string,
|
|
link: string,
|
|
pusher: {
|
|
displayName: string,
|
|
link: string,
|
|
},
|
|
branch: {
|
|
name: string,
|
|
link: string,
|
|
isDeleted: boolean,
|
|
},
|
|
},
|
|
};
|
|
|
|
export type ActionsRunAttempt = {
|
|
attempt: number;
|
|
status: ActionsStatus;
|
|
done: boolean;
|
|
link: string;
|
|
current: boolean;
|
|
latest: boolean;
|
|
triggeredAt: number;
|
|
triggerUserName: string;
|
|
triggerUserLink: string;
|
|
};
|
|
|
|
export type ActionsJob = {
|
|
id: number;
|
|
link: string;
|
|
jobId: string;
|
|
name: string;
|
|
status: ActionsStatus;
|
|
canRerun: boolean;
|
|
needs?: string[];
|
|
duration: string;
|
|
};
|
|
|
|
export type ActionsArtifact = {
|
|
name: string;
|
|
size: number;
|
|
status: ActionsArtifactStatus;
|
|
expiresUnix: number;
|
|
};
|