-
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
New tagging mechanism #1482
New tagging mechanism #1482
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1482 +/- ##
==========================================
- Coverage 46.92% 46.88% -0.04%
==========================================
Files 119 118 -1
Lines 5072 5042 -30
==========================================
- Hits 2380 2364 -16
+ Misses 2458 2446 -12
+ Partials 234 232 -2
Continue to review full report at Codecov.
|
7c8af68
to
d925153
Compare
151c9d5
to
ba3967c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to keep reviewing but - as we are in beta, we have to mark DIGEST
related functionality as deprecated first, announce it, and then we can remove it in 3 months.
@@ -32,10 +32,21 @@ type envTemplateTagger struct { | |||
|
|||
// NewEnvTemplateTagger creates a new envTemplateTagger | |||
func NewEnvTemplateTagger(t string) (Tagger, error) { | |||
if strings.Contains(t, "{{.DIGEST}}") { | |||
return nil, errors.New("{{.DIGEST}} is deprecated, image digest will automatically be apppended to image tags") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return nil, errors.New("{{.DIGEST}} is deprecated, image digest will automatically be apppended to image tags") | |
return nil, errors.New("{{.DIGEST}} is deprecated, image digest will automatically be appended to image tags") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been fixed
@@ -32,10 +32,21 @@ type envTemplateTagger struct { | |||
|
|||
// NewEnvTemplateTagger creates a new envTemplateTagger | |||
func NewEnvTemplateTagger(t string) (Tagger, error) { | |||
if strings.Contains(t, "{{.DIGEST}}") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This wouldn't work if it has a space or do we normalize it somewhere? e.g {{ .DIGEST }}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been fixed
Otherwise everything looks good.
and whenever these template params are used, we would print out a deprecation warning for 3 months. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the build plugins to work, I think the tagger would need to be removed entirely from the build interface
Build(ctx context.Context, out io.Writer, tagger tag.Tagger, artifacts []*latest.Artifact) ([]Artifact, error)
would need to be
Build(ctx context.Context, out io.Writer, artifacts []*latest.Artifact) ([]Artifact, error)
where maybe we store a tag in each artifact.
Would it be possible to resolve tagging before Build is called? (I totally realize that this could be a very big refactor so it doesn't have to happen in this PR, but I don't think there's anyway around it in the long run for the plugins).
cc @balopat
@balopat how do you see the deprecation warning working? |
515bf63
to
d0c29e1
Compare
4be4ad6
to
b77fab4
Compare
@priyawadhwa @balopat {{.DIGEST}} and friends should be handled better now.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one small typo but deprecation logic LGTM
case strings.Contains(tag, "[DEPRECATED_DIGEST]") || | ||
strings.Contains(tag, "[DEPRECATED_DIGEST_ALGO]") || | ||
strings.Contains(tag, "[DEPRECATED_DIGEST_HEX]"): | ||
return "", errors.New("{{.DIGEST}}, {{.DIGEST_ALGO}} and {{.DIGEST_HEX}} are deprecated, image digest will now automatically be apppended to image tags") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/apppended
/appended
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me fix that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'm cool with this, let's monitor for a few days after it gets merged to make sure we're not breaking people in ways we didn't expect
case strings.Contains(tag, "[DEPRECATED_DIGEST]") || | ||
strings.Contains(tag, "[DEPRECATED_DIGEST_ALGO]") || | ||
strings.Contains(tag, "[DEPRECATED_DIGEST_HEX]"): | ||
return "", errors.New("{{.DIGEST}}, {{.DIGEST_ALGO}} and {{.DIGEST_HEX}} are deprecated, image digest will now automatically be appended to image tags") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel strongly about not throwing an error here either, we should not break user workflows.
Just a warning is enough, and we can leave DEPRECATED_*
(without the brackets) in the image name. A seamless upgrade allows for deferred action on the user's side. Image name uniqueness won't be a problem as we are adding the @digest
suffix anyway.
I am okay to take the blame for the messy image names, if they become an issue rather than facing angry users who have to change their skaffold.yaml-s without a notice, even though they were promised a stable beta!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fixed now
57f8005
to
0eb8ae0
Compare
Signed-off-by: David Gageot <david@gageot.net>
Signed-off-by: David Gageot <david@gageot.net>
Actually, we use: + imageID when the image is built locally + tag@sha256:abcabc when the image was pushed We assume here that taggers never append the digest to the tag themselves. (Which is not true) Signed-off-by: David Gageot <david@gageot.net>
Signed-off-by: David Gageot <david@gageot.net>
Signed-off-by: David Gageot <david@gageot.net>
Pass the final tag to the builders and let them build and push that tag directly.
Signed-off-by: David Gageot <david@gageot.net>
Where digest is not available and imageID can’t be used in k8s manifests. Signed-off-by: David Gageot <david@gageot.net>
Fix GoogleContainerTools#1349 Signed-off-by: David Gageot <david@gageot.net>
Signed-off-by: David Gageot <david@gageot.net>
Signed-off-by: David Gageot <david@gageot.net>
Signed-off-by: David Gageot <david@gageot.net>
As dicussed let's change the "[" "]" chars to "_" so that the image names are compatible with docker, then we can merge it! |
Woot! All green 💚 🍏 📗 |
This completely rewrites the image tagging mechanism. Here's how it'll work: