From 80b8e014b048d2c943afe71602f58d74d6ed27f2 Mon Sep 17 00:00:00 2001 From: Sam Alba Date: Fri, 9 Apr 2021 15:58:14 -0700 Subject: [PATCH] stdlib/aws: implemented ecr helper to get registry credentials Signed-off-by: Sam Alba --- stdlib/aws/ecr/ecr.cue | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 stdlib/aws/ecr/ecr.cue diff --git a/stdlib/aws/ecr/ecr.cue b/stdlib/aws/ecr/ecr.cue new file mode 100644 index 00000000..b87d0826 --- /dev/null +++ b/stdlib/aws/ecr/ecr.cue @@ -0,0 +1,36 @@ +package ecr + +import ( + "dagger.io/dagger" + "dagger.io/aws" +) + +// Credentials retriever for ECR +#Credentials: { + + // AWS Config + config: aws.#Config + + // Target is the ECR image + target: string + + out: dagger.#Secret + + // ECR credentials + credentials: dagger.#RegistryCredentials & { + username: "AWS" + secret: out + } + + aws.#Script & { + "config": config + export: "/out" + code: """ + aws ecr get-login-password > /out + """ + } + + // Authentication for ECR Registries + auth: dagger.#RegistryAuth + auth: "\(target)": credentials +}