From 7de11bc046c4ef541dda5140b18e989f0d8c55b0 Mon Sep 17 00:00:00 2001 From: Greg Magolan Date: Mon, 2 Oct 2023 14:33:47 -0700 Subject: [PATCH] chore: switch to Buildbuddy for RBE testing --- .bazelrc | 23 +++++++++++++++ .github/workflows/.bazelrc.ci | 26 ----------------- .github/workflows/configurebb.sh | 9 ++++++ .github/workflows/default.yaml | 49 +++++++++++++------------------- .github/workflows/engflow.sh | 29 ------------------- 5 files changed, 51 insertions(+), 85 deletions(-) delete mode 100644 .github/workflows/.bazelrc.ci create mode 100755 .github/workflows/configurebb.sh delete mode 100755 .github/workflows/engflow.sh diff --git a/.bazelrc b/.bazelrc index 5a5798f..c22ed55 100644 --- a/.bazelrc +++ b/.bazelrc @@ -42,4 +42,27 @@ build:ubsan --features ubsan build:ubsan --strip never build:ubsan --action_env UBSAN_OPTIONS=halt_on_error=1:print_stacktrace=1 +build:ci --keep_going + +# Generic remote cache +build:ci --remote_download_toplevel +build:ci --remote_timeout=3600 +build:ci --remote_upload_local_results + +# Generic remote build execution +build:rbe --host_platform=//platforms:x86_64_linux_remote +build:rbe --extra_execution_platforms=//platforms:x86_64_linux_remote +build:rbe --cpu k8 +build:rbe --crosstool_top=@gcc_toolchain_x86_64//:_cc_toolchain +build:rbe --strategy=remote +build:rbe --genrule_strategy=remote +build:rbe --spawn_strategy=remote +build:rbe --jobs=32 + +# BuildBuddy remote exec +build:rbe --bes_results_url=https://app.buildbuddy.io/invocation/ +build:rbe --bes_backend=grpcs://remote.buildbuddy.io +build:rbe --remote_timeout=3600 +build:rbe --remote_executor=grpcs://remote.buildbuddy.io + try-import %workspace%/.bazelrc.user diff --git a/.github/workflows/.bazelrc.ci b/.github/workflows/.bazelrc.ci deleted file mode 100644 index eda782b..0000000 --- a/.github/workflows/.bazelrc.ci +++ /dev/null @@ -1,26 +0,0 @@ -build --keep_going - -# Generic remote cache -build --remote_download_toplevel -build --remote_timeout=3600 -build --remote_upload_local_results - -# Generic remote build execution -build:rbe --host_platform=//platforms:x86_64_linux_remote -build:rbe --extra_execution_platforms=//platforms:x86_64_linux_remote -build:rbe --cpu k8 -build:rbe --crosstool_top=@gcc_toolchain_x86_64//:_cc_toolchain -build:rbe --strategy=remote -build:rbe --genrule_strategy=remote -build:rbe --spawn_strategy=remote -build:rbe --jobs=32 - -# EngFlow remote cache -build:engflow --bes_backend=grpcs://tourmaline.cluster.engflow.com -build:engflow --bes_results_url=https://tourmaline.cluster.engflow.com/invocation/ -build:engflow --remote_cache=grpcs://tourmaline.cluster.engflow.com -## Fixes builds hanging on CI that get the TCP connection closed without sending RST packets. -build:engflow --grpc_keepalive_time=30s - -# EngFlow remote build execution -build:engflow_rbe --remote_executor=grpcs://tourmaline.cluster.engflow.com diff --git a/.github/workflows/configurebb.sh b/.github/workflows/configurebb.sh new file mode 100755 index 0000000..3dadbdd --- /dev/null +++ b/.github/workflows/configurebb.sh @@ -0,0 +1,9 @@ +#!/bin/bash +set -o errexit -o nounset -o pipefail + +if [ "${BUILDBUDDY_API_KEY:-}" ]; then + touch "$HOME/.bazelrc" + chmod 0600 "$HOME/.bazelrc" + echo "build --remote_header=x-buildbuddy-api-key=$BUILDBUDDY_API_KEY" > "$HOME/.bazelrc" + echo "build --remote_cache=grpcs://remote.buildbuddy.io" +fi diff --git a/.github/workflows/default.yaml b/.github/workflows/default.yaml index a6a6c09..4f6eeb8 100644 --- a/.github/workflows/default.yaml +++ b/.github/workflows/default.yaml @@ -1,17 +1,17 @@ name: Default on: + # Triggers the workflow on push or pull request events but only for the main branch push: branches: [main] pull_request: - types: [labeled] + branches: [main] # Allows manually triggering this workflow from the Actions tab. workflow_dispatch: jobs: distros: - if: ${{ github.ref == 'refs/heads/main' }} or ${{ github.event.label.name == 'ci-test' }} strategy: matrix: os: @@ -22,12 +22,12 @@ jobs: - uses: actions/checkout@v3 - uses: bazelbuild/setup-bazelisk@v2 - name: Test - run: ./.github/workflows/engflow.sh --config engflow //... + run: | + ./.github/workflows/configurebb.sh + bazel test --config ci //... env: - ENGFLOW_CLIENT_CRT: ${{ secrets.ENGFLOW_CLIENT_CRT }} - ENGFLOW_PRIVATE_KEY: ${{ secrets.ENGFLOW_PRIVATE_KEY }} + BUILDBUDDY_API_KEY: ${{ secrets.BUILDBUDDY_API_KEY }} compilation_modes: - if: ${{ github.ref == 'refs/heads/main' }} or ${{ github.event.label.name == 'ci-test' }} strategy: matrix: compilation_mode: @@ -39,16 +39,12 @@ jobs: - uses: actions/checkout@v3 - uses: bazelbuild/setup-bazelisk@v2 - name: Test - run: |- - ./.github/workflows/engflow.sh \ - --config engflow \ - --compilation_mode ${{ matrix.compilation_mode }} \ - //... + run: | + ./.github/workflows/configurebb.sh + bazel test --config ci --compilation_mode ${{ matrix.compilation_mode }} //... env: - ENGFLOW_CLIENT_CRT: ${{ secrets.ENGFLOW_CLIENT_CRT }} - ENGFLOW_PRIVATE_KEY: ${{ secrets.ENGFLOW_PRIVATE_KEY }} + BUILDBUDDY_API_KEY: ${{ secrets.BUILDBUDDY_API_KEY }} sanitizers: - if: ${{ github.ref == 'refs/heads/main' }} or ${{ github.event.label.name == 'ci-test' }} strategy: matrix: sanitizer: @@ -61,16 +57,13 @@ jobs: - uses: actions/checkout@v3 - uses: bazelbuild/setup-bazelisk@v2 - name: Test ${{ matrix.sanitizer }} - run: |- - ./.github/workflows/engflow.sh \ - --config engflow \ - --config ${{ matrix.sanitizer }} \ - //tests/sanitizers:${{ matrix.sanitizer }}_test + run: | + ./.github/workflows/configurebb.sh + bazel test --config ci --config ${{ matrix.sanitizer }} //tests/sanitizers:${{ matrix.sanitizer }}_test env: - ENGFLOW_CLIENT_CRT: ${{ secrets.ENGFLOW_CLIENT_CRT }} - ENGFLOW_PRIVATE_KEY: ${{ secrets.ENGFLOW_PRIVATE_KEY }} + BUILDBUDDY_API_KEY: ${{ secrets.BUILDBUDDY_API_KEY }} rbe: - if: ${{ github.ref == 'refs/heads/main' }} or ${{ github.event.label.name == 'ci-test' }} + if: (github.ref == 'refs/heads/main' || contains(github.head_ref, 'rbe')) strategy: matrix: os: @@ -81,12 +74,8 @@ jobs: - uses: actions/checkout@v3 - uses: bazelbuild/setup-bazelisk@v2 - name: Test with RBE - run: |- - ./.github/workflows/engflow.sh \ - --config rbe \ - --config engflow \ - --config engflow_rbe \ - //... + run: | + ./.github/workflows/configurebb.sh + bazel test --config ci --config rbe //... env: - ENGFLOW_CLIENT_CRT: ${{ secrets.ENGFLOW_CLIENT_CRT }} - ENGFLOW_PRIVATE_KEY: ${{ secrets.ENGFLOW_PRIVATE_KEY }} + BUILDBUDDY_API_KEY: ${{ secrets.BUILDBUDDY_API_KEY }} diff --git a/.github/workflows/engflow.sh b/.github/workflows/engflow.sh deleted file mode 100755 index 6202e48..0000000 --- a/.github/workflows/engflow.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit -o nounset -o pipefail - -readonly GIT_ROOT=$(git rev-parse --show-toplevel) -cd "${GIT_ROOT}" - -cp ".github/workflows/.bazelrc.ci" ".bazelrc.user" - -readonly crt_file="engflow.crt" -readonly key_file="engflow.key" -touch "${crt_file}" -touch "${key_file}" -chmod 0600 "${crt_file}" -chmod 0600 "${key_file}" -echo "${ENGFLOW_CLIENT_CRT}" > "${crt_file}" -echo "${ENGFLOW_PRIVATE_KEY}" > "${key_file}" - -function on_exit { - rm -f "${crt_file}" - rm -f "${key_file}" -} - -trap on_exit EXIT - -bazel test \ - --tls_client_certificate="${crt_file}" \ - --tls_client_key="${key_file}" \ - "$@"