Skip to content

dockerbuild.NewImage throws an error if Context.Location is not immediately available #477

@dottedmag

Description

@dottedmag

What happened?

dockerbuild.NewImage eagerly checks context location dir and throws an error it is missing, even if it would be created by other Pulumi commands.

Example

Make an image that depends on a task that creates its context:

build, _ = local.NewCommand(ctx, "build-cmd", &local.CommandArgs{
	Create: pulumi.String(`
mkdir build-dir
# create things inside build-dir...
`),
})

image, _ = dockerbuild.NewImage(ctx, "image", &dockerbuild.ImageArgs{
	Context: &dockerbuild.BuildContextArgs{
		Location: p.S("build-dir"),
	},
}, pulumi.DependsOn([]pulumi.Resource{
	build,
})

Output of pulumi about

Lot of private information there, exercpt:

github.com/pulumi/pulumi-docker-build/sdk/go/dockerbuild  v0.0.7
github.com/pulumi/pulumi/sdk/v3                           v3.136.1

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSome behavior is incorrect or out of spec

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions