Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci/codeql: Fix build setup #36021

Merged
merged 1 commit into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,7 @@ build:rbe-toolchain-clang-libc++ --action_env=CXXFLAGS=-stdlib=libc++
build:rbe-toolchain-clang-libc++ --action_env=LDFLAGS=-stdlib=libc++
build:rbe-toolchain-clang-libc++ --define force_libcpp=enabled

# Do not inherit from "clang-asan" to avoid picking up flags from local clang.bazelrc.
build:rbe-toolchain-asan --config=asan
build:rbe-toolchain-asan --config=clang-asan
build:rbe-toolchain-asan --linkopt -fuse-ld=lld
build:rbe-toolchain-asan --action_env=ENVOY_UBSAN_VPTR=1
build:rbe-toolchain-asan --copt=-fsanitize=vptr,function
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/codeql-daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,18 @@ jobs:
cd bin/clang14
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-14.0.0/clang+llvm-14.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz
tar -xf clang+llvm-14.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz --strip-components 1
export PATH=bin/clang14/bin:$PATH
- name: Build
run: |
bazel/setup_clang.sh bin/clang14
bazelisk shutdown
bazelisk build -c fastbuild --spawn_strategy=local --discard_analysis_cache --nouse_action_cache --config clang --config libc++ \
bazel build \
-c fastbuild \
--spawn_strategy=local \
--discard_analysis_cache \
--nouse_action_cache \
--config=clang-libc++ \
--config=ci \
//source/common/http/...
- name: Clean Artifacts
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/codeql-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ jobs:
cd bin/clang14
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-14.0.0/clang+llvm-14.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz
tar -xf clang+llvm-14.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz --strip-components 1
export PATH=bin/clang14/bin:$PATH
- name: Build
if: ${{ env.BUILD_TARGETS != '' }}
Expand All @@ -97,8 +96,8 @@ jobs:
--spawn_strategy=local \
--discard_analysis_cache \
--nouse_action_cache \
--config clang \
--config libc++ \
--config=clang-libc++ \
--config=ci \
$BUILD_TARGETS
echo -e "Built targets...\n$BUILD_TARGETS"
Expand Down
3 changes: 3 additions & 0 deletions bazel/setup_clang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@ fi
LLVM_VERSION="$("${LLVM_CONFIG}" --version)"
LLVM_LIBDIR="$("${LLVM_CONFIG}" --libdir)"
LLVM_TARGET="$("${LLVM_CONFIG}" --host-target)"
PATH="$("${LLVM_CONFIG}" --bindir):${PATH}"

RT_LIBRARY_PATH="${LLVM_LIBDIR}/clang/${LLVM_VERSION}/lib/${LLVM_TARGET}"

cat <<EOF > "${BAZELRC_FILE}"
# Generated file, do not edit. If you want to disable clang, just delete this file.
build:clang --host_action_env=PATH=${PATH} --action_env=PATH=${PATH}
build:clang --action_env=LLVM_CONFIG=${LLVM_CONFIG} --host_action_env=LLVM_CONFIG=${LLVM_CONFIG}
build:clang --repo_env=LLVM_CONFIG=${LLVM_CONFIG}
build:clang --linkopt=-L${LLVM_LIBDIR}
Expand Down
10 changes: 6 additions & 4 deletions ci/build_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,12 @@ export BAZEL_STARTUP_OPTION_LIST
export BAZEL_BUILD_OPTION_LIST
export BAZEL_GLOBAL_OPTION_LIST

if [[ -e "${LLVM_ROOT}" ]]; then
"${CURRENT_SCRIPT_DIR}/../bazel/setup_clang.sh" "${LLVM_ROOT}"
else
echo "LLVM_ROOT not found, not setting up llvm."
if [[ -z "${ENVOY_RBE}" ]]; then
if [[ -e "${LLVM_ROOT}" ]]; then
"${CURRENT_SCRIPT_DIR}/../bazel/setup_clang.sh" "${LLVM_ROOT}"
else
echo "LLVM_ROOT not found, not setting up llvm."
fi
fi

[[ "${BAZEL_EXPUNGE}" == "1" ]] && bazel clean "${BAZEL_BUILD_OPTIONS[@]}" --expunge
Expand Down
7 changes: 6 additions & 1 deletion ci/do_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -351,9 +351,14 @@ case $CI_TARGET in

asan)
setup_clang_toolchain
if [[ -n "$ENVOY_RBE" ]]; then
ASAN_CONFIG="--config=rbe-toolchain-asan"
else
ASAN_CONFIG="--config=clang-asan"
fi
BAZEL_BUILD_OPTIONS+=(
-c dbg
"--config=clang-asan"
"${ASAN_CONFIG}"
"--build_tests_only"
"--remote_download_minimal")
echo "bazel ASAN/UBSAN debug build with tests"
Expand Down
2 changes: 1 addition & 1 deletion ci/filter_example_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ cp -a "${ENVOY_SRCDIR}"/bazel/protoc "${ENVOY_FILTER_EXAMPLE_SRCDIR}"/bazel/
cp -f "${ENVOY_SRCDIR}"/.bazelrc "${ENVOY_FILTER_EXAMPLE_SRCDIR}"/
rm -f "${ENVOY_FILTER_EXAMPLE_SRCDIR}"/.bazelversion
cp -f "${ENVOY_SRCDIR}"/.bazelversion "${ENVOY_FILTER_EXAMPLE_SRCDIR}"/
cp -f "${ENVOY_SRCDIR}"/*.bazelrc "${ENVOY_FILTER_EXAMPLE_SRCDIR}"/
cp -f "${ENVOY_SRCDIR}"/*.bazelrc "${ENVOY_FILTER_EXAMPLE_SRCDIR}"/ || :

export FILTER_WORKSPACE_SET=1