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

Git Commit Sha in Container Image Tag #156

Open
jamesward opened this issue Mar 30, 2020 · 8 comments
Open

Git Commit Sha in Container Image Tag #156

jamesward opened this issue Mar 30, 2020 · 8 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@jamesward
Copy link
Contributor

It'd be cool to put the git commit sha in the container image tag.

@jamesward jamesward added enhancement New feature or request good first issue Good for newcomers labels Mar 30, 2020
@ahmetb
Copy link
Contributor

ahmetb commented Apr 29, 2020

This should be an easy thing to fix, but then, it complicates the command we print out a little bit.

Should be as easy as exec'ing into git rev-parse --short HEAD and trimming output, then passing it to:

	image := fmt.Sprintf("gcr.io/%s/%s", project, serviceName)

Feel free to implement if you'd like.

@jamesward
Copy link
Contributor Author

Would we have to also do a push for latest?

@ahmetb
Copy link
Contributor

ahmetb commented Apr 29, 2020

Would we have to also do a push for latest?

Not if we use it?

@jamesward
Copy link
Contributor Author

Sorry, I'm not very familiar with how this all works. If we want to tag an image with the short sha and make it so users can pull the latest without specifying a tag, does that mean we have to push both the short sha tag and the latest tag?

@ahmetb
Copy link
Contributor

ahmetb commented Apr 30, 2020

Yeah, but I'm not exactly sure users pulling images after deploying is a common journey. We'd tag the image twice and push twice (one of them would be a soft-push just creating the tag).

Given we have tools like pack & Jib involved, we might not be able to tag multiple times as efficiently as docker.

@jamesward
Copy link
Contributor Author

There are times where I pull the image for local testing and having latest for that is helpful. But you are right that this does add some complications when something else does the push. Right now it's just Jib that does it's own push. I wonder if we should actually just turn that off for the sake of simplifying things.

@ahmetb
Copy link
Contributor

ahmetb commented Apr 30, 2020

If someone wants to pull images I'm not sure why they can't pull with the :tag ?

@jamesward
Copy link
Contributor Author

They definitely can, it's just a bit more cumbersome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants