Skip to content

(aws-ecr-assets): TarballImageAsset Fails in Stage #24827

@gilday

Description

@gilday

Describe the bug

The TarballImageAsset construct fails when it is nested inside of a Stack that is also inside of a Stage. Moving that Stack outside of the Stage works around the issue.

Expected Behavior

The TarballImageAsset should push the image to ECR.

Current Behavior

The failure occurs when TarballImageAsset attempts to shell out to docker load.

[78%] fail: docker tag .dkr.ecr..amazonaws.com/cdk--container-assets--: exited with error code 1: Error parsing reference: "" is not a valid repository/tag: invalid reference format

Reproduction Steps

  class MyStack extends Stack {
    public MyStack(final Construct scope, final String id) {
      super(scope, id);
      new TarballImageAsset(
          this, "image", TarballImageAssetProps.builder().tarballFile("./my-image.tar").build());
    }
  }

  class MyStage extends Stage {
    public MyStage(final Construct scope, final String id) {
      super(scope, id);
      new MyStack(this, "stack");
    }
  }

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.70.0 (build c13a0f1)

Framework Version

2.70.0

Node.js Version

v19.8.1

OS

macOS 13.2.1

Language

Java

Language Version

17.0.6

Other information

Consider sending requests to the Docker daemon without shelling out to the Docker CLI to get more descriptive errors and avoid issues like #19627.

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-ecr-assetsRelated to AWS CDK Docker Image AssetsbugThis issue is a bug.effort/mediumMedium work item – several days of effortp3

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions