From 4bee29f6fd344dc062345f13c239f0554c0eb960 Mon Sep 17 00:00:00 2001 From: Ahmad Abedalqader Date: Thu, 4 Nov 2021 07:46:58 -0700 Subject: [PATCH] roachprod: fix `roachprod start` ignoring --binary flag Merging #71660 introduced a bug where roachprod ignores --binary flag when running `roachprod start`. This patch reverts to the old way of setting config.Binary. Release note: None Fixes #72425 --- pkg/cmd/roachprod/main.go | 33 ++++++++++++++++----------------- pkg/roachprod/roachprod.go | 3 +-- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/pkg/cmd/roachprod/main.go b/pkg/cmd/roachprod/main.go index 0f6d3be38e51..2fddaf87737d 100644 --- a/pkg/cmd/roachprod/main.go +++ b/pkg/cmd/roachprod/main.go @@ -62,21 +62,20 @@ destroy the cluster. } var ( - numNodes int - numRacks int - username string - dryrun bool - destroyAllMine bool - extendLifetime time.Duration - wipePreserveCerts bool - listDetails bool - listJSON bool - listMine bool - listPattern string - sqlCockroachBinary = "cockroach" - secure = false - extraSSHOptions = "" - nodeEnv = []string{ + numNodes int + numRacks int + username string + dryrun bool + destroyAllMine bool + extendLifetime time.Duration + wipePreserveCerts bool + listDetails bool + listJSON bool + listMine bool + listPattern string + secure = false + extraSSHOptions = "" + nodeEnv = []string{ "COCKROACH_ENABLE_RPC_COMPRESSION=false", "COCKROACH_UI_RELEASE_NOTES_SIGNUP_DISMISSED=true", } @@ -874,7 +873,7 @@ var sqlCmd = &cobra.Command{ Quiet: quiet, UseTreeDist: useTreeDist, Args: nodeArgs, Env: nodeEnv, NumRacks: numRacks, MaxConcurrency: maxConcurrency, } - return roachprod.SQL(clusterOpts, sqlCockroachBinary, args[1:]) + return roachprod.SQL(clusterOpts, args[1:]) }), } @@ -1229,7 +1228,7 @@ func main() { fallthrough case sqlCmd: cmd.Flags().StringVarP( - &sqlCockroachBinary, "binary", "b", "cockroach", + &config.Binary, "binary", "b", config.Binary, "the remote cockroach binary to use") fallthrough case pgurlCmd, adminurlCmd: diff --git a/pkg/roachprod/roachprod.go b/pkg/roachprod/roachprod.go index 76b0b839a87f..1669260f691a 100644 --- a/pkg/roachprod/roachprod.go +++ b/pkg/roachprod/roachprod.go @@ -429,8 +429,7 @@ func Run(clusterOpts install.SyncedCluster, SSHOptions string, cmdArray []string } // SQL runs `cockroach sql` on a remote cluster. -func SQL(clusterOpts install.SyncedCluster, remoteCockroachBinary string, cmdArray []string) error { - config.Binary = remoteCockroachBinary +func SQL(clusterOpts install.SyncedCluster, cmdArray []string) error { c, err := newCluster(clusterOpts) if err != nil { return err