Skip to content

Commit e23fbbb

Browse files
author
Mrunal Patel
committed
Merge pull request #346 from crosbymichael/hook-timeout
Add timeout field to hooks
2 parents 7aeccd7 + 5a3b181 commit e23fbbb

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

config.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ If a hook returns a non-zero exit code, then an error is logged and the remainin
226226
"poststart": [
227227
{
228228
"path": "/usr/bin/notify-start"
229+
"timeout": 5
229230
}
230231
],
231232
"poststop": [
@@ -239,6 +240,7 @@ If a hook returns a non-zero exit code, then an error is logged and the remainin
239240

240241
`path` is required for a hook.
241242
`args` and `env` are optional.
243+
`timeout` is the number of seconds before aborting the hook.
242244
The semantics are the same as `Path`, `Args` and `Env` in [golang Cmd](https://golang.org/pkg/os/exec/#Cmd).
243245

244246
## Annotations

specs-go/config.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,10 @@ type Mount struct {
9696

9797
// Hook specifies a command that is run at a particular event in the lifecycle of a container
9898
type Hook struct {
99-
Path string `json:"path"`
100-
Args []string `json:"args,omitempty"`
101-
Env []string `json:"env,omitempty"`
99+
Path string `json:"path"`
100+
Args []string `json:"args,omitempty"`
101+
Env []string `json:"env,omitempty"`
102+
Timeout *int `json:"timeout,omitempty"`
102103
}
103104

104105
// Hooks for container setup and teardown

0 commit comments

Comments
 (0)