Fix a panic that could occur when context was omitted (#83)

I could have sworn the context property was required, but evidently it
isn't and we weren't handling the case when it was missing.

This PR updates things to set a default location of the current
directory if the context is absent. Some unit tests are also added.

Fixes #78.
This commit is contained in:
Bryce Lampe
2024-05-31 07:41:22 -07:00
committed by GitHub
parent 44e082a0a0
commit 4e8cf8f4ba
27 changed files with 137 additions and 66 deletions

View File

@@ -582,7 +582,7 @@ type Image struct {
//
// Equivalent to Docker's `--cache-to` flag.
CacheTo CacheToArrayOutput `pulumi:"cacheTo"`
// Build context settings.
// Build context settings. Defaults to the current directory.
//
// Equivalent to Docker's `PATH | URL | -` positional argument.
Context BuildContextPtrOutput `pulumi:"context"`
@@ -804,7 +804,7 @@ type imageArgs struct {
//
// Equivalent to Docker's `--cache-to` flag.
CacheTo []CacheTo `pulumi:"cacheTo"`
// Build context settings.
// Build context settings. Defaults to the current directory.
//
// Equivalent to Docker's `PATH | URL | -` positional argument.
Context *BuildContext `pulumi:"context"`
@@ -952,7 +952,7 @@ type ImageArgs struct {
//
// Equivalent to Docker's `--cache-to` flag.
CacheTo CacheToArrayInput
// Build context settings.
// Build context settings. Defaults to the current directory.
//
// Equivalent to Docker's `PATH | URL | -` positional argument.
Context BuildContextPtrInput
@@ -1165,7 +1165,7 @@ func (o ImageOutput) CacheTo() CacheToArrayOutput {
return o.ApplyT(func(v *Image) CacheToArrayOutput { return v.CacheTo }).(CacheToArrayOutput)
}
// Build context settings.
// Build context settings. Defaults to the current directory.
//
// Equivalent to Docker's `PATH | URL | -` positional argument.
func (o ImageOutput) Context() BuildContextPtrOutput {