chromite: Setup pipeline to post-process and upload orderfile.
In ArtifactStage, this patch adds script that call toolchain-utils
script to do post processing on generated orderfile and creates a tarball.
Then it uploads the results to a gs bucket. The changes all have unittests.
This patch only applies to orderfile-generate-toolchain builders, and
is written with the new build api.
BUG=chromium:950627
TEST=Unittests pass and build_api is tested individually.
Whole builder is tested and the log is at
https://ci.chromium.org/p/chromeos/builders/general/Try/b8910544771604484896
Change-Id: I4d42fb8591eaef7e54634dfab31c340dbd074f37
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/1583077
Tested-by: Tiancong Wang <tcwang@google.com>
Reviewed-by: Alex Klein <saklein@chromium.org>
Reviewed-by: Evan Hernandez <evanhernandez@chromium.org>
Auto-Submit: Tiancong Wang <tcwang@google.com>
Commit-Queue: Tiancong Wang <tcwang@google.com>
diff --git a/api/controller/artifacts.py b/api/controller/artifacts.py
index 2527728..bf37a23 100644
--- a/api/controller/artifacts.py
+++ b/api/controller/artifacts.py
@@ -310,3 +310,36 @@
archives = vm_test_stages.ArchiveVMFilesFromImageDir(image_dir, output_dir)
for archive in archives:
output_proto.artifacts.add().path = archive
+
+def BundleOrderfileGenerationArtifacts(input_proto, output_proto):
+ """Create tarballs of all the artifacts of orderfile_generate builder.
+
+ Args:
+ input_proto (BundleRequest): The input proto.
+ output_proto (BundleResponse): The output proto.
+ """
+ # Required args.
+ build_target_name = input_proto.build_target.name
+ output_dir = input_proto.output_dir
+ chrome_version = input_proto.chrome_version
+
+ if not build_target_name:
+ cros_build_lib.Die('build_target.name is required.')
+ if not chrome_version:
+ cros_build_lib.Die('chrome_version is required.')
+ if not output_dir:
+ cros_build_lib.Die('output_dir is required.')
+ elif not os.path.isdir(output_dir):
+ cros_build_lib.Die('output_dir does not exist.')
+
+ chroot = controller_util.ParseChroot(input_proto.chroot)
+
+ try:
+ results = artifacts.BundleOrderfileGenerationArtifacts(
+ chroot, input_proto.build_target, chrome_version, output_dir)
+ except artifacts.Error as e:
+ cros_build_lib.Die('Error %s raised in BundleSimpleChromeArtifacts: %s',
+ type(e), e)
+
+ for file_name in results:
+ output_proto.artifacts.add().path = file_name