-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add support for unique-per-image tag (was DIGEST_HEX) #2162
Comments
For example, I applied the following change to --- a/examples/getting-started/skaffold.yaml
+++ b/examples/getting-started/skaffold.yaml
@@ -1,6 +1,9 @@
apiVersion: skaffold/v1beta10
kind: Config
build:
+ tagPolicy:
+ envTemplate:
+ template: "{{.IMAGE_NAME}}:{{.USER}}{{.DIGEST_HEX}}"
artifacts:
- image: gcr.io/k8s-skaffold/skaffold-example
deploy:
But the images are tagged as my username and do not have a digest appended. |
this is the intended behavior of the tagger. the envTemplate tagger will generate a tag based exactly on what is provided in the skaffold.yaml: it won't append anything else on there without being explicitly specified by the user. we compute the tags for image BEFORE we build them, so there's no image ID for us to use when generating the tag. we can't use the image digest for local images anyway, because we don't actually have the digest (this would require pushing the image, then retrieving the image manifest from the remote registry where we pushed it). |
Skaffold builds the image then tags it with If you run So here's what Skaffold does. It depends wether images are pushed or not:
I wish it wouldn't be two different behaviours but since this is due to Docker's behaviour, there's little Skaffold can do. |
what I'm looking for is an alternative to the old @dgageot how would I go about using the immutable tag in skaffold config? I tried
if interested, our use case is to have a common repository used as a playground for users to test their images before finalizing the projects and creating the repos.
The old DIGEST vars would allow us to achieve the above. Now them being removed leaves us in a place where we cannot update skaffold. Is there any alternative mechanism with which we can achieve a similar result as the one discussed above? |
@dgageot if I read that correctly, I should use the |
@elisiano yes. That's more a Fully Qualified Name than a digest. We kept the name for compatibility reasons but we might want to revisit that. |
This is what I tried:
It seems like the digest is not replaced in the image name. |
Yeah, this whole
The digest will then be automatically be appended without you having to use |
If I remove it entirely and use the same example as above, I get:
The image gets tagged with git-sourced attributes which is not what I want. In the case when I build multiple images from the same repo, I want images re-tagged only if their content has been changed by a given git commit (hence, I'm using the
Patching the same example with the above yields:
Specifically, the @dgageot could you try using |
@morozov Sorry, I should have said that in my These 3 examples should work:
|
Thank you @dgageot. Unfortunately, neither of the examples above works as I'd expect:
|
Sorry @morozov, I made a type. Instead of Now, the feature you are asking is not currently possible. There's no tagger that gives you the digests of the inputs. Since it was asked many times, I'll write a proposal. |
See #2804 |
@dgageot I had a look at the #2804 proposal and I think it's still missing what we're looking for. |
@elisiano Thanks a lot for the feedback! I'll update the proposal. |
Waiting for the proposal to get in. |
I was also surprisingly affected by this issue. Reading the official documentation about the tagging strategies gives the impression that sha256 will put a digest in the image tag and it doesn't. Can the official docs be update to avoid this confusion until the situation is fixed? |
For those that are trying to consume the tag that skaffold generates on |
@Norbo11 so what does the process look like? You build the image once to get the digest and then rebuild it with the tag? |
Not sure what your specific use-case is, but for me, I just wanted to use Skaffold to build me an image and tag it with something that included the digest of the contents. I needed to retrieve that tag somehow to pass it to our deployment mechanism (we are not using Skaffold to deploy). Skaffold refused to output anything that included the digest. If you pass |
Will bring this up for discussion again now that there is a proposal: https://github.com/GoogleContainerTools/skaffold/blob/master/docs/design_proposals/digest-tagger.md |
I believe this was fixed with: which added the Closing as fixed, feel free to comment here and I will re-open if there is some unaddressed issue(s) here |
In #1482 the tagging mechanism changed.
Expected behavior
with a tagging policy like this:
I was expecting to see the digest appended automatically to the name.
Actual behavior
The digest is not appended
Information
Steps to reproduce the behavior
eval $(minikube docker-env)
skaffold build
docker images
The text was updated successfully, but these errors were encountered: