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

chore: switch to Aspect Workflows for RBE #612

Merged
merged 1 commit into from
May 29, 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
12 changes: 12 additions & 0 deletions .aspect/workflows/bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,17 @@
common --remote_download_outputs=minimal
common --nobuild_runfile_links

# Debug where options came from
common --announce_rc

# Allows tests to run bazelisk-in-bazel, since this is the cache folder used
common --test_env=XDG_CACHE_HOME

# Always enable remote execution.
# We test the local execution case in the "vanilla GitHub Actions" setup in /.github/workflows/ci.yaml
build --host_platform=@aspect_bazel_lib//platforms:x86_64_linux_remote
build --extra_execution_platforms=@aspect_bazel_lib//platforms:x86_64_linux_remote
build --remote_executor=unix:///mnt/ephemeral/buildbarn/.cache/bb_clientd/grpc
build --jobs=8 # current max scaling for the OSS RBE cluster
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the parallelism on each worker? Is this too low?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

build --remote_timeout=3600
build --genrule_strategy=remote
19 changes: 1 addition & 18 deletions .github/workflows/ci.bazelrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Directories caches by GitHub actions
common:local --disk_cache=~/.cache/bazel-disk-cache
common --disk_cache=~/.cache/bazel-disk-cache
common --repository_cache=~/.cache/bazel-repository-cache

# Debug where options came from
Expand All @@ -10,20 +10,3 @@ common --test_env=XDG_CACHE_HOME

# Still required for Windows until we upgrade to a minimum rules_js that no longer requires it
common --enable_runfiles

# Generic remote build execution
build:rbe --extra_execution_platforms=@aspect_rules_js//platforms:x86_64_linux_remote
build:rbe --genrule_strategy=remote
build:rbe --host_platform=@aspect_rules_js//platforms:x86_64_linux_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_executor=grpcs://remote.buildbuddy.io

# We are using RBE to test that the actions we create in rules_ts will work for our customers,
# not to accelerate and parallelize the builds for unrelated actions that happen to appear in our dependencies.
# So, turn off RBE for actions that are known to be problematic because they are non-hermetic.
build:rbe --modify_execution_info=CppCompile=+no-remote-exec,CppLink=+no-remote-exec,GenProtoDescriptorSet=+no-remote-exec,ProtocGenEs=+no-remote-exec

50 changes: 4 additions & 46 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,6 @@ jobs:
)
printf -v j '{%s},' "${a[@]}"
echo "res=[${j%,}]" | tee -a $GITHUB_OUTPUT
- id: config
name: Prepare 'config' matrix axis
# Don't run RBE if there is no API key which is the case on forks.
run: |
a=( local )
if [[ "${{ github.ref_name }}" == "main" ]] || [[ "${{ github.head_ref }}" == *"rbe"* ]]; then
if [[ "${{ env.BUILDBUDDY_API_KEY }}" ]]; then
a+=( rbe )
fi
fi
printf -v j '"%s",' "${a[@]}"
echo "res=[${j%,}]" | tee -a $GITHUB_OUTPUT
env:
BUILDBUDDY_API_KEY: ${{ secrets.BUILDBUDDY_API_KEY }}
- id: os
name: Prepare 'os' matrix axis
# Only run MacOS and Windows on main branch (not PRs) to minimize minutes (billed at 10X and 2X respectively)
Expand All @@ -64,7 +50,6 @@ jobs:
echo "res=[${j%,}]" | tee -a $GITHUB_OUTPUT
outputs:
bazel-version: ${{ steps.bazel-version.outputs.res }}
config: ${{ steps.config.outputs.res }}
os: ${{ steps.os.outputs.res }}

test:
Expand All @@ -77,7 +62,6 @@ jobs:
bazel-version: ${{ fromJSON(needs.matrix-prep.outputs.bazel-version) }}
bzlmod: [1, 0]
os: ${{ fromJSON(needs.matrix-prep.outputs.os) }}
config: ${{ fromJSON(needs.matrix-prep.outputs.config) }}
folder:
- '.'
- 'e2e/bzlmod'
Expand All @@ -94,10 +78,6 @@ jobs:
- os: windows
bazel-version:
major: 6
# Don't run RBE tests with Bazel 6 to reduce the size of the test matrix
- bazel-version:
major: 6
config: rbe
# Dont' test root workspace with Bazel 6 to reduce the size of the test matrix
- bazel-version:
major: 6
Expand All @@ -106,22 +86,13 @@ jobs:
- bazel-version:
major: 6
bzlmod: 1
# Don't test RBE with on MacOS (not configured)
- os: macos
config: rbe
# Don't test RBE with on Windows (not configured)
- os: windows
config: rbe
# Disable some broken tests on Windows
- os: windows
folder: .
- os: windows
folder: e2e/worker
- os: windows
folder: e2e/bzlmod
# TODO(https://github.com/aspect-build/rules_ts/issues/432): re-enable
- folder: e2e/bzlmod
config: rbe
# TODO: combine bzlmod and workspace into a single 'smoke' e2e
- folder: e2e/bzlmod
bzlmod: 0
Expand All @@ -141,11 +112,11 @@ jobs:
~/.cache/bazel-repository-cache
~/.cache/xdg-cache
key: >-
bazel-cache-${{ matrix.bazel-version.version }}-${{ matrix.bzlmod }}-${{ matrix.os }}-${{ matrix.config }}-${{ matrix.folder }}-
bazel-cache-${{ matrix.bazel-version.version }}-${{ matrix.bzlmod }}-${{ matrix.os }}-${{ matrix.folder }}-
${{ hashFiles('.bazelrc', '.bazelversion', '.bazeliskrc', '**/BUILD', '**/BUILD.bazel', '**/*.bzl', 'WORKSPACE', 'WORKSPACE.bazel', 'WORKSPACE.bzlmod', 'MODULE.bazel', '**/*.js', '!e2e') }}-
${{ hashFiles(format('{0}/.bazelrc', matrix.folder), format('{0}/.bazelversion', matrix.folder), format('{0}/.bazeliskrc', matrix.folder), format('{0}/**/BUILD', matrix.folder), format('{0}/**/BUILD.bazel', matrix.folder), format('{0}/**/*.bzl', matrix.folder), format('{0}/WORKSPACE', matrix.folder), format('{0}/WORKSPACE.bazel', matrix.folder), format('{0}/WORKSPACE.bzlmod', matrix.folder), format('{0}/MODULE.bazel', matrix.folder), format('{0}/MODULE.bazel.lock', matrix.folder), format('{0}/**/*.js', matrix.folder)) }}
restore-keys: |
bazel-cache-${{ matrix.bazel-version.version }}-${{ matrix.bzlmod }}-${{ matrix.os }}-${{ matrix.config }}-${{ matrix.folder }}-
bazel-cache-${{ matrix.bazel-version.version }}-${{ matrix.bzlmod }}-${{ matrix.os }}-${{ matrix.folder }}-

- name: Configure Bazel version
working-directory: ${{ matrix.folder }}
Expand All @@ -168,18 +139,6 @@ jobs:
shell: bash
run: rm -f .bazeliskrc

- name: Write RBE credentials
# Writes RBE credential files
if: matrix.config == 'rbe'
working-directory: ${{ matrix.folder }}
shell: bash
run: |
touch $HOME/.bazelrc
chmod 0600 $HOME/.bazelrc
echo "build --remote_header=x-buildbuddy-api-key=$BUILDBUDDY_API_KEY" > $HOME/.bazelrc
env:
BUILDBUDDY_API_KEY: ${{ secrets.BUILDBUDDY_API_KEY }}

- name: bazel test //...
working-directory: ${{ matrix.folder }}
shell: bash
Expand All @@ -189,9 +148,8 @@ jobs:
--bazelrc=${GITHUB_WORKSPACE//\\/\/}/.aspect/bazelrc/ci.bazelrc \
--bazelrc=${GITHUB_WORKSPACE//\\/\/}/.github/workflows/ci.bazelrc \
test \
--config=${{ matrix.config }} \
--test_tag_filters=-skip-on-${{ matrix.config }},-skip-on-bazel${{ matrix.bazel-version.major }},-skip-on-bzlmod-${{ matrix.bzlmod }} \
--build_tag_filters=-skip-on-${{ matrix.config }},-skip-on-bazel${{ matrix.bazel-version.major }},-skip-on-bzlmod-${{ matrix.bzlmod }} \
--test_tag_filters=-skip-on-bazel${{ matrix.bazel-version.major }},-skip-on-bzlmod-${{ matrix.bzlmod }} \
--build_tag_filters=-skip-on-bazel${{ matrix.bazel-version.major }},-skip-on-bzlmod-${{ matrix.bzlmod }} \
--enable_bzlmod=${{ matrix.bzlmod }} \
//...
env:
Expand Down
Loading