Skip to content

Commit

Permalink
Set --stamp as default build flag
Browse files Browse the repository at this point in the history
Instead of specifying it every time explicitly, put the flag in .bazelrc
and make it enabled by default for the 'build' command. Other commands
like 'run', 'test', 'coverage' will inherit it as well. The flag is
needed to include proper git revision info during linking.

Signed-off-by: Vasiliy Ulyanov <[email protected]>
  • Loading branch information
vasiliy-ul committed Dec 30, 2020
1 parent b6001eb commit 4ae22e7
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 15 deletions.
6 changes: 2 additions & 4 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# The ci.bazelrc is an untracked file that can be generated by hack/dockerized or automated/test.sh scripts as part of CI
try-import ci.bazelrc

# Set common values for all builds
build --workspace_status_command=./hack/print-workspace-status.sh --host_force_python=PY3
run --workspace_status_command=./hack/print-workspace-status.sh --host_force_python=PY3
test --workspace_status_command=./hack/print-workspace-status.sh --host_force_python=PY3
# Set common values for all builds (run, test and coverage inherit from build)
build --stamp --workspace_status_command=./hack/print-workspace-status.sh --host_force_python=PY3

# Bazel has a rule of precedence so we can specify / overwrite architecture specific commands if needed
build:x86_64 --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64_cgo
Expand Down
6 changes: 0 additions & 6 deletions hack/bazel-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,37 +29,31 @@ mkdir -p ${CMD_OUT_DIR}/dump
# Build all binaries for amd64
bazel build \
--config=${ARCHITECTURE} \
--stamp \
//tools/csv-generator/... //cmd/... //staging/src/kubevirt.io/client-go/examples/...

# Copy dump binary to a reachable place outside of the build container
bazel run \
--config=${ARCHITECTURE} \
--stamp \
:build-dump -- ${CMD_OUT_DIR}/dump/dump

# build platform native virtctl explicitly
bazel run \
--config=${ARCHITECTURE} \
--stamp \
:build-virtctl -- ${CMD_OUT_DIR}/virtctl/virtctl

# cross-compile virtctl for

# linux
bazel run \
--config=${ARCHITECTURE} \
--stamp \
:build-virtctl-amd64 -- ${CMD_OUT_DIR}/virtctl/virtctl-${KUBEVIRT_VERSION}-linux-amd64

# darwin
bazel run \
--config=${ARCHITECTURE} \
--stamp \
:build-virtctl-darwin -- ${CMD_OUT_DIR}/virtctl/virtctl-${KUBEVIRT_VERSION}-darwin-amd64

# windows
bazel run \
--config=${ARCHITECTURE} \
--stamp \
:build-virtctl-windows -- ${CMD_OUT_DIR}/virtctl/virtctl-${KUBEVIRT_VERSION}-windows-amd64.exe
1 change: 0 additions & 1 deletion hack/bazel-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ source hack/config.sh

bazel test \
--config=${ARCHITECTURE} \
--stamp \
--test_output=errors -- //staging/src/kubevirt.io/client-go/... //pkg/... //cmd/...
3 changes: 0 additions & 3 deletions hack/build-func-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,8 @@ source hack/config.sh

mkdir -p "${TESTS_OUT_DIR}/tests"
bazel run \
--stamp \
:build-ginkgo -- ${TESTS_OUT_DIR}/ginkgo
bazel run \
--stamp \
:build-functests -- ${TESTS_OUT_DIR}/tests.test
bazel run \
--stamp \
:build-junit-merger -- ${TESTS_OUT_DIR}/junit-merger
1 change: 0 additions & 1 deletion hack/coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@ source hack/common.sh

bazel coverage \
--config=${ARCHITECTURE} \
--stamp \
--features race \
--test_output=errors -- //staging/src/kubevirt.io/client-go/... //pkg/... //cmd/...

0 comments on commit 4ae22e7

Please sign in to comment.