aws / aws/aws-sam-cli

Feature request: Provide option to customize the generated docker image tag format / prefix

Open
#4,078 8 comments 11 reactions 0 assignees View on GitHub
area/deploy area/package stage/pm-review type/feature
Dominant language
Python
Stars
6.7k
Forks
1.2k
Avg merge
1d 10h
Merged PRs (30d)
52

Description

### Describe your idea/feature/enhancement

I wish SAM CLI would generate image tag in the format of `--` rather than the current format - `--`. That way I can leverage the ECR image lifecycle to clean up obsolete images by specifying particular `tagPrefixList`. The current format doesn't apply tagPrefixList option.

E.g. Given the following metadata of the lambda function:
```
HelloWorldFunction:
Type: 'AWS::Lambda::Function'
Properties:
...
Metadata:
DockerContext: X/sam/test/hello_world
DockerTag: python3.9-v1
Dockerfile: Dockerfile
```

Generate docker tag as - `helloworldfunction-python3.9-v1-ffffff111111`

### Proposal

Option-1: Change the default format to `--`
Option-2: Provide additional configuration to specify the tag prefix in metadata. E.g. DockerTagPrefix: xxx
E.g.
```
HelloWorldFunction:
Type: 'AWS::Lambda::Function'
Properties:
...
Metadata:
DockerContext: X/sam/test/hello_world
Dockerfile: Dockerfile
DockerTagPrefix: myimageprefix
```

The above would generate docker tag as - `myimageprefix-ffffff111111`, disregard the DockerTag option. (DockerTag and DockerTagPrefix can be mutual-exclusive).

### Additional Details

Discussion chain in Premium Support CASE 10376090461

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.