Skip to content

Commit 2232422

Browse files
committed
roachtest: add build branch to roachprod's labels
Up to v24.1, roachtests Prometheus targets were discovered in GCP via the gce_sd_configs mechanism. Starting in v24.2, this mechanism has been replaced by an internal helper service, and the gce_sd_configs discovery was later removed from our Prometheus configuration. This configuration update has led to missing scraping targets for all versions prior to v24.2. And the discovery mechanism will need to be reintroduced until all supported releases are EOL. This patch introduces a new label `roachtest-branch` pushed by roachtest during roachprod cluster creation containing the version that is being tested. This will allow filtering in the Prometheus configuration in order to reenable target discovery only for versions prior to v24.2. Epic: none Release note: None
1 parent 322d3bb commit 2232422

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

pkg/cmd/roachtest/spec/cluster_spec.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package spec
77

88
import (
99
"fmt"
10+
"os"
1011
"reflect"
1112
"strings"
1213
"time"
@@ -31,6 +32,9 @@ const (
3132

3233
// Zfs file system.
3334
Zfs fileSystemType = 1
35+
36+
// Extra labels added by roachtest
37+
RoachtestBranch = "roachtest-branch"
3438
)
3539

3640
type MemPerCPU int
@@ -385,7 +389,14 @@ func (s *ClusterSpec) RoachprodOpts(
385389

386390
createVMOpts := vm.DefaultCreateOpts()
387391
// N.B. We set "usage=roachtest" as the default, custom label for billing tracking.
388-
createVMOpts.CustomLabels = map[string]string{"usage": "roachtest"}
392+
createVMOpts.CustomLabels = map[string]string{vm.TagUsage: "roachtest"}
393+
394+
branch := os.Getenv("TC_BUILD_BRANCH")
395+
if branch != "" {
396+
// If the branch is set, we add it as a custom label.
397+
createVMOpts.CustomLabels[RoachtestBranch] = vm.SanitizeLabel(branch)
398+
}
399+
389400
createVMOpts.ClusterName = "" // Will be set later.
390401
if s.Lifetime != 0 {
391402
createVMOpts.Lifetime = s.Lifetime

0 commit comments

Comments
 (0)