stdlib: aws/ecr: simplify
Signed-off-by: Solomon Hykes <solomon@dagger.io>
This commit is contained in:
parent
336f1aecc4
commit
ce663ca2ba
@ -6,18 +6,19 @@ sidebar_label: ecr
|
||||
|
||||
## #Credentials
|
||||
|
||||
Credentials retriever for ECR
|
||||
Convert AWS credentials to Docker Registry credentials for ECR
|
||||
|
||||
### #Credentials Inputs
|
||||
|
||||
| Name | Type | Description |
|
||||
| ------------- |:-------------: |:-------------: |
|
||||
|*config.region* | `string` |AWS region |
|
||||
|*config.accessKey* | `dagger.#Secret` |AWS access key |
|
||||
|*config.secretKey* | `dagger.#Secret` |AWS secret key |
|
||||
| Name | Type | Description |
|
||||
| ------------- |:-------------: |:-------------: |
|
||||
|*config.region* | `string` |AWS region |
|
||||
|*config.accessKey* | `dagger.#Secret` |AWS access key |
|
||||
|*config.secretKey* | `dagger.#Secret` |AWS secret key |
|
||||
|*ctr.image.config.region* | `string` |AWS region |
|
||||
|*ctr.image.config.accessKey* | `dagger.#Secret` |AWS access key |
|
||||
|*ctr.image.config.secretKey* | `dagger.#Secret` |AWS secret key |
|
||||
|
||||
### #Credentials Outputs
|
||||
|
||||
| Name | Type | Description |
|
||||
| ------------- |:-------------: |:-------------: |
|
||||
|*secret* | `string` |- |
|
||||
_No output._
|
||||
|
@ -1,52 +1,30 @@
|
||||
package ecr
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
"dagger.io/dagger/op"
|
||||
"dagger.io/aws"
|
||||
"dagger.io/os"
|
||||
)
|
||||
|
||||
// Credentials retriever for ECR
|
||||
// Convert AWS credentials to Docker Registry credentials for ECR
|
||||
#Credentials: {
|
||||
// AWS Config
|
||||
config: aws.#Config
|
||||
|
||||
out: dagger.#Secret
|
||||
|
||||
// ECR credentials
|
||||
username: "AWS"
|
||||
|
||||
secret: {
|
||||
@dagger(output)
|
||||
string
|
||||
|
||||
#up: [
|
||||
op.#Load & {
|
||||
from: aws.#CLI & {
|
||||
"config": config
|
||||
}
|
||||
},
|
||||
|
||||
op.#Exec & {
|
||||
always: true
|
||||
|
||||
args: [
|
||||
"/bin/bash",
|
||||
"--noprofile",
|
||||
"--norc",
|
||||
"-eo",
|
||||
"pipefail",
|
||||
"-c",
|
||||
#"""
|
||||
aws ecr get-login-password > /out
|
||||
"""#,
|
||||
]
|
||||
},
|
||||
|
||||
op.#Export & {
|
||||
source: "/out"
|
||||
format: "string"
|
||||
},
|
||||
]
|
||||
ctr: os.#Container & {
|
||||
image: aws.#CLI & {
|
||||
"config": config
|
||||
}
|
||||
always: true
|
||||
command: "aws ecr get-login-password > /out"
|
||||
}
|
||||
|
||||
secret: {
|
||||
os.#File & {
|
||||
from: ctr
|
||||
path: "/out"
|
||||
}
|
||||
}.read.data
|
||||
}
|
||||
|
Reference in New Issue
Block a user