From 68db254a94b45952b2e3c4335f8c645c9c1e4f24 Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Fri, 1 Nov 2024 15:38:33 -0400 Subject: [PATCH] `om ci`: Include systems (and flake) in result JSON This breaks backwards compatibility. --- .github/workflows/ci.yaml | 2 +- crates/omnix-ci/src/command/run.rs | 20 ++++++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2e80953e..2134dbcc 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -67,7 +67,7 @@ jobs: # Retrieve the store path for the given package out of the given subflake. get_output() { subflake=$1 name=$2 \ - jq -r '.[$ENV.subflake].build.byName.[$ENV.name]' < $HOME/omci.json + jq -r '.result.[$ENV.subflake].build.byName.[$ENV.name]' < $HOME/omci.json } echo "OMCIJSON_PATH=$HOME/omci.json" >> "$GITHUB_OUTPUT" diff --git a/crates/omnix-ci/src/command/run.rs b/crates/omnix-ci/src/command/run.rs index 8320b6c9..9e4164f8 100644 --- a/crates/omnix-ci/src/command/run.rs +++ b/crates/omnix-ci/src/command/run.rs @@ -14,6 +14,7 @@ use nix_rs::{ }; use omnix_common::config::OmConfig; use omnix_health::{traits::Checkable, NixHealth}; +use serde::Serialize; use crate::{config::subflakes::SubflakesConfig, flake_ref::FlakeRef, step::core::StepsResult}; @@ -170,7 +171,7 @@ pub async fn ci_run( run_cmd: &RunCommand, cfg: &OmConfig, nix_config: &NixConfig, -) -> anyhow::Result> { +) -> anyhow::Result { let mut res = HashMap::new(); let systems = run_cmd.get_systems(cmd, nix_config).await?; @@ -208,5 +209,20 @@ pub async fn ci_run( tracing::info!("\n🥳 Success!"); - Ok(res) + Ok(RunResult { + systems, + flake: cfg.flake_url.clone(), + result: res, + }) +} + +/// Results of the 'ci run' command +#[derive(Debug, Serialize, Clone)] +pub struct RunResult { + /// The systems we are building for + systems: Vec, + /// The flake being built + flake: FlakeUrl, + /// CI result for each subflake + result: HashMap, }