Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ecr.Image does not set the "latest" tag #1149

Open
timt opened this issue Nov 6, 2023 · 5 comments
Open

ecr.Image does not set the "latest" tag #1149

timt opened this issue Nov 6, 2023 · 5 comments
Labels
kind/enhancement Improvements or new features

Comments

@timt
Copy link

timt commented Nov 6, 2023

What happened?

Calling ecr.Image does not set the "latest" tag on the built image and there is no way to set additional tags.

Example

const image = new awsx.ecr.Image("my-awesome-image", {
   repositoryUrl: repo.url,
   context: ".",
 });

This will push an image with the tag XXXXXXX-container where the XXXXXX is a numerical sha which is produced in the function createUniqueImageName in file ecr.Image.ts

Output of pulumi about

CLI
Version 3.91.1
Go Version go1.21.3
Go Compiler gc

Plugins
NAME VERSION
aws 6.7.0
aws 6.7.0
awsx 2.1.1
docker 4.4.4
docker 3.6.1
nodejs unknown

Host
OS darwin
Version 14.0
Arch arm64

This project is written in nodejs: executable='/usr/local/bin/node' version='v20.6.0'

Backend
Name XXXXXX
URL XXXXX
User XXXXXXX
Organizations
Token type personal

Dependencies:
NAME VERSION
@pulumi/aws 6.7.0
@pulumi/awsx 2.1.1
@pulumi/pulumi 3.91.1
@pulumi/docker 4.4.4
typescript 5.2.2
@types/node 20.8.10

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

@timt timt added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Nov 6, 2023
@mikhailshilkov
Copy link
Member

Hi @timt sorry for a long delay in response.

This issue seems like a dupe of #585, although it's framed in terms of more recent API, so I'll probably close the other one as a dupe.

Do you have a suggestion for APIs to set tags for the image that you would expect?

@mikhailshilkov mikhailshilkov added kind/enhancement Improvements or new features and removed kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Nov 13, 2023
@nickdirienzo
Copy link

nickdirienzo commented Dec 22, 2023

Hi @mikhailshilkov 👋

Thanks for considering building this into awsx. I'm coming from Terraform so awsx is my first exposure to Pulumi. Generally it's been okay, there's been some surprises. This being one of them.

I like the idea of using Pulumi for deployments which requires the build + push + deploy step during my CD pipeline. I'd like to be able to use the commit SHA to tag so I can easily map an image to source history. A few ways come to mind for me.

Two explicit ways. The first being a custom param:

const img = new awsx.ecr.Image(projectName, {
	repositoryUrl: repo.url,
	path: ".",
	extraOptions: ["--platform=linux/amd64"],
	tags: [gitCommitSha]	
});

The second leveraging the name arg, which from what I can tell isn't really used outside of creating a unique hash internally. So it could be a custom tag on its own, but I imagine this would be quite a breaking change:

const img = new awsx.ecr.Image(gitCommitSha, {
	repositoryUrl: repo.url,
	path: ".",
	extraOptions: ["--platform=linux/amd64"]
});

Another could be using the CI provider's env var for the latest commit SHA, but this feels a bit too magical.

Would love to see this so I can use awsx without having to drop down into the Docker provider. It looks like #829 is close but it's possible that teams will want to add multiple tags.

Hope this helps!

@ascrookes
Copy link

I would also find use in this feature. Having the ability to use custom tags for a few applications we have would be beneficial. We aren't looking to have the latest tag applied but would like custom tags.

Of the two suggestions @nickdirienzo shared above above I most like the first suggestion of having an explicit tags parameter that accepts a list of tags. I'm a Python Pulumi user FWIW.

As another reference, pulumi-docker allows setting the tag via the image_name property: https://www.pulumi.com/registry/packages/docker/api-docs/image

@davidtwomey
Copy link

Agree with @ascrookes -> would also find this feature useful (explicit tags parameter)

@Bi0max
Copy link

Bi0max commented Mar 13, 2024

Hi, I would also like to be able to set arbitrary tags

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Improvements or new features
Projects
None yet
Development

No branches or pull requests

6 participants