From 5440dc17bcd4773456df02d8ca1961ce7b1ee18c Mon Sep 17 00:00:00 2001 From: Brian Ting Date: Tue, 19 Nov 2024 14:37:36 -0800 Subject: [PATCH] Chrobalt build acceleration. Set up Chrobalt build acceleration with RBE making it the default accelerator for both developers and the CI system. Remove fetching of RBE cfg files with CIPD. Instead rely on local cfg files which use public docker images rather than private ones. Taken from Chromium's trunk. b/384982606 --- .github/actions/build/action.yaml | 8 +------- buildtools/reclient_cfgs/fetch_reclient_cfgs.py | 4 ++++ cobalt/build/gn.py | 7 +++---- .../chromium-browser-clang/rewrapper_linux.cfg | 8 ++++++++ cobalt/reclient_cfgs/python/rewrapper_linux.cfg | 8 ++++++++ 5 files changed, 24 insertions(+), 11 deletions(-) create mode 100644 cobalt/reclient_cfgs/chromium-browser-clang/rewrapper_linux.cfg create mode 100644 cobalt/reclient_cfgs/python/rewrapper_linux.cfg diff --git a/.github/actions/build/action.yaml b/.github/actions/build/action.yaml index ee6157299833..8fa55d569001 100644 --- a/.github/actions/build/action.yaml +++ b/.github/actions/build/action.yaml @@ -14,7 +14,7 @@ runs: run: echo "$GITHUB_WORKSPACE/depot_tools" >> $GITHUB_PATH shell: bash - name: Generate gclient file - run: gclient config --name=src https://github.com/${{ github.repository }} + run: gclient config --name=src https://github.com/${{ github.repository }} --custom-var=download_remoteexec_cfg=True --custom-var='rbe_instance="projects/cobalt-actions-prod/instances/default_instance"' shell: bash - name: Set target OS for Android if: ${{ contains(matrix.platform, 'android') }} @@ -25,9 +25,6 @@ runs: - name: Gclient sync run: gclient sync -v --shallow --no-history -r ${{ github.sha }} shell: bash - - name: sccache check - run: sccache -s - shell: bash - name: gn gen run: | cd src @@ -46,9 +43,6 @@ runs: cd src ninja -C out/${{ matrix.platform }}_${{ matrix.config }} $(echo "${TARGETS}" | tr -d '"') shell: bash - - name: Dump sccache stats - run: sccache -s - shell: bash - name: Archive Android APKs if: startsWith(matrix.platform, 'android') && matrix.config == 'qa' uses: actions/upload-artifact@v4 diff --git a/buildtools/reclient_cfgs/fetch_reclient_cfgs.py b/buildtools/reclient_cfgs/fetch_reclient_cfgs.py index 98c8290db189..baed7076a041 100755 --- a/buildtools/reclient_cfgs/fetch_reclient_cfgs.py +++ b/buildtools/reclient_cfgs/fetch_reclient_cfgs.py @@ -134,6 +134,10 @@ def main(): return 1 if not GenerateReproxyCfg(args.reproxy_cfg_template, args.rbe_instance): return 1 +# COBALT Disables CIPD fetch of rewrapper configs in favor of local rewrapper configs. + return 0 + return 1 +# COBALT END if not args.rewrapper_cfg_project and not args.rbe_instance: logging.error( diff --git a/cobalt/build/gn.py b/cobalt/build/gn.py index 8e34d4e2b7c7..7060fa15529c 100755 --- a/cobalt/build/gn.py +++ b/cobalt/build/gn.py @@ -85,10 +85,9 @@ def write_build_args(build_args_path, original_lines, dict_settings, f'The following args cannot be set in configs: {controlled_args}') gen_comment = '# Set by gn.py' with open(build_args_path, 'w', encoding='utf-8') as f: - if os.getenv('IS_CI', default='0') == '1': - f.write(f'cc_wrapper = "{CC_WRAPPER}" {gen_comment}\n') - else: - f.write(f'use_remoteexec = true {gen_comment}\n') + f.write(f'use_remoteexec = true {gen_comment}\n') + f.write( + f'rbe_cfg_dir = rebase_path("//cobalt/reclient_cfgs") {gen_comment}\n') f.write(f'build_type = "{build_type}" {gen_comment}\n') for key, value in _BUILD_TYPES[build_type].items(): f.write(f'{key} = {value} {gen_comment}\n') diff --git a/cobalt/reclient_cfgs/chromium-browser-clang/rewrapper_linux.cfg b/cobalt/reclient_cfgs/chromium-browser-clang/rewrapper_linux.cfg new file mode 100644 index 000000000000..37fca98f4353 --- /dev/null +++ b/cobalt/reclient_cfgs/chromium-browser-clang/rewrapper_linux.cfg @@ -0,0 +1,8 @@ +platform=container-image=docker://gcr.io/chops-public-images-prod/rbe/siso-chromium/linux@sha256:26de99218a1a8b527d4840490bcbf1690ee0b55c84316300b60776e6b3a03fe1,label:action_default=1 +server_address=unix:///tmp/reproxy.sock +labels=type=compile,compiler=clang,lang=cpp +exec_strategy=remote_local_fallback +dial_timeout=10m +exec_timeout=2m +reclient_timeout=2m +canonicalize_working_dir=true diff --git a/cobalt/reclient_cfgs/python/rewrapper_linux.cfg b/cobalt/reclient_cfgs/python/rewrapper_linux.cfg new file mode 100644 index 000000000000..12ae5379c2fe --- /dev/null +++ b/cobalt/reclient_cfgs/python/rewrapper_linux.cfg @@ -0,0 +1,8 @@ +platform=container-image=docker://gcr.io/chops-public-images-prod/rbe/siso-chromium/linux@sha256:26de99218a1a8b527d4840490bcbf1690ee0b55c84316300b60776e6b3a03fe1,label:action_default=1 +server_address=unix:///tmp/reproxy.sock +labels=type=tool +exec_strategy=remote_local_fallback +dial_timeout=10m +canonicalize_working_dir=true +exec_timeout=2m +reclient_timeout=2m