From 8a02cdb6b37ca8b8f57fa7d25778c6bd02ed36cd Mon Sep 17 00:00:00 2001 From: Vihang Mehta Date: Sat, 24 Jun 2023 00:08:18 -0700 Subject: [PATCH] Simplify BES config for CI (#1571) Summary: This removes unused configs and refactors common options to make the configs easier to grok. Type of change: /kind cleanup Test Plan: All the existing actions should continue to function as before. Signed-off-by: Vihang Mehta --- .github/actions/bazelrc/action.yaml | 22 ++++++------------- .github/workflows/build_and_test.yaml | 16 ++------------ .github/workflows/cli_release.yaml | 3 +-- .github/workflows/cloud_release.yaml | 3 +-- .github/workflows/operator_release.yaml | 3 +-- .github/workflows/perf_common.yaml | 4 +--- .../workflows/release_update_docs_px_dev.yaml | 1 - .github/workflows/trivy_images.yaml | 1 - .github/workflows/vizier_release.yaml | 3 +-- ci/bes-gce.bazelrc | 3 --- ci/bes-k8s.bazelrc | 3 --- ci/bes-oss-gce.bazelrc | 3 --- ci/bes-oss-k8s.bazelrc | 3 --- ci/bes.bazelrc | 3 +++ ci/github/bazelrc | 3 +++ 15 files changed, 20 insertions(+), 54 deletions(-) delete mode 100644 ci/bes-gce.bazelrc delete mode 100644 ci/bes-k8s.bazelrc delete mode 100644 ci/bes-oss-gce.bazelrc delete mode 100644 ci/bes-oss-k8s.bazelrc create mode 100644 ci/bes.bazelrc diff --git a/.github/actions/bazelrc/action.yaml b/.github/actions/bazelrc/action.yaml index 4e6ea9d4a33..af684908c6d 100644 --- a/.github/actions/bazelrc/action.yaml +++ b/.github/actions/bazelrc/action.yaml @@ -1,6 +1,6 @@ --- name: Use github bazel config -description: Uses ci/github/bazelrc, and adds BES config from ci/bes-oss-k8s.bazelrc. Must be run on self-hosted runner. +description: Uses ci/github/bazelrc, and adds BES config from ci/bes.bazelrc inputs: download_toplevel: description: 'whether to download cached toplevel files during bazel builds' @@ -8,12 +8,9 @@ inputs: dev: description: 'Whether to use DEV or CI settings for the bazelrc. defaults to dev' default: 'true' - use_remote_exec: - description: 'Use buildbuddy remote execution' - default: 'false' BB_API_KEY: - description: 'API key to use for buildbuddy if `use_remote_exec`' - default: '' + description: 'API key to use for buildbuddy' + required: true runs: using: "composite" steps: @@ -22,8 +19,11 @@ runs: cp ci/github/bazelrc github.bazelrc shell: bash - name: Copy BES bazel config + env: + BB_API_KEY: ${{ inputs.BB_API_KEY }} run: | - cp ci/bes-oss-k8s.bazelrc bes.bazelrc + cp ci/bes.bazelrc bes.bazelrc + echo "build --remote_header=x-buildbuddy-api-key=$BB_API_KEY" >> bes.bazelrc shell: bash - name: Add remote_download_outputs=toplevel if: inputs.download_toplevel == 'true' @@ -41,11 +41,3 @@ runs: run: | echo "build --build_metadata=ROLE=CI" >> github.bazelrc shell: bash - - name: Add remote execution - if: inputs.use_remote_exec == 'true' - env: - BB_API_KEY: ${{ inputs.BB_API_KEY }} - run: | - echo "build:remote --remote_header=x-buildbuddy-api-key=$BB_API_KEY" >> github.bazelrc - echo "build --config=remote" >> github.bazelrc - shell: bash diff --git a/.github/workflows/build_and_test.yaml b/.github/workflows/build_and_test.yaml index 837b29868d3..55b079d4e34 100644 --- a/.github/workflows/build_and_test.yaml +++ b/.github/workflows/build_and_test.yaml @@ -50,7 +50,6 @@ jobs: - name: get bazel config uses: ./.github/actions/bazelrc with: - use_remote_exec: 'true' BB_API_KEY: ${{ secrets.BB_IO_API_KEY }} - name: Save Diff Info run: ./ci/save_diff_info.sh @@ -81,7 +80,6 @@ jobs: uses: ./.github/actions/bazelrc with: dev: 'false' - use_remote_exec: 'true' BB_API_KEY: ${{ secrets.BB_IO_API_KEY }} - name: Collect and upload coverage env: @@ -107,7 +105,6 @@ jobs: - name: get bazel config uses: ./.github/actions/bazelrc with: - use_remote_exec: 'true' BB_API_KEY: ${{ secrets.BB_IO_API_KEY }} - name: Set matrix id: set-matrix @@ -140,19 +137,10 @@ jobs: - name: Add pwd to git safe dir run: git config --global --add safe.directory `pwd` - uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 - - name: get dev bazel config - if: github.event_name != 'push' - uses: ./.github/actions/bazelrc - with: - dev: 'true' - use_remote_exec: 'true' - BB_API_KEY: ${{ secrets.BB_IO_API_KEY }} - - name: get ci bazel config - if: github.event_name == 'push' + - name: get bazel config uses: ./.github/actions/bazelrc with: - dev: 'false' - use_remote_exec: 'true' + dev: ${{ github.event_name == 'push' && 'false' || 'true' }} BB_API_KEY: ${{ secrets.BB_IO_API_KEY }} - name: Build ${{ matrix.name }} shell: bash diff --git a/.github/workflows/cli_release.yaml b/.github/workflows/cli_release.yaml index d6b680f3380..27807293193 100644 --- a/.github/workflows/cli_release.yaml +++ b/.github/workflows/cli_release.yaml @@ -30,9 +30,8 @@ jobs: - name: get bazel config uses: ./.github/actions/bazelrc with: - use_remote_exec: 'true' - BB_API_KEY: ${{ secrets.BB_IO_API_KEY }} download_toplevel: 'true' + BB_API_KEY: ${{ secrets.BB_IO_API_KEY }} - name: Setup podman run: | # With some kernel configs (eg. COS), podman only works with legacy iptables. diff --git a/.github/workflows/cloud_release.yaml b/.github/workflows/cloud_release.yaml index fd2e95ac310..5aaede48a25 100644 --- a/.github/workflows/cloud_release.yaml +++ b/.github/workflows/cloud_release.yaml @@ -28,9 +28,8 @@ jobs: - name: Use github bazel config uses: ./.github/actions/bazelrc with: - use_remote_exec: 'true' - BB_API_KEY: ${{ secrets.BB_IO_API_KEY }} download_toplevel: 'true' + BB_API_KEY: ${{ secrets.BB_IO_API_KEY }} - id: gcloud-creds uses: ./.github/actions/gcloud_creds with: diff --git a/.github/workflows/operator_release.yaml b/.github/workflows/operator_release.yaml index 1c4d014f315..875cf5252f9 100644 --- a/.github/workflows/operator_release.yaml +++ b/.github/workflows/operator_release.yaml @@ -31,9 +31,8 @@ jobs: - name: Use github bazel config uses: ./.github/actions/bazelrc with: - use_remote_exec: 'true' - BB_API_KEY: ${{ secrets.BB_IO_API_KEY }} download_toplevel: 'true' + BB_API_KEY: ${{ secrets.BB_IO_API_KEY }} - id: gcloud-creds uses: ./.github/actions/gcloud_creds with: diff --git a/.github/workflows/perf_common.yaml b/.github/workflows/perf_common.yaml index db705d33492..0a8289d4325 100644 --- a/.github/workflows/perf_common.yaml +++ b/.github/workflows/perf_common.yaml @@ -48,7 +48,6 @@ jobs: - name: Use github bazel config uses: ./.github/actions/bazelrc with: - use_remote_exec: 'true' BB_API_KEY: ${{ secrets.BB_IO_API_KEY }} - name: Set matrix id: set-matrix @@ -78,9 +77,8 @@ jobs: - name: Use github bazel config uses: ./.github/actions/bazelrc with: - use_remote_exec: 'true' - BB_API_KEY: ${{ secrets.BB_IO_API_KEY }} download_toplevel: 'true' + BB_API_KEY: ${{ secrets.BB_IO_API_KEY }} - name: Install Pixie CLI run: | bazel build -c opt //src/pixie_cli:px diff --git a/.github/workflows/release_update_docs_px_dev.yaml b/.github/workflows/release_update_docs_px_dev.yaml index 17a1b48bfe5..697a0c314da 100644 --- a/.github/workflows/release_update_docs_px_dev.yaml +++ b/.github/workflows/release_update_docs_px_dev.yaml @@ -24,7 +24,6 @@ jobs: uses: ./.github/actions/bazelrc with: dev: 'true' - use_remote_exec: 'true' BB_API_KEY: ${{ secrets.BB_IO_API_KEY }} - name: Generate documentation files shell: bash diff --git a/.github/workflows/trivy_images.yaml b/.github/workflows/trivy_images.yaml index cf9234eb438..deb8cddbea8 100644 --- a/.github/workflows/trivy_images.yaml +++ b/.github/workflows/trivy_images.yaml @@ -34,7 +34,6 @@ jobs: uses: ./.github/actions/bazelrc with: download_toplevel: 'true' - use_remote_exec: 'true' BB_API_KEY: ${{ secrets.BB_IO_API_KEY }} - name: Build images run: | diff --git a/.github/workflows/vizier_release.yaml b/.github/workflows/vizier_release.yaml index ee76e292795..2648b50656d 100644 --- a/.github/workflows/vizier_release.yaml +++ b/.github/workflows/vizier_release.yaml @@ -31,9 +31,8 @@ jobs: - name: Use github bazel config uses: ./.github/actions/bazelrc with: - use_remote_exec: 'true' - BB_API_KEY: ${{ secrets.BB_IO_API_KEY }} download_toplevel: 'true' + BB_API_KEY: ${{ secrets.BB_IO_API_KEY }} - id: gcloud-creds uses: ./.github/actions/gcloud_creds with: diff --git a/ci/bes-gce.bazelrc b/ci/bes-gce.bazelrc deleted file mode 100644 index ecc6557f673..00000000000 --- a/ci/bes-gce.bazelrc +++ /dev/null @@ -1,3 +0,0 @@ -build --bes_backend=grpcs://bb-grpc.corp.pixielabs.ai -build --bes_results_url=https://bb.corp.pixielabs.ai/invocation/ -build --remote_cache=grpcs://bb-grpc.corp.pixielabs.ai diff --git a/ci/bes-k8s.bazelrc b/ci/bes-k8s.bazelrc deleted file mode 100644 index 53d3ac8cbf8..00000000000 --- a/ci/bes-k8s.bazelrc +++ /dev/null @@ -1,3 +0,0 @@ -build --bes_backend=grpc://buildbuddy-enterprise.buildbuddy:1985 -build --bes_results_url=https://bb.corp.pixielabs.ai/invocation/ -build --remote_cache=grpc://buildbuddy-enterprise.buildbuddy:1985 diff --git a/ci/bes-oss-gce.bazelrc b/ci/bes-oss-gce.bazelrc deleted file mode 100644 index 1ed7dd840aa..00000000000 --- a/ci/bes-oss-gce.bazelrc +++ /dev/null @@ -1,3 +0,0 @@ -build --bes_backend=grpcs://bb-grpc.px.dev -build --bes_results_url=https://bb.px.dev/invocation/ -build --remote_cache=grpcs://bb-grpc.px.dev diff --git a/ci/bes-oss-k8s.bazelrc b/ci/bes-oss-k8s.bazelrc deleted file mode 100644 index 793b1b726d3..00000000000 --- a/ci/bes-oss-k8s.bazelrc +++ /dev/null @@ -1,3 +0,0 @@ -build --bes_backend=grpc://buildbuddy-enterprise.buildbuddy:1985 -build --bes_results_url=https://bb.px.dev/invocation/ -build --remote_cache=grpc://buildbuddy-enterprise.buildbuddy:1985 diff --git a/ci/bes.bazelrc b/ci/bes.bazelrc new file mode 100644 index 00000000000..9c27dbf6b32 --- /dev/null +++ b/ci/bes.bazelrc @@ -0,0 +1,3 @@ +build --bes_results_url=https://app.buildbuddy.io/invocation/ +build --bes_backend=grpcs://remote.buildbuddy.io +build --remote_cache=grpcs://remote.buildbuddy.io diff --git a/ci/github/bazelrc b/ci/github/bazelrc index 8de37643b0c..f4b0cdb5ac0 100644 --- a/ci/github/bazelrc +++ b/ci/github/bazelrc @@ -5,6 +5,9 @@ common --color=yes # a given run. common --keep_going +# Always use remote exec +build --config=remote + build --build_metadata=HOST=github-actions build --build_metadata=USER=github-actions build --build_metadata=REPO_URL=https://github.com/pixie-io/pixie