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

release-22.2: roachtest: metamorphic ARM64 and FIPS clusters #104691

Merged
merged 2 commits into from
Jun 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions pkg/build/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ go_library(
"github.com/cockroachdb/cockroach/pkg/build.utcTime": "{BUILD_UTCTIME}",
},
deps = [
"//pkg/util/buildutil",
"//pkg/util/envutil",
"//pkg/util/version",
],
Expand Down
38 changes: 21 additions & 17 deletions pkg/build/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"text/tabwriter"
"time"

"github.com/cockroachdb/cockroach/pkg/util/buildutil"
"github.com/cockroachdb/cockroach/pkg/util/envutil"
"github.com/cockroachdb/cockroach/pkg/util/version"
)
Expand All @@ -35,11 +36,12 @@ var (
cgoTargetTriple string
platform = fmt.Sprintf("%s %s", runtime.GOOS, runtime.GOARCH)
// Distribution is changed by the CCL init-time hook in non-APL builds.
Distribution = "OSS"
typ string // Type of this build: <empty>, "development", or "release"
channel = "unknown"
envChannel = envutil.EnvOrDefaultString("COCKROACH_CHANNEL", "unknown")
binaryVersion = computeVersion(tag)
Distribution = "OSS"
typ string // Type of this build: <empty>, "development", or "release"
channel = "unknown"
envChannel = envutil.EnvOrDefaultString("COCKROACH_CHANNEL", "unknown")
enabledAssertions = buildutil.CrdbTestBuild
binaryVersion = computeVersion(tag)
)

const (
Expand Down Expand Up @@ -113,7 +115,8 @@ func (b Info) Long() string {
fmt.Fprintf(tw, "Go Version: %s\n", b.GoVersion)
fmt.Fprintf(tw, "C Compiler: %s\n", b.CgoCompiler)
fmt.Fprintf(tw, "Build Commit ID: %s\n", b.Revision)
fmt.Fprintf(tw, "Build Type: %s", b.Type) // No final newline: cobra prints one for us.
fmt.Fprintf(tw, "Build Type: %s\n", b.Type)
fmt.Fprintf(tw, "Enabled Assertions: %t", b.EnabledAssertions) // No final newline: cobra prints one for us.
_ = tw.Flush()
return buf.String()
}
Expand All @@ -139,17 +142,18 @@ func (b Info) Timestamp() (int64, error) {
// GetInfo returns an Info struct populated with the build information.
func GetInfo() Info {
return Info{
GoVersion: runtime.Version(),
Tag: tag,
Time: utcTime,
Revision: rev,
CgoCompiler: cgoCompiler,
CgoTargetTriple: cgoTargetTriple,
Platform: platform,
Distribution: Distribution,
Type: typ,
Channel: channel,
EnvChannel: envChannel,
GoVersion: runtime.Version(),
Tag: tag,
Time: utcTime,
Revision: rev,
CgoCompiler: cgoCompiler,
CgoTargetTriple: cgoTargetTriple,
Platform: platform,
Distribution: Distribution,
Type: typ,
Channel: channel,
EnvChannel: envChannel,
EnabledAssertions: enabledAssertions,
}
}

Expand Down
2 changes: 2 additions & 0 deletions pkg/build/info.proto
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ message Info {
optional string channel = 9 [(gogoproto.nullable) = false];
// env_channel identifies the product channel as overridden by the COCKROACH_CHANNEL environment variable.
optional string env_channel = 11 [(gogoproto.nullable) = false];
// enabled_assertions returns the value of 'CrdbTestBuild' (true iff compiled with 'crdb_test' tag)
optional bool enabled_assertions = 12 [(gogoproto.nullable) = false];

// dependencies exists to allow tests that run against old clusters
// to unmarshal JSON containing this field. The tag is unimportant,
Expand Down
9 changes: 7 additions & 2 deletions pkg/cmd/roachprod/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ var (
extendLifetime time.Duration
wipePreserveCerts bool
grafanaConfig string
grafanaArch string
grafanaurlOpen bool
grafanaDumpDir string
listDetails bool
Expand Down Expand Up @@ -107,8 +108,9 @@ func initFlags() {
vm.AllProviderNames()))
createCmd.Flags().BoolVar(&createVMOpts.GeoDistributed,
"geo", false, "Create geo-distributed cluster")
createCmd.Flags().BoolVar(&createVMOpts.EnableFIPS,
"fips", false, "Enable FIPS mode (uses custom AMI)")
createCmd.Flags().StringVar(&createVMOpts.Arch, "arch", "",
"architecture override for VM [amd64, arm64, fips]; N.B. fips implies amd64 with openssl")

// N.B. We set "usage=roachprod" as the default, custom label for billing tracking.
createCmd.Flags().StringToStringVar(&createVMOpts.CustomLabels,
"label", map[string]string{"usage": "roachprod"},
Expand Down Expand Up @@ -249,6 +251,9 @@ func initFlags() {
grafanaStartCmd.Flags().StringVar(&grafanaConfig,
"grafana-config", "", "URL to grafana json config")

grafanaStartCmd.Flags().StringVar(&grafanaArch, "arch", "",
"binary architecture override [amd64, arm64]")

grafanaURLCmd.Flags().BoolVar(&grafanaurlOpen,
"open", false, "open the grafana dashboard url on the browser")

Expand Down
17 changes: 11 additions & 6 deletions pkg/cmd/roachprod/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ hosts file.
c.PrintDetails(roachprodLibraryLogger)
} else {
fmt.Fprintf(tw, "%s\t%s\t%d", c.Name, c.Clouds(), len(c.VMs))

if !c.IsLocal() {
fmt.Fprintf(tw, "\t(%s)", c.LifetimeRemaining().Round(time.Second))
} else {
Expand Down Expand Up @@ -904,10 +905,14 @@ var grafanaStartCmd = &cobra.Command{
Use: `grafana-start <cluster>`,
Short: `spins up a prometheus and grafana instances on the last node in the cluster`,
Long: `spins up a prometheus and grafana instances on the highest numbered node in the cluster
and will scrape from all nodes in the cluster`,
and will scrape from all nodes in the cluster; NOTE: for arm64 clusters, use --arch arm64`,
Args: cobra.ExactArgs(1),
Run: wrap(func(cmd *cobra.Command, args []string) error {
return roachprod.StartGrafana(context.Background(), roachprodLibraryLogger, args[0],
arch := vm.ArchAMD64
if grafanaArch == "arm64" {
arch = vm.ArchARM64
}
return roachprod.StartGrafana(context.Background(), roachprodLibraryLogger, args[0], arch,
grafanaConfig, nil)
}),
}
Expand Down Expand Up @@ -954,14 +959,14 @@ func validateAndConfigure(cmd *cobra.Command, args []string) {

// Validate architecture flag, if set.
if archOpt := cmd.Flags().Lookup("arch"); archOpt != nil && archOpt.Changed {
arch := strings.ToLower(archOpt.Value.String())
arch := vm.CPUArch(strings.ToLower(archOpt.Value.String()))

if arch != "amd64" && arch != "arm64" && arch != "fips" {
if arch != vm.ArchAMD64 && arch != vm.ArchARM64 && arch != vm.ArchFIPS {
printErrAndExit(fmt.Errorf("unsupported architecture %q", arch))
}
if arch != archOpt.Value.String() {
if string(arch) != archOpt.Value.String() {
// Set the canonical value.
_ = cmd.Flags().Set("arch", arch)
_ = cmd.Flags().Set("arch", string(arch))
}
}
}
Expand Down
Loading