git.delta.rocks / jrsonnet / refs/commits / 347bd4a9df43

difftreelog

fix do not assert for secret regeneration command

Yaroslav Bolyukin2024-12-08parent: #68ce59a.patch.diff
in: trunk

4 files changed

modifiedcmds/fleet/src/main.rsdiffbeforeafterboth
206 let config = opts.fleet_opts.build(nix_args).await?;206 let config = opts
207 .fleet_opts
208 .build(
209 nix_args,
210 matches!(opts.command, Opts::Deploy(_) | Opts::BuildSystems(_)),
211 )
212 .await?;
207213
modifiedcrates/fleet-base/src/opts.rsdiffbeforeafterboth
181 }181 }
182182
183 // TODO: Config should be detached from opts.183 // TODO: Config should be detached from opts.
184 pub async fn build(&self, nix_args: Vec<OsString>) -> Result<Config> {184 pub async fn build(&self, nix_args: Vec<OsString>, assert: bool) -> Result<Config> {
185 let directory = current_dir()?;185 let directory = current_dir()?;
186186
187 let pool = NixSessionPool::new(187 let pool = NixSessionPool::new(
204204
205 let config_field = nix_go!(fleet_field.config);205 let config_field = nix_go!(fleet_field.config);
206206
207 if assert {
207 assert_warn("fleet config evaluation", &config_field).await?;208 assert_warn("fleet config evaluation", &config_field).await?;
209 }
208210
209 let import = nix_go!(builtins_field.import);211 let import = nix_go!(builtins_field.import);
210 let overlays = nix_go!(config_field.nixpkgs.overlays);212 let overlays = nix_go!(config_field.nixpkgs.overlays);
modifiedcrates/nix-eval/src/util.rsdiffbeforeafterboth
1use std::time::Instant;
2
1use anyhow::bail;3use anyhow::bail;
2use tracing::{debug, warn};4use tracing::{debug, warn};
3use std::time::Instant;
45
5use crate::{nix_go_json, Value};6use crate::{nix_go_json, Value};
67
8#[tracing::instrument(level = "info", skip(val))]
7pub async fn assert_warn(action: &str, val: &Value) -> anyhow::Result<()> {9pub async fn assert_warn(action: &str, val: &Value) -> anyhow::Result<()> {
8 let before_errors = Instant::now();10 let before_errors = Instant::now();
9 let errors: Vec<String> = nix_go_json!(val.errors);11 let errors: Vec<String> = nix_go_json!(val.errors);
10 debug!("errors evaluation took {:?}", before_errors.elapsed());12 debug!("errors evaluation took {:?}", before_errors.elapsed());
11 if !errors.is_empty() {13 if !errors.is_empty() {
12 bail!(14 bail!(
13 "{action} failed with error{}{}",15 "failed with error{}{}",
14 (errors.len() != 1).then_some("s:\n- ").unwrap_or(": "),16 if errors.len() != 1 { "s:\n- " } else { ": " },
15 errors.join("\n- "),17 errors.join("\n- "),
16 );18 );
17 }19 }
21 debug!("warnings evaluation took {:?}", before_errors.elapsed());23 debug!("warnings evaluation took {:?}", before_errors.elapsed());
22 if !warnings.is_empty() {24 if !warnings.is_empty() {
23 warn!(25 warn!(
24 "{action} completed with warning{}{}",26 "completed with warning{}{}",
25 (warnings.len() != 1).then_some("s:\n- ").unwrap_or(": "),27 if warnings.len() != 1 { "s:\n- " } else { ": " },
26 warnings.join("\n- "),28 warnings.join("\n- "),
27 );29 );
28 }30 }
modifiedmodules/secrets-data.nixdiffbeforeafterboth
52 default = null;52 default = null;
53 };53 };
54 };54 };
55 config = {};
55 };56 };
5657
57 hostSecretData = {58 hostSecretData = {
78 default = null;79 default = null;
79 };80 };
80 };81 };
82 config = {};
81 };83 };
82in {84in {
83 options.data = mkDataOption ({config, ...}: {85 options.data = mkDataOption ({config, ...}: {