Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Backport of internal/config: Fix panic if no scoped use stanza found into release/0.10.x #4118

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .changelog/4112.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
```release-note:bug
core: Fix panic if no Use stanza found for given workspace scope on a build,
deploy, release, or registry stanza.
```
8 changes: 8 additions & 0 deletions internal/config/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,8 @@ func (c *App) Release(ctx *hcl.EvalContext) (*Release, error) {
func (c *App) BuildUse(ctx *hcl.EvalContext) (string, error) {
if c.BuildRaw == nil {
return "", nil
} else if c.BuildRaw.Use == nil {
return "", nil
}

useType := c.BuildRaw.Use.Type
Expand All @@ -296,6 +298,8 @@ func (c *App) BuildUse(ctx *hcl.EvalContext) (string, error) {
func (c *App) RegistryUse(ctx *hcl.EvalContext) (string, error) {
if c.BuildRaw == nil || c.BuildRaw.Registry == nil {
return "", nil
} else if c.BuildRaw.Registry.Use == nil {
return "", nil
}

useType := c.BuildRaw.Registry.Use.Type
Expand All @@ -314,6 +318,8 @@ func (c *App) RegistryUse(ctx *hcl.EvalContext) (string, error) {
func (c *App) DeployUse(ctx *hcl.EvalContext) (string, error) {
if c.DeployRaw == nil {
return "", nil
} else if c.DeployRaw.Use == nil {
return "", nil
}

useType := c.DeployRaw.Use.Type
Expand All @@ -332,6 +338,8 @@ func (c *App) DeployUse(ctx *hcl.EvalContext) (string, error) {
func (c *App) ReleaseUse(ctx *hcl.EvalContext) (string, error) {
if c.ReleaseRaw == nil {
return "", nil
} else if c.ReleaseRaw.Use == nil {
return "", nil
}

useType := c.ReleaseRaw.Use.Type
Expand Down