Skip to main content

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::_jobs::build_and_publish_openvmm_hcl_baseline::OpenvmmHclBaselineOutput;
15use crate::build_openhcl_igvm_from_recipe::OpenhclIgvmExtrasOutput;
16use crate::build_openhcl_igvm_from_recipe::OpenhclIgvmOutput;
17use crate::common::CommonArch;
18use crate::resolve_openhcl_kernel_package::OpenhclKernelPackageKind;
19use flowey::node::prelude::*;
20
21flowey_request! {
22    pub struct Params {
23        pub arch: CommonArch,
24        pub kernel_kind: OpenhclKernelPackageKind,
25        pub igvm_files: Vec<(OpenhclIgvmBuildParams, WriteVar<OpenhclIgvmOutput>, WriteVar<OpenhclIgvmExtrasOutput>)>,
26        pub artifact_openhcl_verify_size_baseline: Option<WriteVar<OpenvmmHclBaselineOutput>>,
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_openhcl_verify_size_baseline,
46        } = request;
47
48        ctx.req(crate::_jobs::cfg_nix::Params { arch, kernel_kind });
49
50        ctx.req(
51            crate::_jobs::build_and_publish_openhcl_igvm_from_recipe::Params {
52                igvm_files,
53                artifact_openhcl_verify_size_baseline,
54            },
55        );
56
57        Ok(())
58    }
59}