stdlib/ecr / jamstack: ported to new syntax
Signed-off-by: Sam Alba <sam.alba@gmail.com>
This commit is contained in:
parent
07f7c419f0
commit
c28199c76e
@ -17,12 +17,9 @@ import (
|
|||||||
awsConfig: aws.#Config
|
awsConfig: aws.#Config
|
||||||
buildArgs: [string]: string
|
buildArgs: [string]: string
|
||||||
|
|
||||||
pushTarget: "\(repository):\(tag)"
|
|
||||||
|
|
||||||
// Use these credentials to push
|
// Use these credentials to push
|
||||||
ecrCreds: ecr.#Credentials & {
|
ecrCreds: ecr.#Credentials & {
|
||||||
config: awsConfig
|
config: awsConfig
|
||||||
target: pushTarget
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ref: {
|
ref: {
|
||||||
@ -37,9 +34,16 @@ import (
|
|||||||
}
|
}
|
||||||
buildArg: buildArgs
|
buildArg: buildArgs
|
||||||
},
|
},
|
||||||
|
// Login to Registry
|
||||||
|
op.#DockerLogin & {
|
||||||
|
target: repository
|
||||||
|
username: ecrCreds.username
|
||||||
|
secret: ecrCreds.secret
|
||||||
|
},
|
||||||
// Push the image to the registry
|
// Push the image to the registry
|
||||||
op.#PushContainer & {
|
op.#PushContainer & {
|
||||||
ref: pushTarget
|
ref: "\(repository):\(tag)"
|
||||||
|
auth: ecrCreds.auth
|
||||||
},
|
},
|
||||||
op.#Export & {
|
op.#Export & {
|
||||||
source: "/dagger/image_ref"
|
source: "/dagger/image_ref"
|
||||||
|
@ -7,30 +7,21 @@ import (
|
|||||||
|
|
||||||
// Credentials retriever for ECR
|
// Credentials retriever for ECR
|
||||||
#Credentials: {
|
#Credentials: {
|
||||||
|
|
||||||
// AWS Config
|
// AWS Config
|
||||||
config: aws.#Config
|
config: aws.#Config
|
||||||
|
|
||||||
// Target is the ECR image
|
|
||||||
target: string
|
|
||||||
|
|
||||||
out: dagger.#Secret
|
out: dagger.#Secret
|
||||||
|
|
||||||
// ECR credentials
|
// ECR credentials
|
||||||
credentials: dagger.#RegistryCredentials & {
|
|
||||||
username: "AWS"
|
username: "AWS"
|
||||||
secret: out
|
secret: out
|
||||||
}
|
|
||||||
|
|
||||||
aws.#Script & {
|
aws.#Script & {
|
||||||
|
always: true
|
||||||
"config": config
|
"config": config
|
||||||
export: "/out"
|
export: "/out"
|
||||||
code: """
|
code: """
|
||||||
aws ecr get-login-password > /out
|
aws ecr get-login-password > /out
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
||||||
// Authentication for ECR Registries
|
|
||||||
auth: dagger.#RegistryAuth
|
|
||||||
auth: "\(target)": credentials
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user