(core): default docker and file asset prefixes to the stack's ID #17803
Labels
@aws-cdk/core
Related to core CDK functionality
effort/large
Large work item – several weeks of effort
feature-request
A feature should be added or improved.
p2
Description
Today, when assets like Docker Images and Files are produced, the filename is a hash of the file contents. The hash behavior is great because it allows CloudFormation to skip re-uploading assets when the changes are "no-op"s. However, these assets are not very human-friendly because they're not identifiable in any way.
Use Case
Ther are a few distinct use-cases I can think of:
gc
in the future: Garbage Collection for Assets aws-cdk-rfcs#64.c83185b9d9d867148abd3f2c7c1f2d8aa3f39effb705b56ae99d114e015bf729.py
today. By just looking at this, I have no idea what it could be. However, if the Stack ID was prepended, I would automatically have a better idea of what that file isMyStackId-c83185b9d9d867148abd3f2c7c1f2d8aa3f39effb705b56ae99d114e015bf729.py
Proposed Solution
Currently, there are two properties exposed by the
DefaultStackSynthesizer
that make this change fairly straightforward,bucketPrefix
anddockerTagPrefix
aws-cdk/packages/@aws-cdk/core/lib/stack-synthesizers/default-synthesizer.ts
Lines 168 to 183 in 534babd
The defaults are currently blank strings
aws-cdk/packages/@aws-cdk/core/lib/stack-synthesizers/default-synthesizer.ts
Lines 250 to 257 in 534babd
I propose that, instead of blank strings, we use the stack name and some separator (e.g.,
-
or_
) as the default prefix for Docker Images and File assets.You can get this behavior today by overriding these values like so
but I think there's an argument to make this the default in CDK.
Other information
There are a number of other issues that relate to this idea:
Though this wouldn't solve these issues directly, it could make it easier to implement these types of improvements in the future.
Acknowledge
The text was updated successfully, but these errors were encountered: