aws / aws/aws-cdk

ecs: EcsOptimizedImage ignores additionalCacheKey

Open
#35,378 2 comments 0 reactions 0 assignees View on GitHub
@aws-cdk/aws-ecs bug effort/medium p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the bug

The static methods of `EcsOptimizedImage` pass `options.cachedInContext` on to the constructor alone, ignoring `options.additionalCacheKey` even though the `EcsOptimizedImageOptions` type has a `additionalCacheKey` key. Since the constructor is private, there is no way to use `EcsOptimizedImage` with `additionalCacheKey`.

### Regression Issue

- [ ] Select this option if this issue appears to be a regression.

### Last Known Working CDK Library Version

_No response_

### Expected Behavior

Providing `additionalCacheKey` leads to the provided key being included in the key for caching the image ami in cdk context.

### Current Behavior

`additionalCacheKey` is entirely ignored

### Reproduction Steps

construct and use a `new aws_ecs.EcsOptimisedImage.amazonLinux2023(aws_ecs.AmiHardwareType.ARM, { cachedInContext: true, additionaCacheKey: 'cache-key'})`

### Possible Solution

Add `additionalCacheKey: context.additionalCacheKey,` to the constructor arguments in every static method defined in `EcsOptimizedImage`.

### Additional Information/Context

_No response_

### AWS CDK Library version (aws-cdk-lib)

aws-cdk-lib@npm:2.213.0

### AWS CDK CLI version

2.1027.0 (build 5fc1b13)

### Node.js Version

v22.18.0

### OS

arch linux

### Language

TypeScript

### Language Version

_No response_

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Locate the EcsOptimizedImage class and inspect its private constructor plus each static factory method. Verify how cachedInContext and additionalCacheKey are passed into the image AMI cache key, then add or update coverage so the supplied additionalCacheKey is included.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, infrastructure
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.