Skip to content

Commit

Permalink
fix bazel with --override_repository
Browse files Browse the repository at this point in the history
  • Loading branch information
Travis Clarke committed Nov 21, 2019
1 parent 5f61401 commit 518f0fc
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Makefile.core.mk
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ BAZEL_CONFIG_ASAN = --config=macos-asan
BAZEL_CONFIG_TSAN = # no working config
endif

BAZEL_OUTPUT_PATH := $(shell bazel info output_path)
BAZEL_OUTPUT_PATH := $(shell bazel info $(BAZEL_BUILD_ARGS) output_path)
BAZEL_ENVOY_PATH ?= $(BAZEL_OUTPUT_PATH)/k8-fastbuild/bin/src/envoy/envoy

build:
Expand Down
20 changes: 10 additions & 10 deletions prow/proxy-common.inc
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,17 @@ ROOT=/go/src
# Configure available resources and disable IPv6 tests.
export BAZEL_BUILD_ARGS="--local_ram_resources=12288 --local_cpu_resources=8 --verbose_failures --test_env=ENVOY_IP_TEST_VERSIONS=v4only --test_output=errors"

# Override envoy.
if [[ "${ENVOY_REPOSITORY:-}" && "${ENVOY_PREFIX:-}" ]]; then
TMP_DIR=$(mktemp -d -t envoy-XXXXXXXXXX)
trap 'rm -rf ${TMP_DIR:?}' EXIT
ENVOY_SHA="${ENVOY_SHA:-$(grep -Pom1 "^ENVOY_SHA = \"\K[a-zA-Z0-9]{40}" "$WORKSPACE")}"
BAZEL_BUILD_ARGS="${BAZEL_BUILD_ARGS} --override_repository=envoy=${TMP_DIR}/${ENVOY_PREFIX}-${ENVOY_SHA}"
curl -nsSfL "${ENVOY_REPOSITORY}/archive/${ENVOY_SHA}.tar.gz" | tar -C "${TMP_DIR}" -xz
fi
# e2e tests under //test/envoye2e/... use Bazel artifacts.
export BAZEL_OUT="$(bazel info output_path)/k8-fastbuild/bin"
export BAZEL_OUT="$(bazel info ${BAZEL_BUILD_ARGS} output_path)/k8-fastbuild/bin"
# Use GCP service account when available.
if [[ -n "${GOOGLE_APPLICATION_CREDENTIALS:-}" ]]; then
Expand All @@ -46,12 +55,3 @@ if [[ -n "${GOOGLE_APPLICATION_CREDENTIALS:-}" ]]; then
export BAZEL_BUILD_ARGS="${BAZEL_BUILD_ARGS} --google_credentials=${GOOGLE_APPLICATION_CREDENTIALS} --config=remote-clang-libc++ --config=remote-ci --remote_instance_name=${BAZEL_BUILD_RBE_INSTANCE} --jobs=${BAZEL_BUILD_RBE_JOBS}"
fi
fi

# Override envoy.
if [[ "${ENVOY_REPOSITORY:-}" && "${ENVOY_PREFIX:-}" ]]; then
TMP_DIR=$(mktemp -d -t envoy-XXXXXXXXXX)
trap 'rm -rf ${TMP_DIR:?}' EXIT
ENVOY_SHA="${ENVOY_SHA:-$(grep -Pom1 "^ENVOY_SHA = \"\K[a-zA-Z0-9]{40}" "$WORKSPACE")}"
BAZEL_BUILD_ARGS="${BAZEL_BUILD_ARGS} --override_repository=envoy=${TMP_DIR}/${ENVOY_PREFIX}-${ENVOY_SHA}"
curl -nsSfL "${ENVOY_REPOSITORY}/archive/${ENVOY_SHA}.tar.gz" | tar -C "${TMP_DIR}" -xz
fi
2 changes: 1 addition & 1 deletion scripts/push-debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ fi
# Symlinks don't work, use full path as a temporary workaround.
# See: https://github.com/istio/istio/issues/15714 for details.
# k8-opt is the output directory for x86_64 optimized builds (-c opt, so --config=release-symbol and --config=release).
BAZEL_OUT="$(bazel info output_path)/k8-opt/bin"
BAZEL_OUT="$(bazel info ${BAZEL_BUILD_ARGS} output_path)/k8-opt/bin"
BAZEL_BINARY="${BAZEL_OUT}/tools/deb/istio-proxy"

bazel build ${BAZEL_BUILD_ARGS} --config=release ${BAZEL_TARGET}
Expand Down
8 changes: 4 additions & 4 deletions scripts/release-binary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,27 +98,27 @@ do
CONFIG_PARAMS="--config=release"
BINARY_BASE_NAME="envoy-alpha"
PACKAGE_BASE_NAME="istio-proxy"
BAZEL_OUT="$(bazel info output_path)/k8-opt/bin"
BAZEL_OUT="$(bazel info ${BAZEL_BUILD_ARGS} output_path)/k8-opt/bin"
;;
"release-symbol")
CONFIG_PARAMS="--config=release-symbol"
BINARY_BASE_NAME="envoy-symbol"
PACKAGE_BASE_NAME=""
BAZEL_OUT="$(bazel info output_path)/k8-opt/bin"
BAZEL_OUT="$(bazel info ${BAZEL_BUILD_ARGS} output_path)/k8-opt/bin"
;;
"asan")
# NOTE: libc++ is dynamically linked in this build.
PUSH_DOCKER_IMAGE=""
CONFIG_PARAMS="${BAZEL_CONFIG_ASAN} --config=release-symbol"
BINARY_BASE_NAME="envoy-asan"
PACKAGE_BASE_NAME=""
BAZEL_OUT="$(bazel info output_path)/k8-opt/bin"
BAZEL_OUT="$(bazel info ${BAZEL_BUILD_ARGS} output_path)/k8-opt/bin"
;;
"debug")
CONFIG_PARAMS="--config=debug"
BINARY_BASE_NAME="envoy-debug"
PACKAGE_BASE_NAME="istio-proxy-debug"
BAZEL_OUT="$(bazel info output_path)/k8-dbg/bin"
BAZEL_OUT="$(bazel info ${BAZEL_BUILD_ARGS} output_path)/k8-dbg/bin"
;;
esac

Expand Down

0 comments on commit 518f0fc

Please sign in to comment.