-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Closed
Labels
@aws-cdk/aws-ecrRelated to Amazon Elastic Container RegistryRelated to Amazon Elastic Container Registryeffort/smallSmall work item – less than a day of effortSmall work item – less than a day of effortfeature-requestA feature should be added or improved.A feature should be added or improved.p2
Description
Describe the feature
Expose the repository domain/hostname as a prop.
Use Case
The Docker credentials helper (e.g. docker-credential-ecr-login) expects a hostname in the configuration.
{
"credHelpers": {
"public.ecr.aws": "ecr-login",
"<aws_account_id>.dkr.ecr.<region>.amazonaws.com": "ecr-login"
}
}Docs: https://github.com/awslabs/amazon-ecr-credential-helper?tab=readme-ov-file#docker
Proposed Solution
Extract the hostname part from this method:
aws-cdk/packages/aws-cdk-lib/aws-ecr/lib/repository.ts
Lines 234 to 242 in 0c753c3
| /** | |
| * Returns the repository URI, with an appended suffix, if provided. | |
| * @param suffix An image tag or an image digest. | |
| * @private | |
| */ | |
| private repositoryUriWithSuffix(suffix?: string): string { | |
| const parts = this.stack.splitArn(this.repositoryArn, ArnFormat.SLASH_RESOURCE_NAME); | |
| return `${parts.account}.dkr.ecr.${parts.region}.${this.stack.urlSuffix}/${this.repositoryName}${suffix}`; | |
| } |
And make it public:
/**
* Returns the domain of the repository. Can be used in Docker credentials helper.
*
* ACCOUNT.dkr.ecr.REGION.amazonaws.com
*
* @param tagOrDigest Optional image tag or digest (digests must start with `sha256:`)
*/
public get repositoryDomain(): string {
return "";
}Other Information
This helper already ships with some CodeBuild images:
aws/aws-codebuild-docker-images#743
Acknowledgements
- I may be able to implement this feature request
- This feature might incur a breaking change
CDK version used
2.x
Environment details (OS name and version, etc.)
N/A
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
@aws-cdk/aws-ecrRelated to Amazon Elastic Container RegistryRelated to Amazon Elastic Container Registryeffort/smallSmall work item – less than a day of effortSmall work item – less than a day of effortfeature-requestA feature should be added or improved.A feature should be added or improved.p2