From d472d2f47d11c30e1904f399832c7ff4eb60abdb Mon Sep 17 00:00:00 2001 From: Adam Singer Date: Wed, 7 Aug 2024 06:13:10 +0000 Subject: [PATCH] Add nativelink remote execution to github actions * Create github action that generates .buckconfig.local using `NATIVELINK_HEADER_RW_KEY` from gha secrets. * Set `container-image` used for remote execution specific to setup of buck2. * Update .gitignore to include .buckconfig.local. --- .../build_example_nativelink/action.yml | 24 +++++++++++++++++++ .github/workflows/build-and-test.yml | 3 +++ .gitignore | 1 + .../nativelink/platforms/defs.bzl | 2 +- 4 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 .github/actions/build_example_nativelink/action.yml diff --git a/.github/actions/build_example_nativelink/action.yml b/.github/actions/build_example_nativelink/action.yml new file mode 100644 index 000000000000..ebcc0f87ff03 --- /dev/null +++ b/.github/actions/build_example_nativelink/action.yml @@ -0,0 +1,24 @@ +name: build_example_nativelink +inputs: + NATIVELINK_HEADER_RW_KEY_SECRET: + description: '' + required: true +runs: + using: composite + steps: + - name: Build examples/remote_execution/nativelink directory using remote execution + run: |- + { + echo "[buck2_re_client] + engine_address = grpc://scheduler-buck2.build-faster.nativelink.net:443 + action_cache_address = grpc://cas-buck2.build-faster.nativelink.net:443 + cas_address = grpc://cas-buck2.build-faster.nativelink.net:443 + http_headers = x-nativelink-api-key:$NATIVELINK_HEADER_RW_KEY + tls = true + instance_name = main" + } > examples/remote_execution/nativelink/.buckconfig.local + cd examples/remote_execution/nativelink + $RUNNER_TEMP/artifacts/buck2 build //... + env: + NATIVELINK_HEADER_RW_KEY: ${{ inputs.NATIVELINK_HEADER_RW_KEY_SECRET }} + shell: bash diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 568e8535542a..4581e74e1af3 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -69,6 +69,9 @@ jobs: $RUNNER_TEMP/artifacts/buck2 test //... -v 2 - uses: ./.github/actions/build_example_conan - uses: ./.github/actions/build_example_no_prelude + - uses: ./.github/actions/build_example_nativelink + with: + NATIVELINK_HEADER_RW_KEY_SECRET: ${{ secrets.NATIVELINK_HEADER_RW_KEY_SECRET }} - uses: ./.github/actions/setup_reindeer - uses: ./.github/actions/build_bootstrap windows-build-examples: diff --git a/.gitignore b/.gitignore index 5ca9410a5c86..bfeb8157ca3f 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ Cargo.lock buck-out /.direnv +.buckconfig.local # symlinks /examples/with_prelude/prelude diff --git a/examples/remote_execution/nativelink/platforms/defs.bzl b/examples/remote_execution/nativelink/platforms/defs.bzl index 754201cbbeea..5d065f7a8855 100644 --- a/examples/remote_execution/nativelink/platforms/defs.bzl +++ b/examples/remote_execution/nativelink/platforms/defs.bzl @@ -21,7 +21,7 @@ def _platforms(ctx): # Set those up based on what workers you've registered with NativeLink. remote_execution_properties = { "OSFamily": "linux", - "container-image": "docker://ghcr.io/catthehacker/ubuntu:act-22.04@sha256:5f9c35c25db1d51a8ddaae5c0ba8d3c163c5e9a4a6cc97acd409ac7eae239448", + "container-image": "docker://buck2-github:latest", }, remote_execution_use_case = "buck2-default", remote_output_paths = "output_paths",