Skip to content

Commit

Permalink
dev: fix staging error post-dev build tests
Browse files Browse the repository at this point in the history
We were treating the test target as a `go_binary`, therefore trying to
stage it.

Release note: None
  • Loading branch information
irfansharif committed Apr 7, 2022
1 parent d40c144 commit 74c39f4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion dev
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -euo pipefail

# Bump this counter to force rebuilding `dev` on all machines.
DEV_VERSION=28
DEV_VERSION=29

THIS_DIR=$(cd "$(dirname "$0")" && pwd)
BINARY_DIR=$THIS_DIR/bin/dev-versions
Expand Down
9 changes: 5 additions & 4 deletions pkg/cmd/dev/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,9 @@ func makeBuildCmd(runE func(cmd *cobra.Command, args []string) error) *cobra.Com
}

// TODO(irfansharif): Add grouping shorthands like "all" or "bins", etc.
// TODO(irfansharif): Make sure all the relevant binary targets are defined
// above, and in usage docs.

// buildTargetMapping maintains shorthands that map 1:1 with bazel targets.
var buildTargetMapping = map[string]string{
"all_tests": "//pkg:all_tests",
"bazel-remote": bazelRemoteTarget,
"buildifier": "@com_github_bazelbuild_buildtools//buildifier:buildifier",
"buildozer": "@com_github_bazelbuild_buildtools//buildozer:buildozer",
Expand Down Expand Up @@ -337,7 +334,11 @@ func (d *dev) getBasicBuildArgs(
}

args = append(args, aliased)
buildTargets = append(buildTargets, buildTarget{fullName: aliased, kind: "go_binary"})
if aliased == "//pkg:all_tests" {
buildTargets = append(buildTargets, buildTarget{fullName: aliased, kind: "test_suite"})
} else {
buildTargets = append(buildTargets, buildTarget{fullName: aliased, kind: "go_binary"})
}
}

// Add --config=with_ui iff we're building a target that needs it.
Expand Down
8 changes: 8 additions & 0 deletions pkg/cmd/dev/testdata/datadriven/dev-build
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,11 @@ mkdir crdb-checkout/bin
bazel info bazel-bin --color=no
rm crdb-checkout/bin/stress
cp sandbox/external/com_github_cockroachdb_stress/stress_/stress crdb-checkout/bin/stress

exec
dev build tests
----
bazel build //pkg:all_tests
bazel info workspace --color=no
mkdir crdb-checkout/bin
bazel info bazel-bin --color=no

0 comments on commit 74c39f4

Please sign in to comment.