Skip to content

Commit

Permalink
Simplify BES config for CI (pixie-io#1571)
Browse files Browse the repository at this point in the history
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 <vihang@pixielabs.ai>
  • Loading branch information
vihangm authored Jun 24, 2023
1 parent d65722b commit 8a02cdb
Show file tree
Hide file tree
Showing 15 changed files with 20 additions and 54 deletions.
22 changes: 7 additions & 15 deletions .github/actions/bazelrc/action.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
---
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'
default: 'false'
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:
Expand All @@ -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'
Expand All @@ -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
16 changes: 2 additions & 14 deletions .github/workflows/build_and_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/cli_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/cloud_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/operator_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/perf_common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/release_update_docs_px_dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/trivy_images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/vizier_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 0 additions & 3 deletions ci/bes-gce.bazelrc

This file was deleted.

3 changes: 0 additions & 3 deletions ci/bes-k8s.bazelrc

This file was deleted.

3 changes: 0 additions & 3 deletions ci/bes-oss-gce.bazelrc

This file was deleted.

3 changes: 0 additions & 3 deletions ci/bes-oss-k8s.bazelrc

This file was deleted.

3 changes: 3 additions & 0 deletions ci/bes.bazelrc
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions ci/github/bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8a02cdb

Please sign in to comment.