You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pulumi.DockerBuild.Image shows an error on pulumi preview when the ECR repository has not yet been created, but it does create the repository at the same time the docker build is performed. However, pulumi preview succeeds if the ECR repository already exists. Since Pulumi.Docker.Image can preview even when the ECR and Docker are created at the same time, is this by design, or am I missing something?
Error meesage.
docker-build:index:Image (dummy-image):
error: docker-build:index:Image resource 'dummy-image': property exports[0] value {<nil>} has a problem: at least one tag or export name is needed when pushing to a registry
Example
pulumi preview failure sample.
varecr=newPulumi.Aws.Ecr.Repository($"dummy-repo",new(){ForceDelete=true,});varauthToken=Pulumi.Aws.Ecr.GetAuthorizationToken.Invoke(new(){RegistryId=ecr.RegistryId,});varimage=newPulumi.DockerBuild.Image($"dummy-image",new(){Dockerfile=newPulumi.DockerBuild.Inputs.DockerfileArgs{Inline=""" FROM envoy """,},Platforms=[Pulumi.DockerBuild.Platform.Linux_amd64,Pulumi.DockerBuild.Platform.Linux_arm64],Push=true,Registries=[newPulumi.DockerBuild.Inputs.RegistryArgs{Address=ecr.RepositoryUrl,Username=authToken.Apply(x =>x.UserName),Password=authToken.Apply(x =>x.Password)}],Tags=[ecr.RepositoryUrl.Apply(x =>$"{x}:latest"),],// `pulumi preview` fail});
pulumi preview success sample, just changed Tags not use Pulumi.Ouput.Apply and change to literal.
varimage=newPulumi.DockerBuild.Image($"dummy-image",new(){Dockerfile=newPulumi.DockerBuild.Inputs.DockerfileArgs{Inline=""" FROM envoy """,},Platforms=[Pulumi.DockerBuild.Platform.Linux_amd64,Pulumi.DockerBuild.Platform.Linux_arm64],Push=true,Registries=[newPulumi.DockerBuild.Inputs.RegistryArgs{Address=ecr.RepositoryUrl,Username=authToken.Apply(x =>x.UserName),Password=authToken.Apply(x =>x.Password)}],Tags=["0123456789012.dkr.ecr.ap-northeast-1.amazonaws.com/dummy-repo-abcdef:latest"],// change to literal});
Output of pulumi about
CLI
Version 3.131.0
Go Version go1.23.0
Go Compiler gc
Plugins
KIND NAME VERSION
resource aws 6.51.0
resource aws-native 0.119.0
resource azure-native 2.57.0
resource docker-build 0.0.6
language dotnet unknown
Host
OS Microsoft Windows 11 Pro
Version 10.0.22631 Build 22631
Arch x86_64
This project is written in dotnet: executable='C:\Program Files\dotnet\dotnet.exe' version='8.0.400'
Dependencies:
NAME VERSION
Pulumi 3.66.2
Pulumi.Aws 6.51.0
Pulumi.AwsNative 0.119.0
Pulumi.DockerBuild 0.0.6
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).
The text was updated successfully, but these errors were encountered:
set Push = false for pulumi preview, and Push = true for pulumi up. This can be archived by Deployment.Instance.IsDryRun.
// beforevarimage=newPulumi.DockerBuild.Image($"dummy-image",new(){Push=true,// cause error when ECR is not yet created on preview.// any other parameters};// aftervarimage=newPulumi.DockerBuild.Image($"dummy-image",new(){Push=!Deployment.Instance.IsDryRun,// Deployment.Instance.IsDryRun will be true on `pulumi preview` = true, false on `pulumi up`.// any other parameters};
What happened?
Pulumi.DockerBuild.Image
shows an error onpulumi preview
when the ECR repository has not yet been created, but it does create the repository at the same time the docker build is performed. However,pulumi preview
succeeds if the ECR repository already exists. SincePulumi.Docker.Image
can preview even when the ECR and Docker are created at the same time, is this by design, or am I missing something?Error meesage.
Example
pulumi preview
failure sample.pulumi preview
success sample, just changed Tags not usePulumi.Ouput.Apply
and change to literal.Output of
pulumi about
Additional context
Example code is logically same as official api-docs https://www.pulumi.com/registry/packages/docker-build/api-docs/image/ do.
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).
The text was updated successfully, but these errors were encountered: