cue modules: move stdlib to pkg/alpha.dagger.io
In preparation for Europa, we will vendor multiple CUE modules: - `pkg/alpha.dagger.io`: legacy non-europa packages - `pkg/dagger.io`: core Europa packages - `pkg/universe.dagger.io`: Europa universe Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
56
pkg/alpha.dagger.io/gcp/gcloud.cue
Normal file
56
pkg/alpha.dagger.io/gcp/gcloud.cue
Normal file
@@ -0,0 +1,56 @@
|
||||
package gcp
|
||||
|
||||
import (
|
||||
"alpha.dagger.io/dagger/op"
|
||||
"alpha.dagger.io/alpine"
|
||||
)
|
||||
|
||||
// Re-usable gcloud component
|
||||
#GCloud: {
|
||||
config: #Config
|
||||
version: string | *"366.0.0"
|
||||
package: [string]: string | bool
|
||||
|
||||
#up: [
|
||||
op.#Load & {
|
||||
from: alpine.#Image & {
|
||||
"package": package
|
||||
"package": bash: true
|
||||
"package": python3: true
|
||||
"package": jq: true
|
||||
"package": curl: true
|
||||
}
|
||||
},
|
||||
|
||||
// Install the gcloud cli
|
||||
op.#Exec & {
|
||||
args: ["sh", "-c",
|
||||
#"""
|
||||
curl -sfL https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-\#(version)-linux-x86_64.tar.gz | tar -C /usr/local -zx
|
||||
ln -s /usr/local/google-cloud-sdk/bin/gcloud /usr/local/bin
|
||||
ln -s /usr/local/google-cloud-sdk/bin/gsutil /usr/local/bin
|
||||
"""#,
|
||||
]
|
||||
},
|
||||
|
||||
op.#Exec & {
|
||||
args: ["gcloud", "-q", "auth", "activate-service-account", "--key-file=/service_key"]
|
||||
mount: "/service_key": secret: config.serviceKey
|
||||
},
|
||||
|
||||
op.#Exec & {
|
||||
args: ["gcloud", "-q", "config", "set", "project", config.project]
|
||||
},
|
||||
|
||||
if config.region != null {
|
||||
op.#Exec & {
|
||||
args: ["gcloud", "-q", "config", "set", "compute/region", config.region]
|
||||
}
|
||||
},
|
||||
if config.zone != null {
|
||||
op.#Exec & {
|
||||
args: ["gcloud", "-q", "config", "set", "compute/zone", config.zone]
|
||||
}
|
||||
},
|
||||
]
|
||||
}
|
Reference in New Issue
Block a user