For the complete documentation index, see llms.txt. This page is also available as Markdown.

Timeout

Set a maximum run time for a stage or step. Harness terminates it if it exceeds the timeout duration.

Timeout duration sets the maximum time a stage or step is allowed to run. If it is still running when the timeout expires, Harness terminates it and marks it as Expired. The default for stages is 24h.

What you will learn

  • How to set a maximum run time for a stage or step using the timeout key

  • What duration formats are accepted

  • How a timed-out stage is marked and how to handle timeouts using on-failure rules


YAML

Use the timeout key on the stage:

stages:
  - name: build
    id: build
    timeout: 30m
    steps:
      - name: compile
        id: compile
        run:
          script: make build

Duration format

Format
Example
Equivalent

Seconds

90s

1 minute 30 seconds

Minutes

30m

30 minutes

Hours

2h

2 hours

Days

1d

24 hours

Combined

1h 30m

1 hour 30 minutes


Behavior

  • When a stage times out, it is marked as Expired and the pipeline is stopped.

  • You can configure On failure with errors: [timeout] to handle timeouts specifically, for example to retry the stage.

  • Individual steps can also have their own timeouts. If a step times out before the stage timeout is reached, the step expires first.

Set timeouts conservatively. A stage with no timeout (or 24h) can hold up the pipeline for a full day if it hangs on a network call or a waiting step.


Next steps

Last updated

Was this helpful?