-
Notifications
You must be signed in to change notification settings - Fork 267
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: do not fail on empty YAML varfiles (#5759)
**What this PR does / why we need it**: The `js-yaml` parser returns `undefined` instead of an empty object (`{}`) for empty input files. So, we handle empty YAML varfiles as empty variable dictionaries to avoid runtime errors. This PR also converts `module-varfiles` test project to action-based configuration. **Which issue(s) this PR fixes**: Fixes #5741
- Loading branch information
1 parent
ccb0dd7
commit e5732aa
Showing
11 changed files
with
71 additions
and
34 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
File renamed without changes.
2 changes: 2 additions & 0 deletions
2
core/test/data/test-projects/action-varfiles/garden.run-a.default.env
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,2 @@ | ||
c=from-action-varfile | ||
d=from-action-varfile |
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,22 @@ | ||
apiVersion: garden.io/v1 | ||
kind: Project | ||
name: action-varfiles | ||
varfile: garden.project.env | ||
environments: | ||
- name: default | ||
providers: | ||
- name: test-plugin | ||
|
||
--- | ||
|
||
kind: Run | ||
name: run-a | ||
type: test | ||
varfiles: ["garden.run-a.${environment.name}.env"] | ||
variables: | ||
b: from-action-vars | ||
c: from-action-vars # should be overridden by action-level varfile | ||
d: from-action-vars # should be overridden by var passed as a CLI option | ||
|
||
spec: | ||
command: [echo, A] |
Empty file.
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 @@ | ||
{} |
Empty file.
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,20 @@ | ||
apiVersion: garden.io/v1 | ||
kind: Project | ||
name: empty-varfiles | ||
environments: | ||
- name: default | ||
providers: | ||
- name: test-plugin | ||
|
||
--- | ||
|
||
kind: Run | ||
name: run-a | ||
type: test | ||
varfiles: | ||
- "empty-varfile.env" | ||
- "empty-varfile.json" | ||
- "empty-varfile.yml" | ||
|
||
spec: | ||
command: [echo, A] |
2 changes: 0 additions & 2 deletions
2
core/test/data/test-projects/module-varfiles/garden.module-a.default.env
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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