-
Notifications
You must be signed in to change notification settings - Fork 43
(breaking) Prefix all envbuilder environment variables with ENVBUILDER_ #166
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
Comments
Totally makes sense. If we were to support #127, how do you imagine that would work? |
Envbuilder currently imports kaniko as a library, so I don't believe this would impact how kaniko reads its environment variables. |
So if we wanted to support all (or most) kaniko options, we would rewrite instead of passing through? |
Other kaniko options are checked in its root command (for example, I don't think we would want to prefix these with |
After discussing this on Coconut standup we want to:
|
We should only support old format until we do 1.0 that too with a deprecation message that it is going to be removed in release 1.0. |
Thinking more about how we want to make it, I wonder if we could make const prefix = "CODER_"
return serpent.OptionSet{
{
Flag: "setup-script",
Env: []string{"SETUP_SCRIPT", prefix + "SETUP_SCRIPT"},
Value: serpent.StringOf(&o.SetupScript),
Description: "...",
},
} Wdyt? |
What if we add new fields for deprecated environment |
I think you both are on to something, but I'd like to know what @ammario thinks about introducing breaking changes to the API. Another way to achieve this could be by introducing aliases, perhaps something like this: type OptionAlias struct {
Flag string `json:"flag,omitempty"`
FlagShorthand string `json:"flag_shorthand,omitempty"`
Env string `json:"env,omitempty"`
Deprecated string `json:"deprecated,omitempty"`
}
// Option is a configuration option for a CLI application.
type Option struct {
Aliases []OptionAlias `json:"aliases,omitempty"`
// ...
}
// Usage:
{
// ...
Env: "CODER_FOOBAR",
Alias: []serpent.OptionAlias{
{Env: "FOOBAR", Deprecated: "Use CODER_FOOBAR instead."},
},
}, We could then create a convenience function in envbuilder that adds the deprecated alias to an option. There already exists Ultimately, I love the idea of being able to define multiple envs for a flag. We have such use-cases in |
Re prefixing all environment variables, there is ParseEnviron for this very reason. In the meantime if envbuilder needs to support multiple environment variables, we can use UseInstead or even manipulate the Invocation.Environ before its ran. We should take any conversation about changing the serpent API to that repo to keep this tracker clean. I created an issue here for aliases. |
For consistency with
coder/coder
, we should prefix all environment variables consumed by envbuilder with the stringENVBUILDER_
.This will be a breaking change and must be done before any guarantee of future stability.
The text was updated successfully, but these errors were encountered: