Skip to content
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 deb and rpm package upgrade validation #94

Merged
merged 14 commits into from
Jul 11, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions pipelines/package_validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,15 +239,19 @@ func validateTarball(ctx context.Context, d *dagger.Client, pkg *dagger.File, sr
// validateLicense uses the given container and license path to validate the license for each edition (enterprise or oss)
func validateLicense(ctx context.Context, service *dagger.Container, licensePath string, taropts TarFileOpts) error {
license, err := service.File(licensePath).Contents(ctx)
if err != nil {
return err
}

if taropts.Edition == "enterprise" {
if err != nil || !strings.Contains(license, "Grafana Enterprise") {
return fmt.Errorf("failed to validate enterprise license")
if !strings.Contains(license, "Grafana Enterprise") {
return fmt.Errorf("license in package does not match edition in package name")
}
}

if taropts.Edition == "" {
if err != nil || !strings.Contains(license, "GNU AFFERO GENERAL PUBLIC LICENSE") {
return fmt.Errorf("failed to validate open-source license")
if !strings.Contains(license, "GNU AFFERO GENERAL PUBLIC LICENSE") {
return fmt.Errorf("license in package does not match edition in package name")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in these contexts we know what to expect; we should be clearer about what we expect vs what was given. "license in package is not the Grafana Enterprise license agreement", for example.

}
}

Expand Down