Skip to content

Commit 82f6029

Browse files
authored
docs: document defer task options (#1907)
1 parent cfaecf8 commit 82f6029

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

website/docs/changelog.mdx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ sidebar_position: 14
55

66
# Changelog
77

8+
## Unreleased
9+
10+
- Document deferred tasks in the schema reference and fix an error in the JSON
11+
schema for such tasks (#1907 by @mjpieters).
12+
813
## v3.40.1 - 2024-12-06
914

1015
- Fixed a security issue in `git-urls` by switching to the maintained fork `chainguard-dev/git-urls` (#1917 by

website/docs/reference/schema.mdx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ tasks:
140140
| `silent` | `bool` | `false` | Skips some output for this command. Note that STDOUT and STDERR of the commands will still be redirected. |
141141
| `vars` | [`map[string]Variable`](#variable) | | Optional additional variables to be passed to the referenced task. Only relevant when setting `task` instead of `cmd`. |
142142
| `ignore_error` | `bool` | `false` | Continue execution if errors happen while executing the command. |
143-
| `defer` | `string` | | Alternative to `cmd`, but schedules the command to be executed at the end of this task instead of immediately. This cannot be used together with `cmd`. |
143+
| `defer` | [`Defer`](#defer) | | Alternative to `cmd`, but schedules the command or a task to be executed at the end of this task instead of immediately. This cannot be used together with `cmd`. |
144144
| `platforms` | `[]string` | All platforms | Specifies which platforms the command should be run on. [Valid GOOS and GOARCH values allowed](https://github.com/golang/go/blob/master/src/internal/syslist/syslist.go). Command will be skipped otherwise. |
145145
| `set` | `[]string` | | Specify options for the [`set` builtin](https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html). |
146146
| `shopt` | `[]string` | | Specify option for the [`shopt` builtin](https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html). |
@@ -180,6 +180,17 @@ tasks:
180180

181181
:::
182182

183+
### Defer
184+
185+
The `defer` parameter defines a shell command to run, or a task to trigger, at the end of the current task instead of immediately.
186+
If defined as a string this is a shell command, otherwise it is a map defining a task to call:
187+
188+
| Attribute | Type | Default | Description |
189+
| --------- | ---------------------------------- | ------- | ----------------------------------------------------------------- |
190+
| `task` | `string` | | The deferred task to trigger. |
191+
| `vars` | [`map[string]Variable`](#variable) | | Optional additional variables to be passed to the deferred task. |
192+
| `silent` | `bool` | `false` | Hides task name and command from output. The command's output will still be redirected to `STDOUT` and `STDERR`. |
193+
183194
### For
184195

185196
The `for` parameter can be defined as a string, a list of strings or a map. If

website/static/schema.json

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -360,14 +360,7 @@
360360
"type": "string"
361361
},
362362
{
363-
"type": "object",
364-
"properties": {
365-
"task": {
366-
"description": "Name of the task to defer",
367-
"type": "string"
368-
}
369-
},
370-
"additionalProperties": false
363+
"$ref": "#/definitions/task_call"
371364
}
372365
]
373366
}

0 commit comments

Comments
 (0)