Skip to content

(aws-ecr-assets): DockerImageAsset.repository is not really a repository (e.g. grants result in a no-op) #13327

@JFox

Description

@JFox

When adding pull permissions as stated in the docs, the result is a no-op

Reproduction Steps

const myAsset = new DockerImageAsset(this, "MyAsset", {
  directory: path.join(process.cwd(), "docker", "my-asset"),
});
myAsset.repository.addToResourcePolicy(
  new PolicyStatement({
    principals: [
      new AccountPrincipal("123123123"),
      new AccountPrincipal("78667867"),
    ],
    actions: [
      "ecr:GetDownloadUrlForLayer",
      "ecr:BatchCheckLayerAvailability",
      "ecr:BatchGetImage",
    ],
  }),
);

What did you expect to happen?

ECR repo's permissions policy gets updated according to the code

What actually happened?

Nothing

Environment

  • **CDK CLI Version :1.86.0
  • **Framework Version: 1.86.0
  • **Node.js Version: v13.8.0
  • **OS :MacOS Catalina
  • **Language (Version): TypeScript (3.9.6)

This is 🐛 Bug Report

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/assetsRelated to the @aws-cdk/assets package@aws-cdk/aws-ecr-assetsRelated to AWS CDK Docker Image AssetsbugThis issue is a bug.closed-for-stalenessThis issue was automatically closed because it hadn't received any attention in a while.effort/smallSmall work item – less than a day of effortp1

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions