You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This feature allows a Task author to specify a Step timeout in a
Taskrun.
An example use case is when a Task author would like to execute a
Step for setting up an execution environment. One may expect this
Step to execute within a few seconds. If the execution time takes
longer than expected one may rather want to fail fast than wait
for the TaskRun timeout to abort the TaskRun.
Closes#1690
Copy file name to clipboardexpand all lines: docs/tasks.md
+17
Original file line number
Diff line number
Diff line change
@@ -241,7 +241,24 @@ steps:
241
241
#!/usr/bin/env bash
242
242
/bin/my-binary
243
243
```
244
+
#### Specifying a timeout
244
245
246
+
A step can specify a `timeout` field. If the `Step` execution time exceeds the specified timeout, the `Step` and consequently the entire `TaskRun` is canceled.
247
+
An accompanying error message is output under `status.conditions.message`.
248
+
249
+
The format for a timeout is a duration string as specified in the [Go time package](https://golang.org/src/time/format.go?s=40541:40587#L1364) (e.g. 1s or 1ms).
250
+
251
+
The example `Step` below is supposed to sleep for 60 seconds but will be canceled by the specified 5 second timeout.
252
+
```yaml
253
+
steps:
254
+
- name: willTimeout
255
+
image: ubuntu
256
+
script: |
257
+
#!/usr/bin/env bash
258
+
echo "I am supposed to sleep for 60 seconds!"
259
+
sleep 60
260
+
timeout: 5s
261
+
```
245
262
### Specifying `Parameters`
246
263
247
264
You can specify parameters, such as compilation flags or artifact names, that you want to supply to the `Task` at execution time.
0 commit comments