-
Notifications
You must be signed in to change notification settings - Fork 273
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
* 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 <[email protected]>
- Loading branch information
1 parent
5546b56
commit 9a1023e
Showing
4 changed files
with
59 additions
and
7 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
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 ] |
19 changes: 19 additions & 0 deletions
19
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,19 @@ | ||
kind: Run | ||
name: run-script | ||
type: exec | ||
var: | ||
foo: bar | ||
disabled: "${var.foo == 'bar'}" | ||
spec: | ||
command: ["sh", "-c", "echo 'Hello from local'"] | ||
|
||
--- | ||
|
||
kind: Run | ||
name: run-script | ||
type: exec | ||
var: | ||
foo: bar | ||
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