diff --git a/docs/reference/gcp/README.md b/docs/reference/gcp/README.md index 1b42d71e..24380cc5 100644 --- a/docs/reference/gcp/README.md +++ b/docs/reference/gcp/README.md @@ -16,11 +16,12 @@ Base Google Cloud Config ### gcp.#Config Inputs -| Name | Type | Description | -| ------------- |:-------------: |:-------------: | -|*region* | `string` |GCP region | -|*project* | `string` |GCP project | -|*serviceKey* | `dagger.#Secret` |GCP service key | +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*region* | `*null \| string` |GCP region | +|*zone* | `*null \| string` |GCP zone | +|*project* | `string` |GCP project | +|*serviceKey* | `dagger.#Secret` |GCP service key | ### gcp.#Config Outputs @@ -32,11 +33,12 @@ Re-usable gcloud component ### gcp.#GCloud Inputs -| Name | Type | Description | -| ------------- |:-------------: |:-------------: | -|*config.region* | `string` |GCP region | -|*config.project* | `string` |GCP project | -|*config.serviceKey* | `dagger.#Secret` |GCP service key | +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*config.region* | `*null \| string` |GCP region | +|*config.zone* | `*null \| string` |GCP zone | +|*config.project* | `string` |GCP project | +|*config.serviceKey* | `dagger.#Secret` |GCP service key | ### gcp.#GCloud Outputs diff --git a/docs/reference/gcp/cloudrun.md b/docs/reference/gcp/cloudrun.md index 74bc240b..4c271e25 100644 --- a/docs/reference/gcp/cloudrun.md +++ b/docs/reference/gcp/cloudrun.md @@ -16,7 +16,8 @@ Service deploys a Cloud Run service based on provided GCR image | Name | Type | Description | | ------------- |:-------------: |:-------------: | -|*config.region* | `string` |GCP region | +|*config.region* | `*null \| string` |GCP region | +|*config.zone* | `*null \| string` |GCP zone | |*config.project* | `string` |GCP project | |*config.serviceKey* | `dagger.#Secret` |GCP service key | |*name* | `string` |Cloud Run service name | diff --git a/docs/reference/gcp/gcr.md b/docs/reference/gcp/gcr.md index 169fcdbc..5799e580 100644 --- a/docs/reference/gcp/gcr.md +++ b/docs/reference/gcp/gcr.md @@ -16,11 +16,12 @@ Credentials retriever for GCR ### gcr.#Credentials Inputs -| Name | Type | Description | -| ------------- |:-------------: |:-------------: | -|*config.region* | `string` |GCP region | -|*config.project* | `string` |GCP project | -|*config.serviceKey* | `dagger.#Secret` |GCP service key | +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*config.region* | `*null \| string` |GCP region | +|*config.zone* | `*null \| string` |GCP zone | +|*config.project* | `string` |GCP project | +|*config.serviceKey* | `dagger.#Secret` |GCP service key | ### gcr.#Credentials Outputs diff --git a/docs/reference/gcp/gcs.md b/docs/reference/gcp/gcs.md index 462d5245..8d773bda 100644 --- a/docs/reference/gcp/gcs.md +++ b/docs/reference/gcp/gcs.md @@ -18,7 +18,8 @@ GCS Bucket object(s) sync | Name | Type | Description | | ------------- |:-------------: |:-------------: | -|*config.region* | `string` |GCP region | +|*config.region* | `*null \| string` |GCP region | +|*config.zone* | `*null \| string` |GCP zone | |*config.project* | `string` |GCP project | |*config.serviceKey* | `dagger.#Secret` |GCP service key | |*source* | `dagger.#Artifact` |Source Artifact to upload to GCS | diff --git a/docs/reference/gcp/gke.md b/docs/reference/gcp/gke.md index a01c1fd6..2c620ce9 100644 --- a/docs/reference/gcp/gke.md +++ b/docs/reference/gcp/gke.md @@ -18,7 +18,8 @@ KubeConfig config outputs a valid kube-auth-config for kubectl client | Name | Type | Description | | ------------- |:-------------: |:-------------: | -|*config.region* | `string` |GCP region | +|*config.region* | `*null \| string` |GCP region | +|*config.zone* | `*null \| string` |GCP zone | |*config.project* | `string` |GCP project | |*config.serviceKey* | `dagger.#Secret` |GCP service key | |*clusterName* | `string` |GKE cluster name | diff --git a/docs/reference/gcp/secretmanager.md b/docs/reference/gcp/secretmanager.md index ce483767..a7d12247 100644 --- a/docs/reference/gcp/secretmanager.md +++ b/docs/reference/gcp/secretmanager.md @@ -14,14 +14,16 @@ import "alpha.dagger.io/gcp/secretmanager" ### secretmanager.#Secrets Inputs -| Name | Type | Description | -| ------------- |:-------------: |:-------------: | -|*config.region* | `string` |GCP region | -|*config.project* | `string` |GCP project | -|*config.serviceKey* | `dagger.#Secret` |GCP service key | -|*deployment.image.config.region* | `string` |GCP region | -|*deployment.image.config.project* | `string` |GCP project | -|*deployment.image.config.serviceKey* | `dagger.#Secret` |GCP service key | +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*config.region* | `*null \| string` |GCP region | +|*config.zone* | `*null \| string` |GCP zone | +|*config.project* | `string` |GCP project | +|*config.serviceKey* | `dagger.#Secret` |GCP service key | +|*deployment.image.config.region* | `*null \| string` |GCP region | +|*deployment.image.config.zone* | `*null \| string` |GCP zone | +|*deployment.image.config.project* | `string` |GCP project | +|*deployment.image.config.serviceKey* | `dagger.#Secret` |GCP service key | ### secretmanager.#Secrets Outputs diff --git a/stdlib/.dagger/env/google-gke/values.yaml b/stdlib/.dagger/env/google-gke/values.yaml index 1ba1003d..b023b699 100644 --- a/stdlib/.dagger/env/google-gke/values.yaml +++ b/stdlib/.dagger/env/google-gke/values.yaml @@ -4,10 +4,10 @@ name: google-gke inputs: TestConfig.gcpConfig.project: text: dagger-ci - TestConfig.gcpConfig.region: - text: us-west2-a TestConfig.gcpConfig.serviceKey: secret: ENC[AES256_GCM,data:UEKTXvyrBgHKOYE9vSGoHua9wWALjghxWu+ui9K3MAS+1mnVlc1qjTbwv/1/hIIkRNlyhY6WlN0k3x2imusFFInzrNZ5G4FJHGiP/zaazd7shUS8LZsh1cL0I1jnsaDJaz4Zw0yVu+FT1z2/+9l81U9MrtvbLNKFSqZJsrymZl5lUCxiRsUEBiC0/rOoOlQ88kfnxUdBXnG7ABciqPUK7cYaMo5RbB1a9YfacB8S2sosClxK727jUgD20I12ru+y5Y/hg00BhBl9bIg35VTI8PFeZvRqQowqaJO+i1BjQbBYef8s9faYdZGEP0hUrvUpPek4Z0ZBDRbxRfRFAiXBbWbvCJErGlsmcNGqllixgDbcYQNKBTjZEKke4PGHtahmPXOIOO9/fxnUCoci//azJ5fUP0Kdiw06DQYQnngwRSA/nOqTBiuWcfiTLY00iQxoh+8Mt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KvsMhfetBx0ocY8lXjbs3pzB6ZswDGzF4j0eiWBfu9UZoiQVtt1eIfAPoZO9u/n2Wbpx+ov+mJFf0dZklKDED5CUbmj8/izOdE9KbiPDFr1nZZQbO+YwJYhjxxqxzwC41CvH5XQTCCadeWgb5cHEwwunFRVCYeEFvTlP6nR9pS19UZoQvPNk5NEnZVKxWVD1lK18frvX8MxIpB2xaSbUkvGi3tueinLa7OYVfjirBJ1GYbuADa4H0KOxi4MP59ah6TOmsZstA6plFbtRRtk4Iofzu1mAyUN52SZzwCvH5/IxOh6vQxg7EcMfB8O5+S87PeE3vd1ch+UVDwQ3fvNmjd7/77XdKZiR7bwiDxodxABpG4iYrxcfkGPOTCKUlisgFNNmSmwG7FJMYWkz3RcEHib/biklnEKbm/9G5000cwZXXglZb8QjleSklkSEZa4DYec1SNvD/KwRbk5lYr03TDl7DrZo3WjKWvWGMUs3,iv:tPbOGayR7NiXcuHWjX0pX/nSitOxmsr4qqrc6irlIJI=,tag:apejA4UTYTuwT4CUSeoaRQ==,type:str] + TestConfig.gcpConfig.zone: + text: us-west2-a sops: kms: [] gcp_kms: [] @@ -23,8 +23,8 @@ sops: ZXd6Qmd1YUtxMnVTVkYybWgrV3pVK2MKowMeOZU3j3BxERT0DwhQYCGUDBK6gCdo WByubiBATdsb7h7ytCC4HutWppynK4MpU+Ya9NP83AZuXo+Wa2u6aQ== -----END AGE ENCRYPTED FILE----- - lastmodified: "2021-07-08T09:55:26Z" - mac: ENC[AES256_GCM,data:WgQWkQEEuuH80dTI39hxMYzXGahhCPz5TidDgJvYnxWKKOphB23wrF56K56iXiNkdrPM7lQe6iwhK94FJCYuLGv180nrLO9Z7FnK0KuT+kwqBN+SvWbx8+Wrf55qE9mrMHZjsOlVADUcKRmdSLJB/02tLBQgtrwdGY13vlzC1+g=,iv:I2ro64HiZjipA8K1XHHGudtMmzPAVZLhXSg6MOA06mM=,tag:YYDje4ThW+zDEnASOXu/nA==,type:str] + lastmodified: "2021-09-14T09:13:06Z" + mac: ENC[AES256_GCM,data:8niBQ2za+ig2qm+V35pnAqqgAqoafBLxd62ZEwTrVfQz8gg28YCUMGIWD0/tT/KiFhBYDZ07T61D6uQVJuUANc2adDo6xx/jJ3Q3si4HJLScLzzPWTdVhc++tbXAGnBVXOxJNjKw6zbTK+cY8E1aLWpWJ+jLNgCpg/UCyZhetNU=,iv:dS1xMRHEdvFlJaIUFHdDVyE1d7UyN8hVFe8CtVV8PkE=,tag:lYmVhDbGo6Klne5mWcryLA==,type:str] pgp: [] encrypted_suffix: secret version: 3.7.1 diff --git a/stdlib/gcp/gcloud.cue b/stdlib/gcp/gcloud.cue index 2d09b095..9a03be7c 100644 --- a/stdlib/gcp/gcloud.cue +++ b/stdlib/gcp/gcloud.cue @@ -42,8 +42,15 @@ import ( args: ["gcloud", "-q", "config", "set", "project", config.project] }, - op.#Exec & { - args: ["gcloud", "-q", "config", "set", "compute/region", config.region] + 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] + } }, ] } diff --git a/stdlib/gcp/gcp.cue b/stdlib/gcp/gcp.cue index 18e71dff..ab439e75 100644 --- a/stdlib/gcp/gcp.cue +++ b/stdlib/gcp/gcp.cue @@ -8,9 +8,11 @@ import ( // Base Google Cloud Config #Config: { // GCP region - region: string @dagger(input) + region: dagger.#Input & {*null | string} + // GCP zone + zone: dagger.#Input & {*null | string} // GCP project - project: string @dagger(input) + project: dagger.#Input & {string} // GCP service key - serviceKey: dagger.#Secret @dagger(input) + serviceKey: dagger.#Input & {dagger.#Secret} } diff --git a/stdlib/universe.bats b/stdlib/universe.bats index cbaad899..cb85c73f 100644 --- a/stdlib/universe.bats +++ b/stdlib/universe.bats @@ -169,7 +169,7 @@ setup() { } @test "google cloud: gke" { - dagger -e google-gke up + dagger -e google-gke up } @test "google cloud: secretmanager" {