-
Notifications
You must be signed in to change notification settings - Fork 72
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
Define beta features in spec #341
Conversation
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.
LGTM, thanks for adding this. It would be nice if we could emit warnings when beta features are used in non-GA packages too so that developers aren't surprised right when they're hoping to make a package GA. Let's consider that nice-to-have though unless it's easy to implement now.
Co-authored-by: Josh Dover <[email protected]>
I added a warning. It should appear in the console similarly to this:
|
// Release type of the spec: beta, ga. | ||
// Packages using beta features won't be able to go GA. | ||
// Default release: ga | ||
Release string `yaml:"release"` |
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 we check somewhere that we only use beta
or ga
here? Or even only 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.
I added a condition to check for "beta" and "ga" and report an error whenever there is a different level used.
if s.Release != "" && s.Release != "beta" { | ||
errs = append(errs, errors.Errorf("unsupport release level, supported values: beta, ga")) | ||
} else if s.Release == "beta" && pkg.Version.Prerelease() == "" { | ||
errs = append(errs, errors.Errorf("spec for [%s] defines beta features which can't be enabled for packages with a stable semantic version", pkg.Path(path))) | ||
} else if s.Release == "beta" && pkg.Version.Prerelease() != "" { | ||
log.Printf("Warning: package with non-stable semantic version and active beta features (enabled in [%s]) can't be released as stable version.q", pkg.Path(path)) |
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.
Nit. Use a switch for valid values to simplify conditions?
if s.Release != "" && s.Release != "beta" { | |
errs = append(errs, errors.Errorf("unsupport release level, supported values: beta, ga")) | |
} else if s.Release == "beta" && pkg.Version.Prerelease() == "" { | |
errs = append(errs, errors.Errorf("spec for [%s] defines beta features which can't be enabled for packages with a stable semantic version", pkg.Path(path))) | |
} else if s.Release == "beta" && pkg.Version.Prerelease() != "" { | |
log.Printf("Warning: package with non-stable semantic version and active beta features (enabled in [%s]) can't be released as stable version.q", pkg.Path(path)) | |
switch s.Release { | |
case "", "ga": | |
case "beta": | |
if pkg.Version.Prerelease() == "" { | |
errs = append(errs, errors.Errorf("spec for [%s] defines beta features which can't be enabled for packages with a stable semantic version", pkg.Path(path))) | |
} else { | |
log.Printf("Warning: package with non-stable semantic version and active beta features (enabled in [%s]) can't be released as stable version.q", pkg.Path(path)) | |
} | |
default: | |
errs = append(errs, errors.Errorf("unsupport release level, supported values: beta, ga")) | |
} |
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.
Fixed
This PR defines
release: beta
flag for folder specs. Requested by @joshdover in comment.Related: #328
It might be hard to test it without providing a fake spec, so I'd rather test it against #328.