fix invalid tokens JSON

This commit is contained in:
mbecker20
2025-08-23 17:55:43 -07:00
parent 0a2ee6ea43
commit af8410ae64
4 changed files with 22 additions and 11 deletions

View File

@@ -618,7 +618,7 @@ async fn validate_account_extract_registry_tokens(
..
}: &Build,
// Maps (domain, account) -> token
) -> serror::Result<HashMap<(String, String), String>> {
) -> serror::Result<Vec<(String, String, String)>> {
let mut res = HashMap::with_capacity(image_registry.capacity());
for (domain, account) in image_registry
@@ -650,5 +650,10 @@ async fn validate_account_extract_registry_tokens(
);
}
Ok(res)
Ok(
res
.into_iter()
.map(|((domain, account), token)| (domain, account, token))
.collect(),
)
}

View File

@@ -234,11 +234,11 @@ pub fn inner_handler(
let log = match handle.await {
Ok(Err(e)) => {
warn!("/execute request {req_id} task error: {e:#}",);
Log::error("task error", format_serror(&e.into()))
Log::error("Task Error", format_serror(&e.into()))
}
Err(e) => {
warn!("/execute request {req_id} spawn error: {e:?}",);
Log::error("spawn error", format!("{e:#?}"))
Log::error("Spawn Error", format!("{e:#?}"))
}
_ => return,
};

View File

@@ -1,4 +1,7 @@
use std::{collections::HashSet, path::PathBuf};
use std::{
collections::{HashMap, HashSet},
path::PathBuf,
};
use anyhow::{Context, anyhow};
use command::{
@@ -169,6 +172,13 @@ impl Resolve<super::Args> for build::Build {
return Err(anyhow!("Build must be files on host mode, have a repo attached, or have dockerfile contents set to build").into());
}
let registry_tokens = registry_tokens
.iter()
.map(|(domain, account, token)| {
((domain.as_str(), account.as_str()), token.as_str())
})
.collect::<HashMap<_, _>>();
// Maybe docker login
let mut should_push = false;
for (domain, account) in image_registry
@@ -180,9 +190,7 @@ impl Resolve<super::Args> for build::Build {
match docker_login(
domain,
account,
registry_tokens
.get(&(domain.to_string(), account.to_string()))
.map(String::as_str),
registry_tokens.get(&(domain, account)).copied(),
)
.await
{

View File

@@ -1,5 +1,3 @@
use std::collections::HashMap;
use komodo_client::entities::{
FileContents, repo::Repo, update::Log,
};
@@ -16,7 +14,7 @@ pub struct Build {
/// Override registry tokens with ones sent from core.
/// maps (domain, account) -> token.
#[serde(default)]
pub registry_tokens: HashMap<(String, String), String>,
pub registry_tokens: Vec<(String, String, String)>,
/// Propogate any secret replacers from core interpolation.
#[serde(default)]
pub replacers: Vec<(String, String)>,