Skip to content

Commit

Permalink
Add a tip about hooks to docs
Browse files Browse the repository at this point in the history
Signed-off-by: peterdeme <[email protected]>
  • Loading branch information
peterdeme committed Sep 26, 2023
1 parent 9f8dd12 commit 06d68b6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/concepts/stack/stack-settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ Note here that all hooks, including the `after_run` ones, execute on the worker.

These commands may serve one of two general purposes - either to make some modifications to your workspace (eg. set up symlinks, move files around etc.) or perhaps to run validations using something like [`tfsec`](https://github.com/tfsec/tfsec){: rel="nofollow"}, [`tflint`](https://github.com/terraform-linters/tflint){: rel="nofollow"} or `terraform fmt`.

!!! tip
We don’t recommend using newlines (`\n`) in hooks. The reason is that we are chaining the Spacelift commands (eg. `terraform plan`) commands with pre/post hooks with double ampersand (`&&`) and using commands separated by newlines can cause a non-zero exit code by a command to be hidden if the last command in the newline-separated block succeeds.
If you'd like to run multiple commands in a hook, add multiple hooks instead.

!!! danger
When a run resumes after having been paused for any reason (e.g., confirmation, approval policy), the remaining phases are run in a new container. As a result, any tool installed in a phase that occurred before the pause won't be available in the subsequent phases. A better way to achieve this would be to bake the tool into a [custom runner image](../../integrations/docker.md#customizing-the-runner-image).

Expand Down

0 comments on commit 06d68b6

Please sign in to comment.