mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Build: Add CloudMode to build versions (#65651)
* Add CloudMode to build versions * Use linux-amd64 variant without musl for cloud mode * Add cloud mode to version folder on package upload * Use musl variant for CloudMode * Only sign rpm packages if there's any to sign * Remove trailing whitespace
This commit is contained in:
parent
96e9e80739
commit
8f282b8a6e
@ -145,7 +145,7 @@ func getVersionFolder(cfg uploadConfig, event string) (string, error) {
|
|||||||
return releaseFolder, nil
|
return releaseFolder, nil
|
||||||
case config.MainMode, config.DownstreamMode:
|
case config.MainMode, config.DownstreamMode:
|
||||||
return mainFolder, nil
|
return mainFolder, nil
|
||||||
case config.ReleaseBranchMode:
|
case config.ReleaseBranchMode, config.CloudMode:
|
||||||
return releaseBranchFolder, nil
|
return releaseBranchFolder, nil
|
||||||
default:
|
default:
|
||||||
// Corner case for custom enterprise2 mode
|
// Corner case for custom enterprise2 mode
|
||||||
|
@ -123,6 +123,7 @@ func CheckDroneTargetBranch() (VersionMode, error) {
|
|||||||
func CheckSemverSuffix() (ReleaseMode, error) {
|
func CheckSemverSuffix() (ReleaseMode, error) {
|
||||||
reBetaRls := regexp.MustCompile(`beta.*`)
|
reBetaRls := regexp.MustCompile(`beta.*`)
|
||||||
reTestRls := regexp.MustCompile(`test.*`)
|
reTestRls := regexp.MustCompile(`test.*`)
|
||||||
|
reCloudRls := regexp.MustCompile(`cloud.*`)
|
||||||
tagSuffix, ok := os.LookupEnv("DRONE_SEMVER_PRERELEASE")
|
tagSuffix, ok := os.LookupEnv("DRONE_SEMVER_PRERELEASE")
|
||||||
if !ok || tagSuffix == "" {
|
if !ok || tagSuffix == "" {
|
||||||
fmt.Println("DRONE_SEMVER_PRERELEASE doesn't exist for a tag, this is a release event...")
|
fmt.Println("DRONE_SEMVER_PRERELEASE doesn't exist for a tag, this is a release event...")
|
||||||
@ -133,6 +134,8 @@ func CheckSemverSuffix() (ReleaseMode, error) {
|
|||||||
return ReleaseMode{Mode: TagMode, IsBeta: true}, nil
|
return ReleaseMode{Mode: TagMode, IsBeta: true}, nil
|
||||||
case reTestRls.MatchString(tagSuffix):
|
case reTestRls.MatchString(tagSuffix):
|
||||||
return ReleaseMode{Mode: TagMode, IsTest: true}, nil
|
return ReleaseMode{Mode: TagMode, IsTest: true}, nil
|
||||||
|
case reCloudRls.MatchString(tagSuffix):
|
||||||
|
return ReleaseMode{Mode: CloudMode}, nil
|
||||||
default:
|
default:
|
||||||
fmt.Printf("DRONE_SEMVER_PRERELEASE is custom string, release event with %s suffix\n", tagSuffix)
|
fmt.Printf("DRONE_SEMVER_PRERELEASE is custom string, release event with %s suffix\n", tagSuffix)
|
||||||
return ReleaseMode{Mode: TagMode}, nil
|
return ReleaseMode{Mode: TagMode}, nil
|
||||||
|
@ -11,6 +11,7 @@ const (
|
|||||||
DownstreamMode VersionMode = "downstream"
|
DownstreamMode VersionMode = "downstream"
|
||||||
Enterprise2Mode VersionMode = "enterprise2"
|
Enterprise2Mode VersionMode = "enterprise2"
|
||||||
CronjobMode VersionMode = "cron"
|
CronjobMode VersionMode = "cron"
|
||||||
|
CloudMode VersionMode = "cloud"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -204,4 +204,31 @@ var Versions = VersionMap{
|
|||||||
StorybookSrcDir: "artifacts/storybook",
|
StorybookSrcDir: "artifacts/storybook",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
CloudMode: {
|
||||||
|
Variants: []Variant{
|
||||||
|
VariantLinuxAmd64Musl,
|
||||||
|
},
|
||||||
|
PluginSignature: PluginSignature{
|
||||||
|
Sign: true,
|
||||||
|
AdminSign: true,
|
||||||
|
},
|
||||||
|
Docker: Docker{
|
||||||
|
ShouldSave: true,
|
||||||
|
Architectures: []Architecture{
|
||||||
|
ArchAMD64,
|
||||||
|
},
|
||||||
|
Distribution: []Distribution{
|
||||||
|
Alpine,
|
||||||
|
},
|
||||||
|
PrereleaseBucket: "grafana-prerelease/artifacts/docker",
|
||||||
|
},
|
||||||
|
Buckets: Buckets{
|
||||||
|
Artifacts: "grafana-prerelease/artifacts/downloads",
|
||||||
|
ArtifactsEnterprise2: "grafana-prerelease/artifacts/downloads-enterprise2",
|
||||||
|
CDNAssets: "grafana-prerelease",
|
||||||
|
CDNAssetsDir: "artifacts/static-assets",
|
||||||
|
Storybook: "grafana-prerelease",
|
||||||
|
StorybookSrcDir: "artifacts/storybook",
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
@ -184,30 +184,32 @@ func signRPMPackages(edition config.Edition, cfg config.Config, grafanaDir strin
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
rpmArgs := append([]string{"--addsign"}, rpms...)
|
if len(rpms) > 0 {
|
||||||
log.Printf("Invoking rpm with args: %+v", rpmArgs)
|
rpmArgs := append([]string{"--addsign"}, rpms...)
|
||||||
//nolint:gosec
|
log.Printf("Invoking rpm with args: %+v", rpmArgs)
|
||||||
cmd := exec.Command("rpm", rpmArgs...)
|
|
||||||
if output, err := cmd.CombinedOutput(); err != nil {
|
|
||||||
return fmt.Errorf("failed to sign RPM packages: %s", output)
|
|
||||||
}
|
|
||||||
if err := os.Remove(cfg.GPGPassPath); err != nil {
|
|
||||||
return fmt.Errorf("failed to remove %q: %w", cfg.GPGPassPath, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
log.Printf("Verifying %s RPM packages...", edition)
|
|
||||||
// The output changed between rpm versions
|
|
||||||
reOutput := regexp.MustCompile("(?:digests signatures OK)|(?:pgp.+OK)")
|
|
||||||
for _, p := range rpms {
|
|
||||||
//nolint:gosec
|
//nolint:gosec
|
||||||
cmd := exec.Command("rpm", "-K", p)
|
cmd := exec.Command("rpm", rpmArgs...)
|
||||||
output, err := cmd.CombinedOutput()
|
if output, err := cmd.CombinedOutput(); err != nil {
|
||||||
if err != nil {
|
return fmt.Errorf("failed to sign RPM packages: %s", output)
|
||||||
return fmt.Errorf("failed to verify RPM signature: %w", err)
|
}
|
||||||
|
if err := os.Remove(cfg.GPGPassPath); err != nil {
|
||||||
|
return fmt.Errorf("failed to remove %q: %w", cfg.GPGPassPath, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !reOutput.Match(output) {
|
log.Printf("Verifying %s RPM packages...", edition)
|
||||||
return fmt.Errorf("RPM package %q not verified: %s", p, output)
|
// The output changed between rpm versions
|
||||||
|
reOutput := regexp.MustCompile("(?:digests signatures OK)|(?:pgp.+OK)")
|
||||||
|
for _, p := range rpms {
|
||||||
|
//nolint:gosec
|
||||||
|
cmd := exec.Command("rpm", "-K", p)
|
||||||
|
output, err := cmd.CombinedOutput()
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to verify RPM signature: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !reOutput.Match(output) {
|
||||||
|
return fmt.Errorf("RPM package %q not verified: %s", p, output)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user