Timeout Strategy
About 305 wordsAbout 1 min
In Cloud Native Build, each pipeline or job has a maximum execution time. If exceeded, it will automatically terminate.
Pipeline Timeout
The maximum execution time for a pipeline is 20 hours. After 20 hours, the pipeline container will be automatically destroyed.
Job Timeout
A job can customize its timeout by declaring timeout. If not declared, the following default values apply.
For agent tasks such as
npc:go,timeoutapplies to each tool execution (e.g., bash commands) rather than the entire agent session; the overall session duration is still bound by the pipeline timeout. Seenpc:goTimeout for details.
No Output Timeout
If a Job has no output for 10 minutes continuously, a timeout will be triggered. If timeout is declared, the no-output timeout matches the configured value.
Maximum Timeout Duration
A Job defaults to a maximum execution of 2 hours. If timeout is declared, that value is used instead, up to a maximum of 12 hours.
Configuration Example
The following example triggers a pipeline on the push event and sets the timeout of a job to 30 minutes:
main:
push:
- stages:
- name: build
image: node:20
script: |
npm install
npm run build
timeout: 30m # This job runs for at most 30 minutesAfter declaring timeout, this job:
- triggers a no-output timeout after 30 minutes of inactivity (replacing the default 10 minutes);
- runs for at most 30 minutes and then terminates automatically.
timeoutsupports units such asms,s,m, andh. See grammar for more details.