Skip to content

Commit

Permalink
feat: allow disabling result caching for tasks that support it
Browse files Browse the repository at this point in the history
  • Loading branch information
edvald committed Feb 17, 2020
1 parent da87fd1 commit 1d58eb8
Show file tree
Hide file tree
Showing 33 changed files with 774 additions and 293 deletions.
45 changes: 27 additions & 18 deletions docs/module-types/container.md
Original file line number Diff line number Diff line change
Expand Up @@ -358,17 +358,17 @@ tasks:
# task is executed.
dependencies: []

# Set this to `true` to disable the task. You can use this with conditional template strings to
# enable/disable tasks based on, for example, the current environment or other variables (e.g.
# `enabled: \${environment.name != "prod"}`). This can be handy when you only want certain tasks to run in
# specific environments, e.g. only for development.
# Set this to `true` to disable the task. You can use this with conditional template strings to enable/disable
# tasks based on, for example, the current environment or other variables (e.g. `enabled: \${environment.name !=
# "prod"}`). This can be handy when you only want certain tasks to run in specific environments, e.g. only for
# development.
#
# Disabling a task means that it will not be run, and will also be ignored if it is declared as a
# runtime dependency for another service, test or task.
# Disabling a task means that it will not be run, and will also be ignored if it is declared as a runtime
# dependency for another service, test or task.
#
# Note however that template strings referencing the task's outputs (i.e. runtime outputs) will fail to
# resolve when the task is disabled, so you need to make sure to provide alternate values for those if
# you're using them, using conditional expressions.
# Note however that template strings referencing the task's outputs (i.e. runtime outputs) will fail to resolve
# when the task is disabled, so you need to make sure to provide alternate values for those if you're using them,
# using conditional expressions.
disabled: false

# Maximum duration (in seconds) of the task's execution.
Expand All @@ -387,6 +387,11 @@ tasks:
# A POSIX-style path to copy the artifacts to, relative to the project artifacts directory.
target: .

# Set to false if you don't want the task's result to be cached. Use this if the task needs to be run any time
# your project (or one or more of the task's dependants) is deployed. Otherwise the task is only re-run when its
# version changes (i.e. the module or one of its dependencies is modified), or when you run `garden run task`.
cacheResult: true

# The command/entrypoint used to run the task inside the container.
command:

Expand Down Expand Up @@ -1445,17 +1450,11 @@ The names of any tasks that must be executed, and the names of any services that

[tasks](#tasks) > disabled

Set this to `true` to disable the task. You can use this with conditional template strings to
enable/disable tasks based on, for example, the current environment or other variables (e.g.
`enabled: \${environment.name != "prod"}`). This can be handy when you only want certain tasks to run in
specific environments, e.g. only for development.
Set this to `true` to disable the task. You can use this with conditional template strings to enable/disable tasks based on, for example, the current environment or other variables (e.g. `enabled: \${environment.name != "prod"}`). This can be handy when you only want certain tasks to run in specific environments, e.g. only for development.

Disabling a task means that it will not be run, and will also be ignored if it is declared as a
runtime dependency for another service, test or task.
Disabling a task means that it will not be run, and will also be ignored if it is declared as a runtime dependency for another service, test or task.

Note however that template strings referencing the task's outputs (i.e. runtime outputs) will fail to
resolve when the task is disabled, so you need to make sure to provide alternate values for those if
you're using them, using conditional expressions.
Note however that template strings referencing the task's outputs (i.e. runtime outputs) will fail to resolve when the task is disabled, so you need to make sure to provide alternate values for those if you're using them, using conditional expressions.

| Type | Default | Required |
| --------- | ------- | -------- |
Expand Down Expand Up @@ -1547,6 +1546,16 @@ tasks:
- target: "outputs/foo/"
```

### `tasks[].cacheResult`

[tasks](#tasks) > cacheResult

Set to false if you don't want the task's result to be cached. Use this if the task needs to be run any time your project (or one or more of the task's dependants) is deployed. Otherwise the task is only re-run when its version changes (i.e. the module or one of its dependencies is modified), or when you run `garden run task`.

| Type | Default | Required |
| --------- | ------- | -------- |
| `boolean` | `true` | No |

### `tasks[].command[]`

[tasks](#tasks) > command
Expand Down
30 changes: 12 additions & 18 deletions docs/module-types/exec.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,17 +138,17 @@ tasks:
# task is executed.
dependencies: []

# Set this to `true` to disable the task. You can use this with conditional template strings to
# enable/disable tasks based on, for example, the current environment or other variables (e.g.
# `enabled: \${environment.name != "prod"}`). This can be handy when you only want certain tasks to run in
# specific environments, e.g. only for development.
# Set this to `true` to disable the task. You can use this with conditional template strings to enable/disable
# tasks based on, for example, the current environment or other variables (e.g. `enabled: \${environment.name !=
# "prod"}`). This can be handy when you only want certain tasks to run in specific environments, e.g. only for
# development.
#
# Disabling a task means that it will not be run, and will also be ignored if it is declared as a
# runtime dependency for another service, test or task.
# Disabling a task means that it will not be run, and will also be ignored if it is declared as a runtime
# dependency for another service, test or task.
#
# Note however that template strings referencing the task's outputs (i.e. runtime outputs) will fail to
# resolve when the task is disabled, so you need to make sure to provide alternate values for those if
# you're using them, using conditional expressions.
# Note however that template strings referencing the task's outputs (i.e. runtime outputs) will fail to resolve
# when the task is disabled, so you need to make sure to provide alternate values for those if you're using them,
# using conditional expressions.
disabled: false

# Maximum duration (in seconds) of the task's execution.
Expand Down Expand Up @@ -491,17 +491,11 @@ The names of any tasks that must be executed, and the names of any services that

[tasks](#tasks) > disabled

Set this to `true` to disable the task. You can use this with conditional template strings to
enable/disable tasks based on, for example, the current environment or other variables (e.g.
`enabled: \${environment.name != "prod"}`). This can be handy when you only want certain tasks to run in
specific environments, e.g. only for development.
Set this to `true` to disable the task. You can use this with conditional template strings to enable/disable tasks based on, for example, the current environment or other variables (e.g. `enabled: \${environment.name != "prod"}`). This can be handy when you only want certain tasks to run in specific environments, e.g. only for development.

Disabling a task means that it will not be run, and will also be ignored if it is declared as a
runtime dependency for another service, test or task.
Disabling a task means that it will not be run, and will also be ignored if it is declared as a runtime dependency for another service, test or task.

Note however that template strings referencing the task's outputs (i.e. runtime outputs) will fail to
resolve when the task is disabled, so you need to make sure to provide alternate values for those if
you're using them, using conditional expressions.
Note however that template strings referencing the task's outputs (i.e. runtime outputs) will fail to resolve when the task is disabled, so you need to make sure to provide alternate values for those if you're using them, using conditional expressions.

| Type | Default | Required |
| --------- | ------- | -------- |
Expand Down
45 changes: 27 additions & 18 deletions docs/module-types/helm.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,22 +181,27 @@ tasks:
# task is executed.
dependencies: []

# Set this to `true` to disable the task. You can use this with conditional template strings to
# enable/disable tasks based on, for example, the current environment or other variables (e.g.
# `enabled: \${environment.name != "prod"}`). This can be handy when you only want certain tasks to run in
# specific environments, e.g. only for development.
# Set this to `true` to disable the task. You can use this with conditional template strings to enable/disable
# tasks based on, for example, the current environment or other variables (e.g. `enabled: \${environment.name !=
# "prod"}`). This can be handy when you only want certain tasks to run in specific environments, e.g. only for
# development.
#
# Disabling a task means that it will not be run, and will also be ignored if it is declared as a
# runtime dependency for another service, test or task.
# Disabling a task means that it will not be run, and will also be ignored if it is declared as a runtime
# dependency for another service, test or task.
#
# Note however that template strings referencing the task's outputs (i.e. runtime outputs) will fail to
# resolve when the task is disabled, so you need to make sure to provide alternate values for those if
# you're using them, using conditional expressions.
# Note however that template strings referencing the task's outputs (i.e. runtime outputs) will fail to resolve
# when the task is disabled, so you need to make sure to provide alternate values for those if you're using them,
# using conditional expressions.
disabled: false

# Maximum duration (in seconds) of the task's execution.
timeout: null

# Set to false if you don't want the task's result to be cached. Use this if the task needs to be run any time
# your project (or one or more of the task's dependants) is deployed. Otherwise the task is only re-run when its
# version changes (i.e. the module or one of its dependencies is modified), or when you run `garden run task`.
cacheResult: true

# The command/entrypoint used to run the task inside the container.
command:

Expand Down Expand Up @@ -731,17 +736,11 @@ The names of any tasks that must be executed, and the names of any services that

[tasks](#tasks) > disabled

Set this to `true` to disable the task. You can use this with conditional template strings to
enable/disable tasks based on, for example, the current environment or other variables (e.g.
`enabled: \${environment.name != "prod"}`). This can be handy when you only want certain tasks to run in
specific environments, e.g. only for development.
Set this to `true` to disable the task. You can use this with conditional template strings to enable/disable tasks based on, for example, the current environment or other variables (e.g. `enabled: \${environment.name != "prod"}`). This can be handy when you only want certain tasks to run in specific environments, e.g. only for development.

Disabling a task means that it will not be run, and will also be ignored if it is declared as a
runtime dependency for another service, test or task.
Disabling a task means that it will not be run, and will also be ignored if it is declared as a runtime dependency for another service, test or task.

Note however that template strings referencing the task's outputs (i.e. runtime outputs) will fail to
resolve when the task is disabled, so you need to make sure to provide alternate values for those if
you're using them, using conditional expressions.
Note however that template strings referencing the task's outputs (i.e. runtime outputs) will fail to resolve when the task is disabled, so you need to make sure to provide alternate values for those if you're using them, using conditional expressions.

| Type | Default | Required |
| --------- | ------- | -------- |
Expand All @@ -757,6 +756,16 @@ Maximum duration (in seconds) of the task's execution.
| -------- | ------- | -------- |
| `number` | `null` | No |

### `tasks[].cacheResult`

[tasks](#tasks) > cacheResult

Set to false if you don't want the task's result to be cached. Use this if the task needs to be run any time your project (or one or more of the task's dependants) is deployed. Otherwise the task is only re-run when its version changes (i.e. the module or one of its dependencies is modified), or when you run `garden run task`.

| Type | Default | Required |
| --------- | ------- | -------- |
| `boolean` | `true` | No |

### `tasks[].command[]`

[tasks](#tasks) > command
Expand Down
45 changes: 27 additions & 18 deletions docs/module-types/kubernetes.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,17 +161,17 @@ tasks:
# task is executed.
dependencies: []

# Set this to `true` to disable the task. You can use this with conditional template strings to
# enable/disable tasks based on, for example, the current environment or other variables (e.g.
# `enabled: \${environment.name != "prod"}`). This can be handy when you only want certain tasks to run in
# specific environments, e.g. only for development.
# Set this to `true` to disable the task. You can use this with conditional template strings to enable/disable
# tasks based on, for example, the current environment or other variables (e.g. `enabled: \${environment.name !=
# "prod"}`). This can be handy when you only want certain tasks to run in specific environments, e.g. only for
# development.
#
# Disabling a task means that it will not be run, and will also be ignored if it is declared as a
# runtime dependency for another service, test or task.
# Disabling a task means that it will not be run, and will also be ignored if it is declared as a runtime
# dependency for another service, test or task.
#
# Note however that template strings referencing the task's outputs (i.e. runtime outputs) will fail to
# resolve when the task is disabled, so you need to make sure to provide alternate values for those if
# you're using them, using conditional expressions.
# Note however that template strings referencing the task's outputs (i.e. runtime outputs) will fail to resolve
# when the task is disabled, so you need to make sure to provide alternate values for those if you're using them,
# using conditional expressions.
disabled: false

# Maximum duration (in seconds) of the task's execution.
Expand All @@ -191,6 +191,11 @@ tasks:
# main container is not the first container in the spec.
containerName:

# Set to false if you don't want the task's result to be cached. Use this if the task needs to be run any time
# your project (or one or more of the task's dependants) is deployed. Otherwise the task is only re-run when its
# version changes (i.e. the module or one of its dependencies is modified), or when you run `garden run task`.
cacheResult: true

# The command/entrypoint used to run the task inside the container.
command:

Expand Down Expand Up @@ -606,17 +611,11 @@ The names of any tasks that must be executed, and the names of any services that

[tasks](#tasks) > disabled

Set this to `true` to disable the task. You can use this with conditional template strings to
enable/disable tasks based on, for example, the current environment or other variables (e.g.
`enabled: \${environment.name != "prod"}`). This can be handy when you only want certain tasks to run in
specific environments, e.g. only for development.
Set this to `true` to disable the task. You can use this with conditional template strings to enable/disable tasks based on, for example, the current environment or other variables (e.g. `enabled: \${environment.name != "prod"}`). This can be handy when you only want certain tasks to run in specific environments, e.g. only for development.

Disabling a task means that it will not be run, and will also be ignored if it is declared as a
runtime dependency for another service, test or task.
Disabling a task means that it will not be run, and will also be ignored if it is declared as a runtime dependency for another service, test or task.

Note however that template strings referencing the task's outputs (i.e. runtime outputs) will fail to
resolve when the task is disabled, so you need to make sure to provide alternate values for those if
you're using them, using conditional expressions.
Note however that template strings referencing the task's outputs (i.e. runtime outputs) will fail to resolve when the task is disabled, so you need to make sure to provide alternate values for those if you're using them, using conditional expressions.

| Type | Default | Required |
| --------- | ------- | -------- |
Expand Down Expand Up @@ -672,6 +671,16 @@ The name of a container in the target. Specify this if the target contains more
| -------- | -------- |
| `string` | No |

### `tasks[].cacheResult`

[tasks](#tasks) > cacheResult

Set to false if you don't want the task's result to be cached. Use this if the task needs to be run any time your project (or one or more of the task's dependants) is deployed. Otherwise the task is only re-run when its version changes (i.e. the module or one of its dependencies is modified), or when you run `garden run task`.

| Type | Default | Required |
| --------- | ------- | -------- |
| `boolean` | `true` | No |

### `tasks[].command[]`

[tasks](#tasks) > command
Expand Down
Loading

0 comments on commit 1d58eb8

Please sign in to comment.