Merge pull request #14 from DeterminateSystems/eelcodolstra/fh-177

Fix support for multiple output derivations
This commit is contained in:
Eelco Dolstra 2024-02-12 17:05:15 +01:00 committed by GitHub
commit ee9b236259
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 7 deletions

View file

@ -9,7 +9,7 @@ use axum_macros::debug_handler;
use serde::{Deserialize, Serialize};
use super::State;
use crate::error::Result;
use crate::error::{Error, Result};
use crate::util::{get_store_paths, upload_paths};
#[derive(Debug, Clone, Serialize)]
@ -112,11 +112,11 @@ async fn enqueue_paths(
) -> Result<Json<EnqueuePathsResponse>> {
tracing::info!("Enqueueing {:?}", req.store_paths);
let store_paths: Vec<_> = req
let store_paths = req
.store_paths
.iter()
.map(|path| state.store.follow_store_path(path).unwrap())
.collect();
.map(|path| state.store.follow_store_path(path).map_err(Error::Attic))
.collect::<Result<Vec<_>>>()?;
if let Some(flakehub_state) = &*state.flakehub_state.read().await {
crate::flakehub::enqueue_paths(flakehub_state, store_paths).await?;

View file

@ -330,7 +330,10 @@ async fn post_build_hook(out_paths: &str) {
let args = Args::parse();
let store_paths: Vec<_> = out_paths.lines().map(str::to_owned).collect();
let store_paths: Vec<_> = out_paths
.split_whitespace()
.map(|s| s.trim().to_owned())
.collect();
let request = api::EnqueuePathsRequest { store_paths };
@ -345,8 +348,9 @@ async fn post_build_hook(out_paths: &str) {
match response {
Ok(response) if !response.status().is_success() => {
err_message = Some(format!(
"magic-nix-cache server failed to enqueue the push request: {}",
response.status()
"magic-nix-cache server failed to enqueue the push request: {}\n{}",
response.status(),
response.text().await.unwrap_or_else(|_| "".to_owned()),
));
}
Ok(response) => {