-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Related Issues Related to #939 Fixes #1137, #1022 ### Backwards compatible replacement of simple `scripts` with complex `actions` - [x] Define types - [x] `package create` transparent migration - [x] `package deploy` transparent migration - [x] Introduce deprecation pattern into `src/pkg/packager` - [x] Package`Create` actions: `Before`, `After`, `Success`, `Failure` - [x] Package`Deploy` actions: `Before`, `After`, `Success`, `Failure` - [x] Package`Remove` actions: `Before`, `After`, `Success`, `Failure` ### Other refactors - [x] Expand exec to support env variables, add config struct - [x] Add common cmd defaults - [x] Add set working dir support - [x] Inject deploy-time variables as env variables for `onDeploy` - [x] Expand sha256sum function to support any generic crypto hash type Co-authored-by: Wayne Starr <[email protected]> Co-authored-by: Jon Perry <[email protected]>
- Loading branch information
1 parent
3cca81a
commit f83dc63
Showing
65 changed files
with
2,517 additions
and
660 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# 9. YOLO Mode | ||
# 10. YOLO Mode | ||
|
||
Date: 2022-12-14 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# 11. Scripts -> Actions | ||
|
||
Date: 2023-01-18 | ||
|
||
## Status | ||
|
||
Accepted | ||
|
||
## Context | ||
|
||
Originally, the `scripts` noun was added to components to allow us to move hard-coded init business logic out of the codebase and into the package system. At the time there was only a `before` and `after` section with simply an array entry per command. Later, `prepare` was added as a way to do something during `zarf package create`. As teams began to find new ways to use the capabilities, their limitations became more obvious. | ||
|
||
## Decision | ||
|
||
The `scripts` section of the `zarf.yaml` will be replaced with a new `actions` section. The `actions` section will be a map of action names to a list of commands to run. `actions` will contain `action sets` that map to the following lifecycle events: | ||
|
||
- `onCreate` - Runs during `zarf package create` | ||
- `onDeploy` - Runs during `zarf package deploy` | ||
- `onRemove` - Runs during `zarf package remove` | ||
|
||
In addition to adding more lifecycle events, the `actions` section will also allow for more complex actions to be defined. New configurations include, setting the cmd directory, defining custom env variables, setting the number of retries, setting the max total seconds, muting the output, and [setting a variable](../docs/4-user-guide/5-component-actions.md#creating-dynamic-variables-from-actions) to be used in other actions or components. | ||
|
||
Further details can be found in the `component-actions` [component actions documentation](../docs/4-user-guide/7-github-action.md), [component lifecycle documentation](../docs/4-user-guide/4-package-command-lifecycle.md), and the [example package](../examples/component-actions/README.md). | ||
|
||
## Consequences | ||
|
||
With the current team agreement to not introduce breaking changes as we stabilize the API, a deprecation model was introduced that allows existing Zarf binaries to run with older `zarf.yaml` configs while also allowing the new features to be used by those who have updated their Zarf binary. |
Oops, something went wrong.