flowey_lib_hvlite/_jobs/
build_openhcl_igvm_from_recipe_nix.rs

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4//! Composite job node that wires together Nix configuration and the OpenHCL
5//! IGVM build-and-publish step.
6//!
7//! This node exists so that both the local `build-reproducible` pipeline and
8//! future CI jobs can share the same wiring without divergence.
9//!
10//! Note: `cfg_hvlite_reposource` is intentionally excluded, since pipelines
11//! like `checkin_gates` inject it across all jobs via `inject_all_jobs_with`.
12
13use crate::_jobs::build_and_publish_openhcl_igvm_from_recipe::OpenhclIgvmBuildParams;
14use crate::resolve_openhcl_kernel_package::OpenhclKernelPackageKind;
15use crate::run_cargo_build::common::CommonArch;
16use flowey::node::prelude::*;
17
18flowey_request! {
19    pub struct Params {
20        pub arch: CommonArch,
21        pub kernel_kind: OpenhclKernelPackageKind,
22        pub igvm_files: Vec<OpenhclIgvmBuildParams>,
23        pub artifact_dir_openhcl_igvm: ReadVar<PathBuf>,
24        pub artifact_dir_openhcl_igvm_extras: ReadVar<PathBuf>,
25        pub artifact_openhcl_verify_size_baseline: Option<ReadVar<PathBuf>>,
26        pub done: WriteVar<SideEffect>,
27    }
28}
29
30new_simple_flow_node!(struct Node);
31
32impl SimpleFlowNode for Node {
33    type Request = Params;
34
35    fn imports(ctx: &mut ImportCtx<'_>) {
36        ctx.import::<crate::_jobs::cfg_nix::Node>();
37        ctx.import::<crate::_jobs::build_and_publish_openhcl_igvm_from_recipe::Node>();
38    }
39
40    fn process_request(request: Self::Request, ctx: &mut NodeCtx<'_>) -> anyhow::Result<()> {
41        let Params {
42            arch,
43            kernel_kind,
44            igvm_files,
45            artifact_dir_openhcl_igvm,
46            artifact_dir_openhcl_igvm_extras,
47            artifact_openhcl_verify_size_baseline,
48            done,
49        } = request;
50
51        ctx.req(crate::_jobs::cfg_nix::Params { arch, kernel_kind });
52
53        ctx.req(
54            crate::_jobs::build_and_publish_openhcl_igvm_from_recipe::Params {
55                igvm_files,
56                artifact_dir_openhcl_igvm,
57                artifact_dir_openhcl_igvm_extras,
58                artifact_openhcl_verify_size_baseline,
59                done,
60            },
61        );
62
63        Ok(())
64    }
65}