From 421f68e13ac684f74a2e0bcea805bafe9fa66b4a Mon Sep 17 00:00:00 2001 From: godofredoc Date: Mon, 25 Sep 2023 18:27:26 -0700 Subject: [PATCH] Prepare fuchsia script to coexist with v1 and v2 of fuchsia builders. (flutter/engine#46126) Prepares fuchsia scripts to work correctly when both v1 and v2 of the fuchsia build are running in their respective environments. Bug: https://github.com/flutter/flutter/issues/126461 Bug: https://github.com/flutter/flutter/issues/135189 [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style --- engine/src/flutter/.ci.yaml | 1 + engine/src/flutter/ci/builders/README.md | 3 ++- engine/src/flutter/ci/builders/linux_fuchsia.json | 2 ++ .../flutter/tools/fuchsia/build_fuchsia_artifacts.py | 10 +++++++++- .../tools/fuchsia/merge_and_upload_debug_symbols.py | 12 +++++++++++- 5 files changed, 25 insertions(+), 3 deletions(-) diff --git a/engine/src/flutter/.ci.yaml b/engine/src/flutter/.ci.yaml index c6c8442e1b..3f1c7e5334 100644 --- a/engine/src/flutter/.ci.yaml +++ b/engine/src/flutter/.ci.yaml @@ -161,6 +161,7 @@ targets: - name: Linux Fuchsia recipe: engine/engine properties: + add_recipes_cq: "true" build_fuchsia: "true" fuchsia_ctl_version: version:0.0.27 # ensure files from pre-production Fuchsia SDK tests are purged from cache diff --git a/engine/src/flutter/ci/builders/README.md b/engine/src/flutter/ci/builders/README.md index 2bccb7522c..73fcf14d41 100644 --- a/engine/src/flutter/ci/builders/README.md +++ b/engine/src/flutter/ci/builders/README.md @@ -122,7 +122,8 @@ The current list of supported magic variables is: folder where logs are being placed. * `${LUCI_WORKDIR}` - translated to the LUCI chroot working directory. * `${LUCI_CLEANUP}` - translated to the LUCI chroot temp directory. -* `${REVISION}` - translated to the engine commit under test. +* `${REVISION}` - translated to the engine commit in postsubmit. In presubmit + it is translated to an empty string. ### Build diff --git a/engine/src/flutter/ci/builders/linux_fuchsia.json b/engine/src/flutter/ci/builders/linux_fuchsia.json index e79853486b..72a72490e3 100644 --- a/engine/src/flutter/ci/builders/linux_fuchsia.json +++ b/engine/src/flutter/ci/builders/linux_fuchsia.json @@ -164,6 +164,7 @@ "parameters": [ "--engine-version", "${REVISION}", + "--upload", "--target-arch", "arm64", "--out-dir", @@ -181,6 +182,7 @@ "parameters": [ "--engine-version", "${REVISION}", + "--upload", "--target-arch", "x64", "--out-dir", diff --git a/engine/src/flutter/tools/fuchsia/build_fuchsia_artifacts.py b/engine/src/flutter/tools/fuchsia/build_fuchsia_artifacts.py index 4acf13259f..2defd41a5c 100755 --- a/engine/src/flutter/tools/fuchsia/build_fuchsia_artifacts.py +++ b/engine/src/flutter/tools/fuchsia/build_fuchsia_artifacts.py @@ -495,9 +495,17 @@ def main(): if args.copy_unoptimized_debug_artifacts and runtime_mode == 'debug' and optimized: CopyBuildToBucket(runtime_mode, arch, not optimized, product) + # Set revision to HEAD if empty and remove upload. This is to support + # presubmit workflows. + should_upload = args.upload + engine_version = args.engine_version + if not engine_version: + engine_version = 'HEAD' + should_upload = False + # Create and optionally upload CIPD package if args.cipd_dry_run or args.upload: - ProcessCIPDPackage(args.upload, args.engine_version) + ProcessCIPDPackage(should_upload, engine_version) return 0 diff --git a/engine/src/flutter/tools/fuchsia/merge_and_upload_debug_symbols.py b/engine/src/flutter/tools/fuchsia/merge_and_upload_debug_symbols.py index e27fd0137b..cec5768d07 100755 --- a/engine/src/flutter/tools/fuchsia/merge_and_upload_debug_symbols.py +++ b/engine/src/flutter/tools/fuchsia/merge_and_upload_debug_symbols.py @@ -214,7 +214,17 @@ def main(): arch = args.target_arch cipd_def = WriteCIPDDefinition(arch, out_dir, internal_symbol_dirs) - ProcessCIPDPackage(args.upload, cipd_def, args.engine_version, out_dir, arch) + + # Set revision to HEAD if empty and remove upload. This is to support + # presubmit workflows. An empty engine_version means this script is running + # on presubmit. + should_upload = args.upload + engine_version = args.engine_version + if not engine_version: + engine_version = 'HEAD' + should_upload = False + + ProcessCIPDPackage(should_upload, cipd_def, engine_version, out_dir, arch) return 0