-
Notifications
You must be signed in to change notification settings - Fork 274
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(template): avoid premature
disabled
flag evaluation on actions (#…
…6448) * fix(template): avoid premature `disabled` flag evaluation on actions * Do early `disabled` flag evaluation only for actions with duplicate names. * Deny the usage of `var` and `variables` contexts in early `disabled` flag evaluation. The contexts `var` and `variables` contexts are not fully resolved at that stage. That can lead to incorrectly resolved `disabled` flag values. Co-authored-by: Steffen Neubauer <steffen@garden.io> * refactor: narrow config type in `ActionConfigContextParams` It can never be `WorkflowConfig`. * test: amend the test data * test: fix assertions * fix: denied contexts definition Co-authored-by: Steffen Neubauer <steffen@garden.io> * test: update test assertion Co-authored-by: Steffen Neubauer <steffen@garden.io> --------- Co-authored-by: Steffen Neubauer <steffen@garden.io>
- Loading branch information
1 parent
586d841
commit c0e9065
Showing
5 changed files
with
59 additions
and
11 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
10 changes: 10 additions & 0 deletions
10
core/test/data/test-projects/disabled-action-with-var-context/project.garden.yml
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,10 @@ | ||
apiVersion: garden.io/v1 | ||
kind: Project | ||
name: disabled-action-with-var-context | ||
defaultEnvironment: local | ||
environments: | ||
- name: local | ||
- name: remote | ||
providers: | ||
- name: exec | ||
environments: [ local, remote ] |
18 changes: 18 additions & 0 deletions
18
core/test/data/test-projects/disabled-action-with-var-context/runs.garden.yml
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,18 @@ | ||
kind: Run | ||
name: run-script | ||
type: exec | ||
var: | ||
foo: bar | ||
spec: | ||
command: ["sh", "-c", "echo 'Hello from local'"] | ||
|
||
--- | ||
|
||
kind: Run | ||
name: run-script | ||
type: exec | ||
var: | ||
$merge: ${actions.run["run-script"].var} | ||
disabled: "${var.foo != 'bar'}" | ||
spec: | ||
command: ["sh", "-c", "echo 'Hello from remote'"] |
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