Skip to content

Commit

Permalink
roachprod: fix roachprod start ignoring --binary flag
Browse files Browse the repository at this point in the history
Merging cockroachdb#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 cockroachdb#72425
  • Loading branch information
Ahmad Abedalqader committed Nov 4, 2021
1 parent f84b8e7 commit 4bee29f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 19 deletions.
33 changes: 16 additions & 17 deletions pkg/cmd/roachprod/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
}
Expand Down Expand Up @@ -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:])
}),
}

Expand Down Expand Up @@ -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:
Expand Down
3 changes: 1 addition & 2 deletions pkg/roachprod/roachprod.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4bee29f

Please sign in to comment.