stdlib: gcr support

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
Andrea Luzzardi
2021-05-19 17:45:09 -07:00
parent 5bd3349a27
commit 0f69f3a8af
3 changed files with 146 additions and 0 deletions

44
stdlib/gcp/gcr/gcr.cue Normal file
View File

@@ -0,0 +1,44 @@
package gcr
import (
"dagger.io/dagger/op"
"dagger.io/gcp"
)
// Credentials retriever for GCR
#Credentials: {
// GCP Config
config: gcp.#Config
// GCR credentials
username: "oauth2accesstoken"
secret: {
string
#up: [
op.#Load & {
from: gcp.#GCloud & {
"config": config
}
},
op.#Exec & {
always: true
args: [
"/bin/bash",
"--noprofile",
"--norc",
"-eo",
"pipefail",
"-c",
#"""
printf $(gcloud auth print-access-token) > /token.txt
"""#,
]
},
op.#Export & {
source: "/token.txt"
},
]
}
}