stdlib/aws: implemented ecr helper to get registry credentials
Signed-off-by: Sam Alba <sam.alba@gmail.com>
This commit is contained in:
parent
ec0e00e029
commit
80b8e014b0
36
stdlib/aws/ecr/ecr.cue
Normal file
36
stdlib/aws/ecr/ecr.cue
Normal file
@ -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
|
||||||
|
}
|
Reference in New Issue
Block a user