GoogleCloudPlatform / cloud-run-button

Let anyone deploy your GitHub repos to Google Cloud Run with a single click
https://cloud.run
Apache License 2.0
526 stars 91 forks source link

Git Commit Sha in Container Image Tag #156

Open jamesward opened 4 years ago

jamesward commented 4 years ago

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

ahmetb commented 4 years ago

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 commented 4 years ago

Would we have to also do a push for latest?

ahmetb commented 4 years ago

Would we have to also do a push for latest?

Not if we use it?

jamesward commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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

jamesward commented 4 years ago

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