From 0d57f9411cfeb9fec05a5f5602ba532dd6aff5c3 Mon Sep 17 00:00:00 2001 From: mbecker20 Date: Sun, 23 Jun 2024 02:27:19 -0700 Subject: [PATCH] can deploy ecr --- bin/core/src/api/execute/deployment.rs | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/bin/core/src/api/execute/deployment.rs b/bin/core/src/api/execute/deployment.rs index 6a91a7dfe..8eaa75543 100644 --- a/bin/core/src/api/execute/deployment.rs +++ b/bin/core/src/api/execute/deployment.rs @@ -22,6 +22,7 @@ use periphery_client::api; use resolver_api::Resolve; use crate::{ + cloud::aws::ecr, config::core_config, helpers::{ periphery_client, @@ -181,13 +182,28 @@ impl Resolve for State { core_config.github_accounts.get(¶ms.account).cloned(), None, ), - ImageRegistry::AwsEcr(label) => ( - None, - core_config + ImageRegistry::AwsEcr(label) => { + let config = core_config .aws_ecr_registries .get(label) - .map(AwsEcrConfig::from), - ), + .with_context(|| { + format!( + "did not find config for aws ecr registry {label}" + ) + })?; + ( + Some( + ecr::get_ecr_token( + &config.region, + &config.access_key_id, + &config.secret_access_key, + ) + .await + .context("failed to create aws ecr login token")?, + ), + Some(AwsEcrConfig::from(config)), + ) + } ImageRegistry::Custom(_) => { return Err(anyhow!("Custom ImageRegistry not yet supported")) }