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:
4
sdk/dotnet/Image.cs
generated
4
sdk/dotnet/Image.cs
generated
@@ -557,7 +557,7 @@ namespace Pulumi.DockerBuild
|
||||
public Output<ImmutableArray<Outputs.CacheTo>> CacheTo { get; private set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Build context settings.
|
||||
/// Build context settings. Defaults to the current directory.
|
||||
///
|
||||
/// Equivalent to Docker's `PATH | URL | -` positional argument.
|
||||
/// </summary>
|
||||
@@ -897,7 +897,7 @@ namespace Pulumi.DockerBuild
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Build context settings.
|
||||
/// Build context settings. Defaults to the current directory.
|
||||
///
|
||||
/// Equivalent to Docker's `PATH | URL | -` positional argument.
|
||||
/// </summary>
|
||||
|
||||
8
sdk/go/dockerbuild/image.go
generated
8
sdk/go/dockerbuild/image.go
generated
@@ -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 {
|
||||
|
||||
8
sdk/go/dockerbuild/x/image.go
generated
8
sdk/go/dockerbuild/x/image.go
generated
@@ -582,7 +582,7 @@ type Image struct {
|
||||
//
|
||||
// Equivalent to Docker's `--cache-to` flag.
|
||||
CacheTo pulumix.GArrayOutput[CacheTo, CacheToOutput] `pulumi:"cacheTo"`
|
||||
// Build context settings.
|
||||
// Build context settings. Defaults to the current directory.
|
||||
//
|
||||
// Equivalent to Docker's `PATH | URL | -` positional argument.
|
||||
Context pulumix.GPtrOutput[BuildContext, BuildContextOutput] `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 pulumix.Input[[]*CacheToArgs]
|
||||
// Build context settings.
|
||||
// Build context settings. Defaults to the current directory.
|
||||
//
|
||||
// Equivalent to Docker's `PATH | URL | -` positional argument.
|
||||
Context pulumix.Input[*BuildContextArgs]
|
||||
@@ -1151,7 +1151,7 @@ func (o ImageOutput) CacheTo() pulumix.GArrayOutput[CacheTo, CacheToOutput] {
|
||||
return pulumix.GArrayOutput[CacheTo, CacheToOutput]{OutputState: unwrapped.OutputState}
|
||||
}
|
||||
|
||||
// Build context settings.
|
||||
// Build context settings. Defaults to the current directory.
|
||||
//
|
||||
// Equivalent to Docker's `PATH | URL | -` positional argument.
|
||||
func (o ImageOutput) Context() pulumix.GPtrOutput[BuildContext, BuildContextOutput] {
|
||||
|
||||
@@ -771,7 +771,7 @@ public class Image extends com.pulumi.resources.CustomResource {
|
||||
return Codegen.optional(this.cacheTo);
|
||||
}
|
||||
/**
|
||||
* Build context settings.
|
||||
* Build context settings. Defaults to the current directory.
|
||||
*
|
||||
* Equivalent to Docker's `PATH | URL | -` positional argument.
|
||||
*
|
||||
@@ -780,7 +780,7 @@ public class Image extends com.pulumi.resources.CustomResource {
|
||||
private Output</* @Nullable */ BuildContext> context;
|
||||
|
||||
/**
|
||||
* @return Build context settings.
|
||||
* @return Build context settings. Defaults to the current directory.
|
||||
*
|
||||
* Equivalent to Docker's `PATH | URL | -` positional argument.
|
||||
*
|
||||
|
||||
@@ -169,7 +169,7 @@ public final class ImageArgs extends com.pulumi.resources.ResourceArgs {
|
||||
}
|
||||
|
||||
/**
|
||||
* Build context settings.
|
||||
* Build context settings. Defaults to the current directory.
|
||||
*
|
||||
* Equivalent to Docker's `PATH | URL | -` positional argument.
|
||||
*
|
||||
@@ -178,7 +178,7 @@ public final class ImageArgs extends com.pulumi.resources.ResourceArgs {
|
||||
private @Nullable Output<BuildContextArgs> context;
|
||||
|
||||
/**
|
||||
* @return Build context settings.
|
||||
* @return Build context settings. Defaults to the current directory.
|
||||
*
|
||||
* Equivalent to Docker's `PATH | URL | -` positional argument.
|
||||
*
|
||||
@@ -816,7 +816,7 @@ public final class ImageArgs extends com.pulumi.resources.ResourceArgs {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param context Build context settings.
|
||||
* @param context Build context settings. Defaults to the current directory.
|
||||
*
|
||||
* Equivalent to Docker's `PATH | URL | -` positional argument.
|
||||
*
|
||||
@@ -829,7 +829,7 @@ public final class ImageArgs extends com.pulumi.resources.ResourceArgs {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param context Build context settings.
|
||||
* @param context Build context settings. Defaults to the current directory.
|
||||
*
|
||||
* Equivalent to Docker's `PATH | URL | -` positional argument.
|
||||
*
|
||||
|
||||
4
sdk/nodejs/image.ts
generated
4
sdk/nodejs/image.ts
generated
@@ -545,7 +545,7 @@ export class Image extends pulumi.CustomResource {
|
||||
*/
|
||||
public readonly cacheTo!: pulumi.Output<outputs.CacheTo[] | undefined>;
|
||||
/**
|
||||
* Build context settings.
|
||||
* Build context settings. Defaults to the current directory.
|
||||
*
|
||||
* Equivalent to Docker's `PATH | URL | -` positional argument.
|
||||
*/
|
||||
@@ -842,7 +842,7 @@ export interface ImageArgs {
|
||||
*/
|
||||
cacheTo?: pulumi.Input<pulumi.Input<inputs.CacheToArgs>[]>;
|
||||
/**
|
||||
* Build context settings.
|
||||
* Build context settings. Defaults to the current directory.
|
||||
*
|
||||
* Equivalent to Docker's `PATH | URL | -` positional argument.
|
||||
*/
|
||||
|
||||
8
sdk/python/pulumi_docker_build/image.py
generated
8
sdk/python/pulumi_docker_build/image.py
generated
@@ -76,7 +76,7 @@ class ImageArgs:
|
||||
:param pulumi.Input[Sequence[pulumi.Input['CacheToArgs']]] cache_to: Cache import configuration.
|
||||
|
||||
Equivalent to Docker's `--cache-to` flag.
|
||||
:param pulumi.Input['BuildContextArgs'] context: Build context settings.
|
||||
:param pulumi.Input['BuildContextArgs'] context: Build context settings. Defaults to the current directory.
|
||||
|
||||
Equivalent to Docker's `PATH | URL | -` positional argument.
|
||||
:param pulumi.Input['DockerfileArgs'] dockerfile: Dockerfile settings.
|
||||
@@ -328,7 +328,7 @@ class ImageArgs:
|
||||
@pulumi.getter
|
||||
def context(self) -> Optional[pulumi.Input['BuildContextArgs']]:
|
||||
"""
|
||||
Build context settings.
|
||||
Build context settings. Defaults to the current directory.
|
||||
|
||||
Equivalent to Docker's `PATH | URL | -` positional argument.
|
||||
"""
|
||||
@@ -944,7 +944,7 @@ class Image(pulumi.CustomResource):
|
||||
:param pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['CacheToArgs']]]] cache_to: Cache import configuration.
|
||||
|
||||
Equivalent to Docker's `--cache-to` flag.
|
||||
:param pulumi.Input[pulumi.InputType['BuildContextArgs']] context: Build context settings.
|
||||
:param pulumi.Input[pulumi.InputType['BuildContextArgs']] context: Build context settings. Defaults to the current directory.
|
||||
|
||||
Equivalent to Docker's `PATH | URL | -` positional argument.
|
||||
:param pulumi.Input[pulumi.InputType['DockerfileArgs']] dockerfile: Dockerfile settings.
|
||||
@@ -1552,7 +1552,7 @@ class Image(pulumi.CustomResource):
|
||||
@pulumi.getter
|
||||
def context(self) -> pulumi.Output[Optional['outputs.BuildContext']]:
|
||||
"""
|
||||
Build context settings.
|
||||
Build context settings. Defaults to the current directory.
|
||||
|
||||
Equivalent to Docker's `PATH | URL | -` positional argument.
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user