install aws cli core

This commit is contained in:
mbecker20
2024-06-23 01:31:15 -07:00
parent 4524db94db
commit 16ede84bac
4 changed files with 28 additions and 5 deletions
Generated
+1
View File
@@ -2266,6 +2266,7 @@ dependencies = [
"async_timing_util",
"aws-config",
"aws-sdk-ec2",
"aws_ecr",
"axum 0.7.5",
"axum-extra",
"base64 0.22.1",
+1
View File
@@ -18,6 +18,7 @@ path = "src/main.rs"
monitor_client = { workspace = true, features = ["mongo"] }
periphery_client.workspace = true
formatting.workspace = true
aws_ecr.workspace = true
logger.workspace = true
git.workspace = true
# mogh
+5 -2
View File
@@ -16,8 +16,11 @@ RUN cd frontend && yarn link @monitor/client && yarn && yarn build
FROM debian:bookworm-slim
# Install Deps
RUN apt update && apt install -y git ca-certificates
RUN apt update && apt install -y git curl ca-certificates && \
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \
unzip awscliv2.zip && \
./aws/install
# Copy
COPY ./config_example/core.config.example.toml /config/config.toml
COPY --from=core-builder /builder/target/release/core /
+21 -3
View File
@@ -76,7 +76,7 @@ impl Resolve<RunBuild, (User, Update)> for State {
.await?;
let (registry_token, aws_ecr) =
validate_account_extract_registry_token_aws_ecr(&build)?;
validate_account_extract_registry_token_aws_ecr(&build).await?;
// get the action state for the build (or insert default).
let action_state =
@@ -736,7 +736,7 @@ fn start_aws_builder_log(
/// This will make sure that a build with non-none image registry has an account attached,
/// and will check the core config for a token / aws ecr config matching requirements.
/// Otherwise it is left to periphery.
fn validate_account_extract_registry_token_aws_ecr(
async fn validate_account_extract_registry_token_aws_ecr(
build: &Build,
) -> anyhow::Result<(Option<String>, Option<AwsEcrConfig>)> {
match &build.config.image_registry {
@@ -760,7 +760,25 @@ fn validate_account_extract_registry_token_aws_ecr(
Ok((core_config().github_accounts.get(account).cloned(), None))
}
ImageRegistry::AwsEcr(label) => {
Ok((None, core_config().aws_ecr_registries.get(label).cloned()))
let config = core_config().aws_ecr_registries.get(label);
let token = match config {
Some(AwsEcrConfig {
region,
access_key_id,
secret_access_key,
..
}) => Some(
aws_ecr::get_ecr_token(
region,
access_key_id,
secret_access_key,
)
.await
.context("failed to get aws ecr token")?,
),
None => None,
};
Ok((token, config.cloned()))
}
ImageRegistry::Custom(_) => {
Err(anyhow!("Custom image registry is not implemented"))