From 4d465249eff7488e712586bf693668d513211632 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 15 Mar 2023 15:24:14 +0300 Subject: fix(tvix/cli): populate output configuration after walking args Walking the arguments might encounter an `outputs` output, which might explicitly (for whatever reason) specify the `out` output. To prevent dropping FOD settings in this case, we have to populate that part of the configuration after walking the other attributes. Change-Id: Iee6a7f0a71e9c9699e79d35e6cb19e1ddb49395d Reviewed-on: https://cl.tvl.fyi/c/depot/+/8312 Reviewed-by: flokli Tested-by: BuildkiteCI --- tvix/cli/src/derivation.rs | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'tvix') diff --git a/tvix/cli/src/derivation.rs b/tvix/cli/src/derivation.rs index 1508e3e6d935..5a04c2a11bb2 100644 --- a/tvix/cli/src/derivation.rs +++ b/tvix/cli/src/derivation.rs @@ -175,7 +175,6 @@ async fn handle_derivation_parameters( .to_list() .context("looking at the `outputs` parameter of the derivation")?; - drv.outputs.clear(); populate_outputs(co, drv, outputs).await?; } @@ -264,20 +263,7 @@ mod derivation_builtins { Ok(None) } - populate_output_configuration( - &mut drv, - select_string(&co, &input, "outputHash") - .await - .context("evaluating the `outputHash` parameter")?, - select_string(&co, &input, "outputHashAlgo") - .await - .context("evaluating the `outputHashAlgo` parameter")?, - select_string(&co, &input, "outputHashMode") - .await - .context("evaluating the `outputHashMode` parameter")?, - )?; - - for (name, value) in input.into_iter_sorted() { + for (name, value) in input.clone().into_iter_sorted() { let value = generators::request_force(&co, value).await; if ignore_nulls && matches!(value, Value::Null) { continue; @@ -303,6 +289,19 @@ mod derivation_builtins { } } + populate_output_configuration( + &mut drv, + select_string(&co, &input, "outputHash") + .await + .context("evaluating the `outputHash` parameter")?, + select_string(&co, &input, "outputHashAlgo") + .await + .context("evaluating the `outputHashAlgo` parameter")?, + select_string(&co, &input, "outputHashMode") + .await + .context("evaluating the `outputHashMode` parameter")?, + )?; + // Scan references in relevant attributes to detect any build-references. let references = { let state = state.borrow(); -- cgit 1.4.1