-
Notifications
You must be signed in to change notification settings - Fork 410
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
feat: globalEnvs for KO_DOCKER_REPO, annotations and labels for the image config based on build ids #632
feat: globalEnvs for KO_DOCKER_REPO, annotations and labels for the image config based on build ids #632
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,6 +66,9 @@ func addResolve(topLevel *cobra.Command) { | |
if err != nil { | ||
return fmt.Errorf("error creating builder: %w", err) | ||
} | ||
if bo.DockerRepo != "" { | ||
po.DockerRepo = bo.DockerRepo | ||
} | ||
Comment on lines
+69
to
+71
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bleh, this also doesn't feel right. Sorry to keep moving things around on you, I'm struggling to find a good way to express this without having multiple copies of this floating around. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about creating an overrider function to set and pass some variables from builder to publisher struct? makeOverrider(bo, po) I'm not sure if |
||
publisher, err := makePublisher(po) | ||
if err != nil { | ||
return fmt.Errorf("error creating publisher: %w", err) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -121,6 +121,14 @@ func gobuildOptions(bo *options.BuildOptions) ([]build.Option, error) { | |
opts = append(opts, build.WithConfig(bo.BuildConfigs)) | ||
} | ||
|
||
if bo.ImageConfigs != nil { | ||
opts = append(opts, build.WithImageConfig(bo.ImageConfigs)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What if |
||
} | ||
|
||
if bo.DefaultImageConfig != nil { | ||
opts = append(opts, build.WithDefaultImageConfig(bo.DefaultImageConfig)) | ||
} | ||
|
||
return opts, nil | ||
} | ||
|
||
|
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.
Should these just go in
Config
alongsideEnv
etc.? It seems like a meaningless separation.The only problem with that is if goreleaser adds a
Labels
orAnnotations
field to its config, we'd have a different meaning. I'm starting to really regret copying goreleaser's config so closely. 😢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.
IMHO, we should separate them from a build because these are related to the image we provide at the end of that build. So, it might cause a bit more confusion if we put them into the Config section. In the current design, users should match the id fields of the builds and images sections to be able to define labels and annotations per image related to that build, WDYT?
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.
Oh I see, I was confusing
build.env
(what envs to set when wego build
) vsimage.env
(what envs to set in the resulting image).In that case, yeah, I agree we should have a separate image config struct with labels/annotations.
We should also use this to fix #633, with a top-level
defaultImageConfig: { }
option, that gets overridden by more specificimages:
and both get overridden if there's a conflicting--image-label
specified.WDYT?
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.
Oh yeah, we should apply some kind of prioritization between them, that makes a lot of sense 🙋🏻♂️
Here are the prioritization rules:
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.
it should be okay @imjasonh 🙋🏻♂️