From 8c5b4270d0e2c83be800ed677b13f0a3472437ca Mon Sep 17 00:00:00 2001 From: Tihomir Jovicic Date: Wed, 9 Jun 2021 12:01:27 +0200 Subject: [PATCH 01/18] Add Cloud Run support Signed-off-by: Tihomir Jovicic --- docs/programming/programming.md | 1 + docs/reference/universe/gcp/cloudrun.md | 25 +++++++++ examples/README.md | 46 +++++++++++++++- .../.dagger/env/cloud-run-app/.gitignore | 2 + .../.dagger/env/cloud-run-app/plan/main.cue | 26 ++++++++++ .../.dagger/env/cloud-run-app/values.yaml | 30 +++++++++++ .../go-http-server/.dockerignore | 13 +++++ .../cloud-run-app/go-http-server/Dockerfile | 33 ++++++++++++ examples/cloud-run-app/go-http-server/go.mod | 3 ++ examples/cloud-run-app/go-http-server/main.go | 35 +++++++++++++ examples/cloud-run-app/main.cue | 26 ++++++++++ stdlib/gcp/cloudrun/cloudrun.cue | 52 +++++++++++++++++++ tests/README.md | 2 +- .../cloudrun/.dagger/env/default/.gitignore | 2 + .../.dagger/env/default/plan/cloudrun.cue | 15 ++++++ .../cloudrun/.dagger/env/default/values.yaml | 28 ++++++++++ 16 files changed, 337 insertions(+), 2 deletions(-) create mode 100644 docs/reference/universe/gcp/cloudrun.md create mode 100644 examples/cloud-run-app/.dagger/env/cloud-run-app/.gitignore create mode 100644 examples/cloud-run-app/.dagger/env/cloud-run-app/plan/main.cue create mode 100644 examples/cloud-run-app/.dagger/env/cloud-run-app/values.yaml create mode 100644 examples/cloud-run-app/go-http-server/.dockerignore create mode 100644 examples/cloud-run-app/go-http-server/Dockerfile create mode 100644 examples/cloud-run-app/go-http-server/go.mod create mode 100644 examples/cloud-run-app/go-http-server/main.go create mode 100644 examples/cloud-run-app/main.cue create mode 100644 stdlib/gcp/cloudrun/cloudrun.cue create mode 100644 tests/stdlib/gcp/cloudrun/.dagger/env/default/.gitignore create mode 100644 tests/stdlib/gcp/cloudrun/.dagger/env/default/plan/cloudrun.cue create mode 100644 tests/stdlib/gcp/cloudrun/.dagger/env/default/values.yaml diff --git a/docs/programming/programming.md b/docs/programming/programming.md index e20d0aeb..a0c8736c 100644 --- a/docs/programming/programming.md +++ b/docs/programming/programming.md @@ -75,6 +75,7 @@ For more inspiration, see these examples: - [Provision a Kubernetes cluster on AWS](https://github.com/dagger/dagger/blob/main/examples/README.md#provision-a-kubernetes-cluster-on-aws) - [Add HTTP monitoring to your application](https://github.com/dagger/dagger/blob/main/examples/README.md#add-http-monitoring-to-your-application) - [Deploy an application to your Kubernetes cluster](https://github.com/dagger/dagger/blob/main/examples/README.md#deploy-an-application-to-your-kubernetes-cluster) +- [Deploy an application to GCP Cloud Run](https://github.com/dagger/dagger/blob/main/examples/README.md#deploy-an-application-to-gcp-cloud-run) 5\. Extend your plan with relay definitions from [Dagger Universe](https://github.com/dagger/dagger/tree/main/stdlib), an encyclopedia of diff --git a/docs/reference/universe/gcp/cloudrun.md b/docs/reference/universe/gcp/cloudrun.md new file mode 100644 index 00000000..aa9e2121 --- /dev/null +++ b/docs/reference/universe/gcp/cloudrun.md @@ -0,0 +1,25 @@ +--- +sidebar_label: cloudrun +--- + +# dagger.io/gcp/cloudrun + +## #Deploy + +Deploy deploys a Cloud Run service based on provided GCR image + +### #Deploy Inputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*config.region* | `string` |GCP region | +|*config.project* | `string` |GCP project | +|*config.serviceKey* | `dagger.#Secret` |GCP service key | +|*serviceName* | `string` |service name | +|*region* | `*"us-west2" \| string` |region to which deploy the service | +|*image* | `string` |GCR image ref | +|*platform* | `*"managed" \| string` |Cloud Run platform | + +### #Deploy Outputs + +_No output._ diff --git a/examples/README.md b/examples/README.md index 5de5c8b1..2fa83d9c 100644 --- a/examples/README.md +++ b/examples/README.md @@ -287,7 +287,7 @@ dagger input text cluster.clusterName MY_CLUSTER_NAME 5. Load the Helm chart ```sh -dagger input dir helmChart.chart ./kubernetes-app/testdata/mychart +dagger input dir helmChart.chart ./testdata/mychart ``` 6. Deploy! @@ -295,3 +295,47 @@ dagger input dir helmChart.chart ./kubernetes-app/testdata/mychart ```sh dagger up ``` + +## Deploy an application to GCP Cloud Run + +This example shows how to deploy an application to GCP Cloud Run. Read the deployment [plan](https://github.com/dagger/dagger/tree/main/examples/cloud-run-app) + +NOTE: this example requires an EKS cluster to allow authentication with your AWS credentials; but can easily be adapter to deploy to any Kubernetes cluster. + +Components: + +- [Cloud Run](https://cloud.google.com/run) + +How to run: + +1. Initialize a new workspace + +```sh +cd ./cloud-run-app +dagger init +``` + +2. Create a new environment + +```sh +dagger new cloud-run-app +cp *.cue ./.dagger/env/cloud-run-app/plan/ +``` + +3. Configure the Cloud Run service + +```sh +dagger input text serviceName MY_APP_NAME +dagger input text region MY_GCP_REGION +dagger input text image MY_GCR_IMAGE_NAME + +dagger input text gcpConfig.project MY_GCP_PROJECT +dagger input secret gcpConfig.serviceKey -f MY_GCP_SERVICE_KEY_FILE + +``` + +4. Deploy! + +```sh +dagger up +``` diff --git a/examples/cloud-run-app/.dagger/env/cloud-run-app/.gitignore b/examples/cloud-run-app/.dagger/env/cloud-run-app/.gitignore new file mode 100644 index 00000000..01ec19b0 --- /dev/null +++ b/examples/cloud-run-app/.dagger/env/cloud-run-app/.gitignore @@ -0,0 +1,2 @@ +# dagger state +state/** diff --git a/examples/cloud-run-app/.dagger/env/cloud-run-app/plan/main.cue b/examples/cloud-run-app/.dagger/env/cloud-run-app/plan/main.cue new file mode 100644 index 00000000..b0eece2f --- /dev/null +++ b/examples/cloud-run-app/.dagger/env/cloud-run-app/plan/main.cue @@ -0,0 +1,26 @@ +package main + +import ( + "dagger.io/gcp" + "dagger.io/gcp/cloudrun" +) + +// Cloud Run service name +serviceName: *"cloudrun-test" | string @dagger(input) + +// GCP region +region: *"us-west2" | string @dagger(input) + +// Image name +image: *"gcr.io/dagger-ci/cloudrun-test" | string @dagger(input) + +gcpConfig: gcp.#Config & { + region: region +} + +deploy: cloudrun.#Deploy & { + serviceName: serviceName + image: image + config: gcpConfig + region: region +} diff --git a/examples/cloud-run-app/.dagger/env/cloud-run-app/values.yaml b/examples/cloud-run-app/.dagger/env/cloud-run-app/values.yaml new file mode 100644 index 00000000..c25de1c8 --- /dev/null +++ b/examples/cloud-run-app/.dagger/env/cloud-run-app/values.yaml @@ -0,0 +1,30 @@ +name: cloud-run-app +inputs: + gcpConfig.project: + text: dagger-ci + gcpConfig.serviceKey: + secret: ENC[AES256_GCM,data:1+764K9v6qxPIzNU9sQ3VvTPJjMpd/HdZpRej8jIhi9OJR30+eQV/kfysnLqx28IBwVgvCeUwJb72cZHOjREdMqH6SzDcmyHZfrKL37l8QHMe9XIl5QPZyRH1Hos/W4ZQD7wlPQxWvwcDEw6fKr+JbFEC/t/sCDePIO70LrJTiClT8yJVtw0o2Va908nEKqNDxDr4/4DZoUctBeBZTMPSHohgdH+DZ34jGrne/zhKK9taxRzkIvt3da0PylzfzOaogEvnJCsvWoLlMM1jSjIwGzEDRDd8PnmSp+ZbauJXIFaHPPCowDn0W/BAngIQ2b+Cz9AOAvSMa7qk3skdVgXCadCvlpKaspXICFsC1rdRevNTP4B0T9YCTSeQfAZw9TE4R/IO9kU5USpy4oUHbnt1MKg60y5kSHbW+cpDN0oOTyfDLVKbbhMMW6ID9LtkoTVZX111vv8UVvq1ndxqmbZavY7rn5siT8X0X92m5yZqWbxeUlUd/TIVoHQeXvOPp5AIpLvdiqbK9aYFKP1jPmGYA3Q60MiLD34hch8rb2rYDZCfCaZABXD8HWTlWoQEhPeiWBgOCR+/FyhL3PkQDqIThg5J1H88+1PmhNThrV0fbYKkT8wZumosC+/MOaVqaAT9dyPE4u//Osy9dLQ0DBD34OMpEp06jYqxBiukBdGGaR71TjLAZfjChfJASsHT9PLopoOtD80tpfT16v44wvJluNwYgjmvsV4s/vpZ4xCCsF3QjU9IiLXN3TVYBEJdA9/yJkhLRtjMRZMJ0xOpFtsZcAguE+BHZQBrnrfN/ME0u9AsHwKFUB5nejJBeRTBNROibxqK1Ks+c40RgSjq05FL4nwJoAbQKBeFVWQ4T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GRCpCWYVLhDLnGJ0BpfcEZjAmQ+glqTJ7qBVVkZL0/tXebFFg3AUhMK1M4vZzLy0E4x10ZBuY3TEKZziR2KGjmP3098E8=,iv:XBNEXLnpNnuUAyaEWuobkPeeBGYPIrEiqrqIS/r0Lu0=,tag:Ft6wBjWDFYKBNm52Dn1vxQ==,type:str] + region: + text: us-west2 + serviceName: + text: cloudrun-test3 +sops: + kms: [] + gcp_kms: [] + azure_kv: [] + hc_vault: [] + age: + - recipient: age1j6nrevprudhes65akfpl7sl65pktl4wj272gh7xl82ul3aaugppq6zxujg + enc: | + -----BEGIN AGE ENCRYPTED FILE----- + YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBxWWdlTDFWK0VNQTNoUExS + Y20yNVZTT0hxNi91d3JvTUZ3UFNuRStUQTNvCnVEOVlTUjhvNU5MejdldWt0eWxR + UnZ4T0lUd3dsSURaNzRXWGVKQWllWTgKLS0tIHV0QkFWTDk2RE9hK2EyNm9GRVll + dmE4QXJmK255RHNIVzJjNjFwRCtCMzQKaAfgT/Q7uU4urlcgtz25Pbwx/p4iyEX/ + YpZaWQuVR2J9jtEh86oYZYGLxO5SAvqO5v20tfxXdVzZQkw0/QVPhQ== + -----END AGE ENCRYPTED FILE----- + lastmodified: "2021-06-10T06:06:28Z" + mac: ENC[AES256_GCM,data:qlX0EtuyHMNhMoVtR0xwD6kM2i+Jbq6NC6oQwZkEb4Pe8yy1cXKtHOvzDQAmMOL/vyE82fRtTmvfc85gA8vgw320TzXDcqxkpbVlML/5O7lDvOBwePvwajwG5JOlBXl+UJWMrH5nYfRPas1B4RSV7lksqXf/+a2+O0b2NN0UWDM=,iv:GqffDMMcLDefh6HU8fmaXlOk4xkjhq0sP5jkWAsiZKo=,tag:ttbyp8H7ZviPebmga9oJ7g==,type:str] + pgp: [] + encrypted_suffix: secret + version: 3.7.1 diff --git a/examples/cloud-run-app/go-http-server/.dockerignore b/examples/cloud-run-app/go-http-server/.dockerignore new file mode 100644 index 00000000..4cc30b02 --- /dev/null +++ b/examples/cloud-run-app/go-http-server/.dockerignore @@ -0,0 +1,13 @@ +# The .dockerignore file excludes files from the container build process. +# +# https://docs.docker.com/engine/reference/builder/#dockerignore-file + +# Exclude locally vendored dependencies. +vendor/ + +# Exclude "build-time" ignore files. +.dockerignore +.gcloudignore + +# Exclude git history and configuration. +.gitignore diff --git a/examples/cloud-run-app/go-http-server/Dockerfile b/examples/cloud-run-app/go-http-server/Dockerfile new file mode 100644 index 00000000..21e1f572 --- /dev/null +++ b/examples/cloud-run-app/go-http-server/Dockerfile @@ -0,0 +1,33 @@ +# Use the offical golang image to create a binary. +# This is based on Debian and sets the GOPATH to /go. +# https://hub.docker.com/_/golang +FROM golang:1.16-buster as builder + +# Create and change to the app directory. +WORKDIR /app + +# Retrieve application dependencies. +# This allows the container build to reuse cached dependencies. +# Expecting to copy go.mod and if present go.sum. +COPY go.* ./ +RUN go mod download + +# Copy local code to the container image. +COPY . ./ + +# Build the binary. +RUN go build -v -o server + +# Use the official Debian slim image for a lean production container. +# https://hub.docker.com/_/debian +# https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds +FROM debian:buster-slim +RUN set -x && apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ + ca-certificates && \ + rm -rf /var/lib/apt/lists/* + +# Copy the binary to the production image from the builder stage. +COPY --from=builder /app/server /app/server + +# Run the web service on container startup. +CMD ["/app/server"] diff --git a/examples/cloud-run-app/go-http-server/go.mod b/examples/cloud-run-app/go-http-server/go.mod new file mode 100644 index 00000000..c7f4692c --- /dev/null +++ b/examples/cloud-run-app/go-http-server/go.mod @@ -0,0 +1,3 @@ +module github.com/dagger-cloud-run-example + +go 1.16 diff --git a/examples/cloud-run-app/go-http-server/main.go b/examples/cloud-run-app/go-http-server/main.go new file mode 100644 index 00000000..ced0a060 --- /dev/null +++ b/examples/cloud-run-app/go-http-server/main.go @@ -0,0 +1,35 @@ +// Sample run-helloworld is a minimal Cloud Run service. +package main + +import ( + "fmt" + "log" + "net/http" + "os" +) + +func main() { + log.Print("starting server...") + http.HandleFunc("/", handler) + + // Determine port for HTTP service. + port := os.Getenv("PORT") + if port == "" { + port = "8080" + log.Printf("defaulting to port %s", port) + } + + // Start HTTP server. + log.Printf("listening on port %s", port) + if err := http.ListenAndServe(":"+port, nil); err != nil { + log.Fatal(err) + } +} + +func handler(w http.ResponseWriter, r *http.Request) { + name := os.Getenv("NAME") + if name == "" { + name = "World" + } + fmt.Fprintf(w, "Hello %s!\n", name) +} diff --git a/examples/cloud-run-app/main.cue b/examples/cloud-run-app/main.cue new file mode 100644 index 00000000..b0eece2f --- /dev/null +++ b/examples/cloud-run-app/main.cue @@ -0,0 +1,26 @@ +package main + +import ( + "dagger.io/gcp" + "dagger.io/gcp/cloudrun" +) + +// Cloud Run service name +serviceName: *"cloudrun-test" | string @dagger(input) + +// GCP region +region: *"us-west2" | string @dagger(input) + +// Image name +image: *"gcr.io/dagger-ci/cloudrun-test" | string @dagger(input) + +gcpConfig: gcp.#Config & { + region: region +} + +deploy: cloudrun.#Deploy & { + serviceName: serviceName + image: image + config: gcpConfig + region: region +} diff --git a/stdlib/gcp/cloudrun/cloudrun.cue b/stdlib/gcp/cloudrun/cloudrun.cue new file mode 100644 index 00000000..2ce87b86 --- /dev/null +++ b/stdlib/gcp/cloudrun/cloudrun.cue @@ -0,0 +1,52 @@ +package cloudrun + +import ( + "dagger.io/dagger/op" + "dagger.io/gcp" +) + +// Deploy deploys a Cloud Run service based on provided GCR image +#Deploy: { + // GCP Config + config: gcp.#Config + + // service name + serviceName: string @dagger(input) + + // region to which deploy the service + region: *"us-west2" | string @dagger(input) + + // GCR image ref + image: string @dagger(input) + + // Cloud Run platform + platform: *"managed" | string @dagger(input) + + #up: [ + op.#Load & { + from: gcp.#GCloud & { + "config": config + } + }, + + op.#Exec & { + args: [ + "/bin/bash", + "--noprofile", + "--norc", + "-eo", + "pipefail", + "-c", + #""" + gcloud run deploy "$SERVICE_NAME" --image "$IMAGE" --region "$REGION" --platform "$PLATFORM" --allow-unauthenticated + """#, + ] + env: { + SERVICE_NAME: serviceName + PLATFORM: platform + REGION: region + IMAGE: image + } + }, + ] +} diff --git a/tests/README.md b/tests/README.md index 5d4bb2de..3f600c67 100644 --- a/tests/README.md +++ b/tests/README.md @@ -3,7 +3,7 @@ ## TL;DR ```shell -# Install dependancies +# Install dependencies yarn install # Install gnu parallel if needed diff --git a/tests/stdlib/gcp/cloudrun/.dagger/env/default/.gitignore b/tests/stdlib/gcp/cloudrun/.dagger/env/default/.gitignore new file mode 100644 index 00000000..01ec19b0 --- /dev/null +++ b/tests/stdlib/gcp/cloudrun/.dagger/env/default/.gitignore @@ -0,0 +1,2 @@ +# dagger state +state/** diff --git a/tests/stdlib/gcp/cloudrun/.dagger/env/default/plan/cloudrun.cue b/tests/stdlib/gcp/cloudrun/.dagger/env/default/plan/cloudrun.cue new file mode 100644 index 00000000..879666e4 --- /dev/null +++ b/tests/stdlib/gcp/cloudrun/.dagger/env/default/plan/cloudrun.cue @@ -0,0 +1,15 @@ +package cloudrun + +import ( + "dagger.io/gcp" + "dagger.io/gcp/cloudrun" +) + +TestConfig: gcpConfig: gcp.#Config + +TestCloudRun: deploy: cloudrun.#Deploy & { + config: TestConfig.gcpConfig + serviceName: "cloudrun-test" + region: "us-west2" + image: "gcr.io/dagger-ci/cloudrun-test:latest" +} diff --git a/tests/stdlib/gcp/cloudrun/.dagger/env/default/values.yaml b/tests/stdlib/gcp/cloudrun/.dagger/env/default/values.yaml new file mode 100644 index 00000000..bff70a40 --- /dev/null +++ b/tests/stdlib/gcp/cloudrun/.dagger/env/default/values.yaml @@ -0,0 +1,28 @@ +name: default +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/hIIkR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8URPhk9Q9UYpyVCWRzs4nfXAX2WgCJl9iw8ZXrIJZ3fGs3vXQMYI/kGJ7rGIDWhcQEDJGKJYrBCh6zNsbSzBagd5AQ6DNIUEvTUcPvxZP6sy+uiiMMqErDgbi2IT3G6E5sEL0sO7GtrVWoxDQWXX80vtf146fnNNp4uS2wGta7b4kguAt39olceX7nUrYgzLm1aXcr0ObbRjcPdeSlNGLTJGlZRNtvTlFdT1RgTQBfRdG3d1JCraCGsAWxBC+Bwa/zAcdIwUNnMfgdZ5eOAyiBTmoGAAOkUr7avSVvP5Xyrk9JlNzeArrjZUFMYOcXBfkMquqD1NoPHUZ12u9jCoj109zJquxcJ1zGT5TylJYSTc9xz46TfLrz5KvsMhfetBx0ocY8lXjbs3pzB6ZswDGzF4j0eiWBfu9UZoiQVtt1eIfAPoZO9u/n2Wbpx+ov+mJFf0dZklKDED5CUbmj8/izOdE9KbiPDFr1nZZQbO+YwJYhjxxqxzwC41CvH5XQTCCadeWgb5cHEwwunFRVCYeEFvTlP6nR9pS19UZoQvPNk5NEnZVKxWVD1lK18frvX8MxIpB2xaSbUkvGi3tueinLa7OYVfjirBJ1GYbuADa4H0KOxi4MP59ah6TOmsZstA6plFbtRRtk4Iofzu1mAyUN52SZzwCvH5/IxOh6vQxg7EcMfB8O5+S87PeE3vd1ch+UVDwQ3fvNmjd7/77XdKZiR7bwiDxodxABpG4iYrxcfkGPOTCKUlisgFNNmSmwG7FJMYWkz3RcEHib/biklnEKbm/9G5000cwZXXglZb8QjleSklkSEZa4DYec1SNvD/KwRbk5lYr03TDl7DrZo3WjKWvWGMUs3,iv:tPbOGayR7NiXcuHWjX0pX/nSitOxmsr4qqrc6irlIJI=,tag:apejA4UTYTuwT4CUSeoaRQ==,type:str] +sops: + kms: [] + gcp_kms: [] + azure_kv: [] + hc_vault: [] + age: + - recipient: age1gxwmtwahzwdmrskhf90ppwlnze30lgpm056kuesrxzeuyclrwvpsupwtpk + enc: | + -----BEGIN AGE ENCRYPTED FILE----- + YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBCRThSTEE1Rm5HU2Y2NkJZ + SEd2blAyeEVnMHBqRGxXMEQ3TGFzWTBwd1EwCnA0OFVmTCsxSmpNV29adGt2ZHFH + WE9vN1ZoNENFV2t1TGVuZkdwVndNbVUKLS0tIGpHZEptYWxEZVNjcXF4NkoyWHRv + ZXd6Qmd1YUtxMnVTVkYybWgrV3pVK2MKowMeOZU3j3BxERT0DwhQYCGUDBK6gCdo + WByubiBATdsb7h7ytCC4HutWppynK4MpU+Ya9NP83AZuXo+Wa2u6aQ== + -----END AGE ENCRYPTED FILE----- + lastmodified: "2021-05-28T02:07:09Z" + mac: ENC[AES256_GCM,data:QqbgWep3l7dIfE4imJ3SKsMdexh7DgUvjtGwSgKbHHnT0p2MwIdFMY7pB0ZJvlc3ZwQyioT3wqF9xgn4U60a4piGtDYsyWjZn52tQAPy0p9c+sOHn+WlFVu1FJeljU4Q3mlEqdA6g993nsbJp9RnNShpc65rQXUMLkw2lXhOAak=,iv:1pp1D1fUFGI+Kn/H2efaqroJV+rzJRGmWo2ZTseTDis=,tag:ePCkD/G2KEbN7cxiMpy9fg==,type:str] + pgp: [] + encrypted_suffix: secret + version: 3.7.1 From 15792fb924dec8556d67b02de2e203ff0f36769e Mon Sep 17 00:00:00 2001 From: Tihomir Jovicic Date: Thu, 10 Jun 2021 11:45:52 +0200 Subject: [PATCH 02/18] Move Cloud Run image property to GCP config struct Signed-off-by: Tihomir Jovicic --- examples/README.md | 13 ++++---- .../.dagger/env/cloud-run-app/.gitignore | 2 -- .../.dagger/env/cloud-run-app/plan/main.cue | 26 ---------------- .../.dagger/env/cloud-run-app/values.yaml | 30 ------------------- examples/cloud-run-app/main.cue | 26 ---------------- .../go-http-server/.dockerignore | 0 .../go-http-server/Dockerfile | 0 .../go-http-server/go.mod | 0 .../go-http-server/main.go | 0 examples/cloudrun-app/main.cue | 20 +++++++++++++ .../gcp/cloudrun/{cloudrun.cue => main.cue} | 5 +--- .../.dagger/env/default/plan/main.cue | 16 ++++++++++ .../cloudrun/.dagger/env/default/values.yaml | 20 ++++++------- .../default/plan/cloudrun.cue => main.cue} | 7 +++-- 14 files changed, 56 insertions(+), 109 deletions(-) delete mode 100644 examples/cloud-run-app/.dagger/env/cloud-run-app/.gitignore delete mode 100644 examples/cloud-run-app/.dagger/env/cloud-run-app/plan/main.cue delete mode 100644 examples/cloud-run-app/.dagger/env/cloud-run-app/values.yaml delete mode 100644 examples/cloud-run-app/main.cue rename examples/{cloud-run-app => cloudrun-app}/go-http-server/.dockerignore (100%) rename examples/{cloud-run-app => cloudrun-app}/go-http-server/Dockerfile (100%) rename examples/{cloud-run-app => cloudrun-app}/go-http-server/go.mod (100%) rename examples/{cloud-run-app => cloudrun-app}/go-http-server/main.go (100%) create mode 100644 examples/cloudrun-app/main.cue rename stdlib/gcp/cloudrun/{cloudrun.cue => main.cue} (87%) create mode 100644 tests/stdlib/gcp/cloudrun/.dagger/env/default/plan/main.cue rename tests/stdlib/gcp/cloudrun/{.dagger/env/default/plan/cloudrun.cue => main.cue} (79%) diff --git a/examples/README.md b/examples/README.md index 2fa83d9c..11ac2d75 100644 --- a/examples/README.md +++ b/examples/README.md @@ -298,9 +298,9 @@ dagger up ## Deploy an application to GCP Cloud Run -This example shows how to deploy an application to GCP Cloud Run. Read the deployment [plan](https://github.com/dagger/dagger/tree/main/examples/cloud-run-app) +This example shows how to deploy an application to GCP Cloud Run. Read the deployment [plan](https://github.com/dagger/dagger/tree/main/examples/cloudrun-app) -NOTE: this example requires an EKS cluster to allow authentication with your AWS credentials; but can easily be adapter to deploy to any Kubernetes cluster. +NOTE: this example requires the right GCP IAM permissions: `https://cloud.google.com/run/docs/reference/iam/roles#additional-configuration` Components: @@ -311,27 +311,26 @@ How to run: 1. Initialize a new workspace ```sh -cd ./cloud-run-app +cd ./cloudrun-app dagger init ``` 2. Create a new environment ```sh -dagger new cloud-run-app -cp *.cue ./.dagger/env/cloud-run-app/plan/ +dagger new cloudrun-app +cp main.cue ./.dagger/env/cloudrun-app/plan/ ``` 3. Configure the Cloud Run service ```sh dagger input text serviceName MY_APP_NAME -dagger input text region MY_GCP_REGION dagger input text image MY_GCR_IMAGE_NAME dagger input text gcpConfig.project MY_GCP_PROJECT +dagger input text gcpConfig.region MY_GCP_REGION dagger input secret gcpConfig.serviceKey -f MY_GCP_SERVICE_KEY_FILE - ``` 4. Deploy! diff --git a/examples/cloud-run-app/.dagger/env/cloud-run-app/.gitignore b/examples/cloud-run-app/.dagger/env/cloud-run-app/.gitignore deleted file mode 100644 index 01ec19b0..00000000 --- a/examples/cloud-run-app/.dagger/env/cloud-run-app/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# dagger state -state/** diff --git a/examples/cloud-run-app/.dagger/env/cloud-run-app/plan/main.cue b/examples/cloud-run-app/.dagger/env/cloud-run-app/plan/main.cue deleted file mode 100644 index b0eece2f..00000000 --- a/examples/cloud-run-app/.dagger/env/cloud-run-app/plan/main.cue +++ /dev/null @@ -1,26 +0,0 @@ -package main - -import ( - "dagger.io/gcp" - "dagger.io/gcp/cloudrun" -) - -// Cloud Run service name -serviceName: *"cloudrun-test" | string @dagger(input) - -// GCP region -region: *"us-west2" | string @dagger(input) - -// Image name -image: *"gcr.io/dagger-ci/cloudrun-test" | string @dagger(input) - -gcpConfig: gcp.#Config & { - region: region -} - -deploy: cloudrun.#Deploy & { - serviceName: serviceName - image: image - config: gcpConfig - region: region -} diff --git a/examples/cloud-run-app/.dagger/env/cloud-run-app/values.yaml b/examples/cloud-run-app/.dagger/env/cloud-run-app/values.yaml deleted file mode 100644 index c25de1c8..00000000 --- a/examples/cloud-run-app/.dagger/env/cloud-run-app/values.yaml +++ /dev/null @@ -1,30 +0,0 @@ -name: cloud-run-app -inputs: - gcpConfig.project: - text: dagger-ci - gcpConfig.serviceKey: - secret: ENC[AES256_GCM,data:1+764K9v6qxPIzNU9sQ3VvTPJjMpd/HdZpRej8jIhi9OJR30+eQV/kfys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4xKdt954sBprHQkZ2DmdA2Iy//XIdav0pgwEW5OabunLQTiKePr+qCu2PpV3ouOXyXrYdPBS8/n9GOmkQxx/Pe58lq0sSbNrxmIE2fnBoFB65ENfJ8k3xpNLSKZ8No3MLCjA1Gaj5ZQsos7WTqNuZfVNru29nEXQGRF32zlnXsjDLvab1ia4PYIq9Yr38zP7TyRKJKuV57HgRkL0xviBJo0HlfHu3Py1SsEjXHnB7IAD2DBu+FXRh1gtvqWGbVxOqOtoB+Ox+i6Q8iqq67vegDRzxi/hh9fdyxirAvwPy292ms7Oh0fnuxxKV2qiEaT6LK1LIilOoj6bAS4q5p8GFIPo+vSL5PvkS57NRTBCg6WnBXHBibxNZHPMRx5TDBCO/3ziwPOyWVHIfel1bI+hy2rSJ3dg29lFiBk07t3rOUe8ILcLc0YsTRyUR2tBhpV0BjbENnNnpa/kpmqF6d9h16QkLd7En5orlLMnEgnMKLwOGS0Y8G0wLq+dtwuZuHkqvAuw8uqlJbjnqxjFjlACsy+TADKDyaEY7EY0K2biJzSzQyL8YUpQFU+XSNnK/qyJYMQlZwvYj2Zw97CipIZq/b/VHMAoOZa6Q4GQY0mj0z7VlKqeu2jxmbqY3ZhfxH2BmgSjUlWO9W2W9691eK8wTDcs/fkrthSJFdUzqbZhLPeRBIhwxBLOW86opqHP2hgjY6H6GR7NLwIHchKI72wgdrDMdUd1u3CKhdhqZ+XtK0f1s2A1zQH3sWLpeQknSBi3LFNjSgptHWcVs4xhDgToRjWnYugjSYGRCpCWYVLhDLnGJ0BpfcEZjAmQ+glqTJ7qBVVkZL0/tXebFFg3AUhMK1M4vZzLy0E4x10ZBuY3TEKZziR2KGjmP3098E8=,iv:XBNEXLnpNnuUAyaEWuobkPeeBGYPIrEiqrqIS/r0Lu0=,tag:Ft6wBjWDFYKBNm52Dn1vxQ==,type:str] - region: - text: us-west2 - serviceName: - text: cloudrun-test3 -sops: - kms: [] - gcp_kms: [] - azure_kv: [] - hc_vault: [] - age: - - recipient: age1j6nrevprudhes65akfpl7sl65pktl4wj272gh7xl82ul3aaugppq6zxujg - enc: | - -----BEGIN AGE ENCRYPTED FILE----- - YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBxWWdlTDFWK0VNQTNoUExS - Y20yNVZTT0hxNi91d3JvTUZ3UFNuRStUQTNvCnVEOVlTUjhvNU5MejdldWt0eWxR - UnZ4T0lUd3dsSURaNzRXWGVKQWllWTgKLS0tIHV0QkFWTDk2RE9hK2EyNm9GRVll - dmE4QXJmK255RHNIVzJjNjFwRCtCMzQKaAfgT/Q7uU4urlcgtz25Pbwx/p4iyEX/ - YpZaWQuVR2J9jtEh86oYZYGLxO5SAvqO5v20tfxXdVzZQkw0/QVPhQ== - -----END AGE ENCRYPTED FILE----- - lastmodified: "2021-06-10T06:06:28Z" - mac: ENC[AES256_GCM,data:qlX0EtuyHMNhMoVtR0xwD6kM2i+Jbq6NC6oQwZkEb4Pe8yy1cXKtHOvzDQAmMOL/vyE82fRtTmvfc85gA8vgw320TzXDcqxkpbVlML/5O7lDvOBwePvwajwG5JOlBXl+UJWMrH5nYfRPas1B4RSV7lksqXf/+a2+O0b2NN0UWDM=,iv:GqffDMMcLDefh6HU8fmaXlOk4xkjhq0sP5jkWAsiZKo=,tag:ttbyp8H7ZviPebmga9oJ7g==,type:str] - pgp: [] - encrypted_suffix: secret - version: 3.7.1 diff --git a/examples/cloud-run-app/main.cue b/examples/cloud-run-app/main.cue deleted file mode 100644 index b0eece2f..00000000 --- a/examples/cloud-run-app/main.cue +++ /dev/null @@ -1,26 +0,0 @@ -package main - -import ( - "dagger.io/gcp" - "dagger.io/gcp/cloudrun" -) - -// Cloud Run service name -serviceName: *"cloudrun-test" | string @dagger(input) - -// GCP region -region: *"us-west2" | string @dagger(input) - -// Image name -image: *"gcr.io/dagger-ci/cloudrun-test" | string @dagger(input) - -gcpConfig: gcp.#Config & { - region: region -} - -deploy: cloudrun.#Deploy & { - serviceName: serviceName - image: image - config: gcpConfig - region: region -} diff --git a/examples/cloud-run-app/go-http-server/.dockerignore b/examples/cloudrun-app/go-http-server/.dockerignore similarity index 100% rename from examples/cloud-run-app/go-http-server/.dockerignore rename to examples/cloudrun-app/go-http-server/.dockerignore diff --git a/examples/cloud-run-app/go-http-server/Dockerfile b/examples/cloudrun-app/go-http-server/Dockerfile similarity index 100% rename from examples/cloud-run-app/go-http-server/Dockerfile rename to examples/cloudrun-app/go-http-server/Dockerfile diff --git a/examples/cloud-run-app/go-http-server/go.mod b/examples/cloudrun-app/go-http-server/go.mod similarity index 100% rename from examples/cloud-run-app/go-http-server/go.mod rename to examples/cloudrun-app/go-http-server/go.mod diff --git a/examples/cloud-run-app/go-http-server/main.go b/examples/cloudrun-app/go-http-server/main.go similarity index 100% rename from examples/cloud-run-app/go-http-server/main.go rename to examples/cloudrun-app/go-http-server/main.go diff --git a/examples/cloudrun-app/main.cue b/examples/cloudrun-app/main.cue new file mode 100644 index 00000000..4491394e --- /dev/null +++ b/examples/cloudrun-app/main.cue @@ -0,0 +1,20 @@ +package main + +import ( + "dagger.io/gcp" + "dagger.io/gcp/cloudrun" +) + +// Cloud Run service name +serviceName: *"cloudrun-test" | string @dagger(input) + +// Image name +image: string @dagger(input) + +gcpConfig: gcp.#Config + +deploy: cloudrun.#Deploy & { + "serviceName": serviceName + "image": image + config: gcpConfig +} diff --git a/stdlib/gcp/cloudrun/cloudrun.cue b/stdlib/gcp/cloudrun/main.cue similarity index 87% rename from stdlib/gcp/cloudrun/cloudrun.cue rename to stdlib/gcp/cloudrun/main.cue index 2ce87b86..ced19ca7 100644 --- a/stdlib/gcp/cloudrun/cloudrun.cue +++ b/stdlib/gcp/cloudrun/main.cue @@ -13,9 +13,6 @@ import ( // service name serviceName: string @dagger(input) - // region to which deploy the service - region: *"us-west2" | string @dagger(input) - // GCR image ref image: string @dagger(input) @@ -44,7 +41,7 @@ import ( env: { SERVICE_NAME: serviceName PLATFORM: platform - REGION: region + REGION: config.region IMAGE: image } }, diff --git a/tests/stdlib/gcp/cloudrun/.dagger/env/default/plan/main.cue b/tests/stdlib/gcp/cloudrun/.dagger/env/default/plan/main.cue new file mode 100644 index 00000000..da16b09e --- /dev/null +++ b/tests/stdlib/gcp/cloudrun/.dagger/env/default/plan/main.cue @@ -0,0 +1,16 @@ +package cloudrun + +import ( + "dagger.io/gcp" + "dagger.io/gcp/cloudrun" +) + +TestConfig: gcpConfig: gcp.#Config & { + region: "us-west2" +} + +TestCloudRun: deploy: cloudrun.#Deploy & { + config: TestConfig.gcpConfig + serviceName: "cloudrun-test4" + image: "gcr.io/dagger-ci/cloudrun-test:latest" +} diff --git a/tests/stdlib/gcp/cloudrun/.dagger/env/default/values.yaml b/tests/stdlib/gcp/cloudrun/.dagger/env/default/values.yaml index bff70a40..100bb271 100644 --- a/tests/stdlib/gcp/cloudrun/.dagger/env/default/values.yaml +++ b/tests/stdlib/gcp/cloudrun/.dagger/env/default/values.yaml @@ -2,27 +2,25 @@ name: default 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+8Mt5/CMTXhRz8PpRpvXtKL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nWts5BafhXWv2f4AZQkxvtUHeMQykYpK2f+AnrXAWJtoP3s5rE2VoSjvbMEpEIz2DvcGb0cgjIE9WfSx2U/vOuOZ1ryJVr7NNj8HEdM1ueBRo7qtrYFOFhpLVNzEibWzVHUdgjLJSVPdZ10mjRHXQq+rcSHD+u147fmzU/APKG0KrGehr+q4Sq9cfFmbCxfiBbiBx/XWr0OneI2DBETPS4O4/Vnxwo/Ta2tY1EYZ+6yQ1EufxLRbafsqlNcerI8BXNVkR1uchwjMLgSLhMWZgXOl5y7cNJ+kQrwPkAD7sXJJLm4xc/es2usXIViiPoXdqFcEcmEGn3/LifWe8/mzbtkg/iaIWX8waPbdAShysYP4vaWTiM5uV1az4dzI4eeq+cJ0okBDVYVWwgVfaaM1BXpjHus=,iv:z5kMvxwHNWlkPyLSY4m4uJWlI0Ex49Mou5ggjYOAJZU=,tag:X87YuciqrxzbHxN84U/czw==,type:str] sops: kms: [] gcp_kms: [] azure_kv: [] hc_vault: [] age: - - recipient: age1gxwmtwahzwdmrskhf90ppwlnze30lgpm056kuesrxzeuyclrwvpsupwtpk + - recipient: age1j6nrevprudhes65akfpl7sl65pktl4wj272gh7xl82ul3aaugppq6zxujg enc: | -----BEGIN AGE ENCRYPTED FILE----- - YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBCRThSTEE1Rm5HU2Y2NkJZ - SEd2blAyeEVnMHBqRGxXMEQ3TGFzWTBwd1EwCnA0OFVmTCsxSmpNV29adGt2ZHFH - WE9vN1ZoNENFV2t1TGVuZkdwVndNbVUKLS0tIGpHZEptYWxEZVNjcXF4NkoyWHRv - ZXd6Qmd1YUtxMnVTVkYybWgrV3pVK2MKowMeOZU3j3BxERT0DwhQYCGUDBK6gCdo - WByubiBATdsb7h7ytCC4HutWppynK4MpU+Ya9NP83AZuXo+Wa2u6aQ== + YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBlS2FGbmN6NHUvQURxNHFM + VGhOSkpzemlqRy9VRm1YWmgzVjlyL3dwYmdvCjFCKzVZU0F6c3d1cW1zY2dhenF5 + VDNWMkU1Tk9jNzhiZFJyTmdWS0hSMFkKLS0tIHFka3R5M3lIaUUwQy9vL2psVlda + bmNoN29yMHhPQ3cwVzNpUkxIQ0ZnM1EKJht8ms14xoJljhph1bC8E7zZAp9NIYAR + pSpl03AeVHVO8TIJT7P4Fb/sWTpeO43WNDVpLdVOqb1zYSAKZ5G3AQ== -----END AGE ENCRYPTED FILE----- - lastmodified: "2021-05-28T02:07:09Z" - mac: ENC[AES256_GCM,data:QqbgWep3l7dIfE4imJ3SKsMdexh7DgUvjtGwSgKbHHnT0p2MwIdFMY7pB0ZJvlc3ZwQyioT3wqF9xgn4U60a4piGtDYsyWjZn52tQAPy0p9c+sOHn+WlFVu1FJeljU4Q3mlEqdA6g993nsbJp9RnNShpc65rQXUMLkw2lXhOAak=,iv:1pp1D1fUFGI+Kn/H2efaqroJV+rzJRGmWo2ZTseTDis=,tag:ePCkD/G2KEbN7cxiMpy9fg==,type:str] + lastmodified: "2021-06-10T09:04:25Z" + mac: ENC[AES256_GCM,data:CKp5GwZZWUk35GsqU7447Km24t7B1pqV6VwcRZetzVbeXPT9Wc5hVfTqR8HYWE/vxz8CwkkJSkqYgdS72JUBJaoZLSXBLO6C50QqPDUdMunZp0pTidKuubET4Jmr2hflMv473CQhBr0wmhKlRJLv3u83Zx/XqKljgl7gZ2HkJ7c=,iv:7RaadjoAANIo21IA/myn+pXsQdAgH5I6LZw4iK2y2rA=,tag:pASgOqReKaoG/yUSr9BCyA==,type:str] pgp: [] encrypted_suffix: secret version: 3.7.1 diff --git a/tests/stdlib/gcp/cloudrun/.dagger/env/default/plan/cloudrun.cue b/tests/stdlib/gcp/cloudrun/main.cue similarity index 79% rename from tests/stdlib/gcp/cloudrun/.dagger/env/default/plan/cloudrun.cue rename to tests/stdlib/gcp/cloudrun/main.cue index 879666e4..22e849d1 100644 --- a/tests/stdlib/gcp/cloudrun/.dagger/env/default/plan/cloudrun.cue +++ b/tests/stdlib/gcp/cloudrun/main.cue @@ -5,11 +5,12 @@ import ( "dagger.io/gcp/cloudrun" ) -TestConfig: gcpConfig: gcp.#Config +TestConfig: gcpConfig: gcp.#Config & { + region: "us-west2" +} TestCloudRun: deploy: cloudrun.#Deploy & { - config: TestConfig.gcpConfig serviceName: "cloudrun-test" - region: "us-west2" + config: TestConfig.gcpConfig image: "gcr.io/dagger-ci/cloudrun-test:latest" } From c6b02b3ee1082311f2b3d1187f87239b68835899 Mon Sep 17 00:00:00 2001 From: Tihomir Jovicic Date: Thu, 10 Jun 2021 11:54:03 +0200 Subject: [PATCH 03/18] Update cloudrun universe docs Signed-off-by: Tihomir Jovicic --- docs/reference/universe/gcp/cloudrun.md | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/docs/reference/universe/gcp/cloudrun.md b/docs/reference/universe/gcp/cloudrun.md index aa9e2121..a4213ca4 100644 --- a/docs/reference/universe/gcp/cloudrun.md +++ b/docs/reference/universe/gcp/cloudrun.md @@ -10,15 +10,14 @@ Deploy deploys a Cloud Run service based on provided GCR image ### #Deploy Inputs -| Name | Type | Description | -| ------------- |:-------------: |:-------------: | -|*config.region* | `string` |GCP region | -|*config.project* | `string` |GCP project | -|*config.serviceKey* | `dagger.#Secret` |GCP service key | -|*serviceName* | `string` |service name | -|*region* | `*"us-west2" \| string` |region to which deploy the service | -|*image* | `string` |GCR image ref | -|*platform* | `*"managed" \| string` |Cloud Run platform | +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*config.region* | `string` |GCP region | +|*config.project* | `string` |GCP project | +|*config.serviceKey* | `dagger.#Secret` |GCP service key | +|*serviceName* | `string` |service name | +|*image* | `string` |GCR image ref | +|*platform* | `*"managed" \| string` |Cloud Run platform | ### #Deploy Outputs From 5d8219a8f3175607a9132a7505863348be23511b Mon Sep 17 00:00:00 2001 From: Tihomir Jovicic Date: Wed, 9 Jun 2021 12:01:27 +0200 Subject: [PATCH 04/18] Add Cloud Run support Signed-off-by: Tihomir Jovicic --- docs/programming/guides/cloudrun.md | 43 +++++++++++++++ docs/reference/universe/gcp/cloudrun.md | 25 +++++++++ examples/README.md | 46 +++++++++++++++- .../.dagger/env/cloud-run-app/.gitignore | 2 + .../.dagger/env/cloud-run-app/plan/main.cue | 26 ++++++++++ .../.dagger/env/cloud-run-app/values.yaml | 30 +++++++++++ .../go-http-server/.dockerignore | 13 +++++ .../cloud-run-app/go-http-server/Dockerfile | 33 ++++++++++++ examples/cloud-run-app/go-http-server/go.mod | 3 ++ examples/cloud-run-app/go-http-server/main.go | 35 +++++++++++++ examples/cloud-run-app/main.cue | 26 ++++++++++ stdlib/gcp/cloudrun/cloudrun.cue | 52 +++++++++++++++++++ tests/README.md | 2 +- .../cloudrun/.dagger/env/default/.gitignore | 2 + .../.dagger/env/default/plan/cloudrun.cue | 15 ++++++ .../cloudrun/.dagger/env/default/values.yaml | 28 ++++++++++ 16 files changed, 379 insertions(+), 2 deletions(-) create mode 100644 docs/programming/guides/cloudrun.md create mode 100644 docs/reference/universe/gcp/cloudrun.md create mode 100644 examples/cloud-run-app/.dagger/env/cloud-run-app/.gitignore create mode 100644 examples/cloud-run-app/.dagger/env/cloud-run-app/plan/main.cue create mode 100644 examples/cloud-run-app/.dagger/env/cloud-run-app/values.yaml create mode 100644 examples/cloud-run-app/go-http-server/.dockerignore create mode 100644 examples/cloud-run-app/go-http-server/Dockerfile create mode 100644 examples/cloud-run-app/go-http-server/go.mod create mode 100644 examples/cloud-run-app/go-http-server/main.go create mode 100644 examples/cloud-run-app/main.cue create mode 100644 stdlib/gcp/cloudrun/cloudrun.cue create mode 100644 tests/stdlib/gcp/cloudrun/.dagger/env/default/.gitignore create mode 100644 tests/stdlib/gcp/cloudrun/.dagger/env/default/plan/cloudrun.cue create mode 100644 tests/stdlib/gcp/cloudrun/.dagger/env/default/values.yaml diff --git a/docs/programming/guides/cloudrun.md b/docs/programming/guides/cloudrun.md new file mode 100644 index 00000000..9a1ef73b --- /dev/null +++ b/docs/programming/guides/cloudrun.md @@ -0,0 +1,43 @@ +# Deploy an application to GCP Cloud Run + +This example shows how to deploy an application to GCP Cloud Run. Read the deployment [plan](https://github.com/dagger/dagger/tree/main/examples/cloud-run-app) + +NOTE: this example requires an EKS cluster to allow authentication with your AWS credentials; but can easily be adapter to deploy to any Kubernetes cluster. + +Components: + +- [Cloud Run](https://cloud.google.com/run) + +How to run: + +1. Initialize a new workspace + +```sh +cd ./cloud-run-app +dagger init +``` + +2. Create a new environment + +```sh +dagger new cloud-run-app +cp *.cue ./.dagger/env/cloud-run-app/plan/ +``` + +3. Configure the Cloud Run service + +```sh +dagger input text serviceName MY_APP_NAME +dagger input text region MY_GCP_REGION +dagger input text image MY_GCR_IMAGE_NAME + +dagger input text gcpConfig.project MY_GCP_PROJECT +dagger input secret gcpConfig.serviceKey -f MY_GCP_SERVICE_KEY_FILE + +``` + +4. Deploy! + +```sh +dagger up +``` diff --git a/docs/reference/universe/gcp/cloudrun.md b/docs/reference/universe/gcp/cloudrun.md new file mode 100644 index 00000000..aa9e2121 --- /dev/null +++ b/docs/reference/universe/gcp/cloudrun.md @@ -0,0 +1,25 @@ +--- +sidebar_label: cloudrun +--- + +# dagger.io/gcp/cloudrun + +## #Deploy + +Deploy deploys a Cloud Run service based on provided GCR image + +### #Deploy Inputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*config.region* | `string` |GCP region | +|*config.project* | `string` |GCP project | +|*config.serviceKey* | `dagger.#Secret` |GCP service key | +|*serviceName* | `string` |service name | +|*region* | `*"us-west2" \| string` |region to which deploy the service | +|*image* | `string` |GCR image ref | +|*platform* | `*"managed" \| string` |Cloud Run platform | + +### #Deploy Outputs + +_No output._ diff --git a/examples/README.md b/examples/README.md index 5de5c8b1..2fa83d9c 100644 --- a/examples/README.md +++ b/examples/README.md @@ -287,7 +287,7 @@ dagger input text cluster.clusterName MY_CLUSTER_NAME 5. Load the Helm chart ```sh -dagger input dir helmChart.chart ./kubernetes-app/testdata/mychart +dagger input dir helmChart.chart ./testdata/mychart ``` 6. Deploy! @@ -295,3 +295,47 @@ dagger input dir helmChart.chart ./kubernetes-app/testdata/mychart ```sh dagger up ``` + +## Deploy an application to GCP Cloud Run + +This example shows how to deploy an application to GCP Cloud Run. Read the deployment [plan](https://github.com/dagger/dagger/tree/main/examples/cloud-run-app) + +NOTE: this example requires an EKS cluster to allow authentication with your AWS credentials; but can easily be adapter to deploy to any Kubernetes cluster. + +Components: + +- [Cloud Run](https://cloud.google.com/run) + +How to run: + +1. Initialize a new workspace + +```sh +cd ./cloud-run-app +dagger init +``` + +2. Create a new environment + +```sh +dagger new cloud-run-app +cp *.cue ./.dagger/env/cloud-run-app/plan/ +``` + +3. Configure the Cloud Run service + +```sh +dagger input text serviceName MY_APP_NAME +dagger input text region MY_GCP_REGION +dagger input text image MY_GCR_IMAGE_NAME + +dagger input text gcpConfig.project MY_GCP_PROJECT +dagger input secret gcpConfig.serviceKey -f MY_GCP_SERVICE_KEY_FILE + +``` + +4. Deploy! + +```sh +dagger up +``` diff --git a/examples/cloud-run-app/.dagger/env/cloud-run-app/.gitignore b/examples/cloud-run-app/.dagger/env/cloud-run-app/.gitignore new file mode 100644 index 00000000..01ec19b0 --- /dev/null +++ b/examples/cloud-run-app/.dagger/env/cloud-run-app/.gitignore @@ -0,0 +1,2 @@ +# dagger state +state/** diff --git a/examples/cloud-run-app/.dagger/env/cloud-run-app/plan/main.cue b/examples/cloud-run-app/.dagger/env/cloud-run-app/plan/main.cue new file mode 100644 index 00000000..b0eece2f --- /dev/null +++ b/examples/cloud-run-app/.dagger/env/cloud-run-app/plan/main.cue @@ -0,0 +1,26 @@ +package main + +import ( + "dagger.io/gcp" + "dagger.io/gcp/cloudrun" +) + +// Cloud Run service name +serviceName: *"cloudrun-test" | string @dagger(input) + +// GCP region +region: *"us-west2" | string @dagger(input) + +// Image name +image: *"gcr.io/dagger-ci/cloudrun-test" | string @dagger(input) + +gcpConfig: gcp.#Config & { + region: region +} + +deploy: cloudrun.#Deploy & { + serviceName: serviceName + image: image + config: gcpConfig + region: region +} diff --git a/examples/cloud-run-app/.dagger/env/cloud-run-app/values.yaml b/examples/cloud-run-app/.dagger/env/cloud-run-app/values.yaml new file mode 100644 index 00000000..c25de1c8 --- /dev/null +++ b/examples/cloud-run-app/.dagger/env/cloud-run-app/values.yaml @@ -0,0 +1,30 @@ +name: cloud-run-app +inputs: + gcpConfig.project: + text: dagger-ci + gcpConfig.serviceKey: + secret: ENC[AES256_GCM,data:1+764K9v6qxPIzNU9sQ3VvTPJjMpd/HdZpRej8jIhi9OJR30+eQV/kfysnLqx28IBwVgvCeUwJb72cZHOjREdMqH6SzDcmyHZfrKL37l8QHMe9XIl5QPZyRH1Hos/W4ZQD7wlPQxWvwcDEw6fKr+JbFEC/t/sCDePIO70LrJTiClT8yJVtw0o2Va908nEKqNDxDr4/4DZoUctBeBZTMPSHohgdH+DZ34jGrne/zhKK9taxRzkIvt3da0PylzfzOaogEvnJCsvWoLlMM1jSjIwGzEDRDd8PnmSp+ZbauJXIFaHPPCowDn0W/BAngIQ2b+Cz9AOAvSMa7qk3skdVgXCadCvlpKaspXICFsC1rdRevNTP4B0T9YCTSeQfAZw9TE4R/IO9kU5USpy4oUHbnt1MKg60y5kSHbW+cpDN0oOTyfDLVKbbhMMW6ID9LtkoTVZX111vv8UVvq1ndxqmbZavY7rn5siT8X0X92m5yZqWbxeUlUd/TIVoHQeXvOPp5AIpLvdiqbK9aYFKP1jPmGYA3Q60MiLD34hch8rb2rYDZCfCaZABXD8HWTlWoQEhPeiWBgOCR+/FyhL3PkQDqIThg5J1H88+1PmhNThrV0fbYKkT8wZumosC+/MOaVqaAT9dyPE4u//Osy9dLQ0DBD34OMpEp06jYqxBiukBdGGaR71TjLAZfjChfJASsHT9PLopoOtD80tpfT16v44wvJluNwYgjmvsV4s/vpZ4xCCsF3QjU9IiLXN3TVYBEJdA9/yJkhLRtjMRZMJ0xOpFtsZcAguE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wgdrDMdUd1u3CKhdhqZ+XtK0f1s2A1zQH3sWLpeQknSBi3LFNjSgptHWcVs4xhDgToRjWnYugjSYGRCpCWYVLhDLnGJ0BpfcEZjAmQ+glqTJ7qBVVkZL0/tXebFFg3AUhMK1M4vZzLy0E4x10ZBuY3TEKZziR2KGjmP3098E8=,iv:XBNEXLnpNnuUAyaEWuobkPeeBGYPIrEiqrqIS/r0Lu0=,tag:Ft6wBjWDFYKBNm52Dn1vxQ==,type:str] + region: + text: us-west2 + serviceName: + text: cloudrun-test3 +sops: + kms: [] + gcp_kms: [] + azure_kv: [] + hc_vault: [] + age: + - recipient: age1j6nrevprudhes65akfpl7sl65pktl4wj272gh7xl82ul3aaugppq6zxujg + enc: | + -----BEGIN AGE ENCRYPTED FILE----- + YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBxWWdlTDFWK0VNQTNoUExS + Y20yNVZTT0hxNi91d3JvTUZ3UFNuRStUQTNvCnVEOVlTUjhvNU5MejdldWt0eWxR + UnZ4T0lUd3dsSURaNzRXWGVKQWllWTgKLS0tIHV0QkFWTDk2RE9hK2EyNm9GRVll + dmE4QXJmK255RHNIVzJjNjFwRCtCMzQKaAfgT/Q7uU4urlcgtz25Pbwx/p4iyEX/ + YpZaWQuVR2J9jtEh86oYZYGLxO5SAvqO5v20tfxXdVzZQkw0/QVPhQ== + -----END AGE ENCRYPTED FILE----- + lastmodified: "2021-06-10T06:06:28Z" + mac: ENC[AES256_GCM,data:qlX0EtuyHMNhMoVtR0xwD6kM2i+Jbq6NC6oQwZkEb4Pe8yy1cXKtHOvzDQAmMOL/vyE82fRtTmvfc85gA8vgw320TzXDcqxkpbVlML/5O7lDvOBwePvwajwG5JOlBXl+UJWMrH5nYfRPas1B4RSV7lksqXf/+a2+O0b2NN0UWDM=,iv:GqffDMMcLDefh6HU8fmaXlOk4xkjhq0sP5jkWAsiZKo=,tag:ttbyp8H7ZviPebmga9oJ7g==,type:str] + pgp: [] + encrypted_suffix: secret + version: 3.7.1 diff --git a/examples/cloud-run-app/go-http-server/.dockerignore b/examples/cloud-run-app/go-http-server/.dockerignore new file mode 100644 index 00000000..4cc30b02 --- /dev/null +++ b/examples/cloud-run-app/go-http-server/.dockerignore @@ -0,0 +1,13 @@ +# The .dockerignore file excludes files from the container build process. +# +# https://docs.docker.com/engine/reference/builder/#dockerignore-file + +# Exclude locally vendored dependencies. +vendor/ + +# Exclude "build-time" ignore files. +.dockerignore +.gcloudignore + +# Exclude git history and configuration. +.gitignore diff --git a/examples/cloud-run-app/go-http-server/Dockerfile b/examples/cloud-run-app/go-http-server/Dockerfile new file mode 100644 index 00000000..21e1f572 --- /dev/null +++ b/examples/cloud-run-app/go-http-server/Dockerfile @@ -0,0 +1,33 @@ +# Use the offical golang image to create a binary. +# This is based on Debian and sets the GOPATH to /go. +# https://hub.docker.com/_/golang +FROM golang:1.16-buster as builder + +# Create and change to the app directory. +WORKDIR /app + +# Retrieve application dependencies. +# This allows the container build to reuse cached dependencies. +# Expecting to copy go.mod and if present go.sum. +COPY go.* ./ +RUN go mod download + +# Copy local code to the container image. +COPY . ./ + +# Build the binary. +RUN go build -v -o server + +# Use the official Debian slim image for a lean production container. +# https://hub.docker.com/_/debian +# https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds +FROM debian:buster-slim +RUN set -x && apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ + ca-certificates && \ + rm -rf /var/lib/apt/lists/* + +# Copy the binary to the production image from the builder stage. +COPY --from=builder /app/server /app/server + +# Run the web service on container startup. +CMD ["/app/server"] diff --git a/examples/cloud-run-app/go-http-server/go.mod b/examples/cloud-run-app/go-http-server/go.mod new file mode 100644 index 00000000..c7f4692c --- /dev/null +++ b/examples/cloud-run-app/go-http-server/go.mod @@ -0,0 +1,3 @@ +module github.com/dagger-cloud-run-example + +go 1.16 diff --git a/examples/cloud-run-app/go-http-server/main.go b/examples/cloud-run-app/go-http-server/main.go new file mode 100644 index 00000000..ced0a060 --- /dev/null +++ b/examples/cloud-run-app/go-http-server/main.go @@ -0,0 +1,35 @@ +// Sample run-helloworld is a minimal Cloud Run service. +package main + +import ( + "fmt" + "log" + "net/http" + "os" +) + +func main() { + log.Print("starting server...") + http.HandleFunc("/", handler) + + // Determine port for HTTP service. + port := os.Getenv("PORT") + if port == "" { + port = "8080" + log.Printf("defaulting to port %s", port) + } + + // Start HTTP server. + log.Printf("listening on port %s", port) + if err := http.ListenAndServe(":"+port, nil); err != nil { + log.Fatal(err) + } +} + +func handler(w http.ResponseWriter, r *http.Request) { + name := os.Getenv("NAME") + if name == "" { + name = "World" + } + fmt.Fprintf(w, "Hello %s!\n", name) +} diff --git a/examples/cloud-run-app/main.cue b/examples/cloud-run-app/main.cue new file mode 100644 index 00000000..b0eece2f --- /dev/null +++ b/examples/cloud-run-app/main.cue @@ -0,0 +1,26 @@ +package main + +import ( + "dagger.io/gcp" + "dagger.io/gcp/cloudrun" +) + +// Cloud Run service name +serviceName: *"cloudrun-test" | string @dagger(input) + +// GCP region +region: *"us-west2" | string @dagger(input) + +// Image name +image: *"gcr.io/dagger-ci/cloudrun-test" | string @dagger(input) + +gcpConfig: gcp.#Config & { + region: region +} + +deploy: cloudrun.#Deploy & { + serviceName: serviceName + image: image + config: gcpConfig + region: region +} diff --git a/stdlib/gcp/cloudrun/cloudrun.cue b/stdlib/gcp/cloudrun/cloudrun.cue new file mode 100644 index 00000000..2ce87b86 --- /dev/null +++ b/stdlib/gcp/cloudrun/cloudrun.cue @@ -0,0 +1,52 @@ +package cloudrun + +import ( + "dagger.io/dagger/op" + "dagger.io/gcp" +) + +// Deploy deploys a Cloud Run service based on provided GCR image +#Deploy: { + // GCP Config + config: gcp.#Config + + // service name + serviceName: string @dagger(input) + + // region to which deploy the service + region: *"us-west2" | string @dagger(input) + + // GCR image ref + image: string @dagger(input) + + // Cloud Run platform + platform: *"managed" | string @dagger(input) + + #up: [ + op.#Load & { + from: gcp.#GCloud & { + "config": config + } + }, + + op.#Exec & { + args: [ + "/bin/bash", + "--noprofile", + "--norc", + "-eo", + "pipefail", + "-c", + #""" + gcloud run deploy "$SERVICE_NAME" --image "$IMAGE" --region "$REGION" --platform "$PLATFORM" --allow-unauthenticated + """#, + ] + env: { + SERVICE_NAME: serviceName + PLATFORM: platform + REGION: region + IMAGE: image + } + }, + ] +} diff --git a/tests/README.md b/tests/README.md index 5d4bb2de..3f600c67 100644 --- a/tests/README.md +++ b/tests/README.md @@ -3,7 +3,7 @@ ## TL;DR ```shell -# Install dependancies +# Install dependencies yarn install # Install gnu parallel if needed diff --git a/tests/stdlib/gcp/cloudrun/.dagger/env/default/.gitignore b/tests/stdlib/gcp/cloudrun/.dagger/env/default/.gitignore new file mode 100644 index 00000000..01ec19b0 --- /dev/null +++ b/tests/stdlib/gcp/cloudrun/.dagger/env/default/.gitignore @@ -0,0 +1,2 @@ +# dagger state +state/** diff --git a/tests/stdlib/gcp/cloudrun/.dagger/env/default/plan/cloudrun.cue b/tests/stdlib/gcp/cloudrun/.dagger/env/default/plan/cloudrun.cue new file mode 100644 index 00000000..879666e4 --- /dev/null +++ b/tests/stdlib/gcp/cloudrun/.dagger/env/default/plan/cloudrun.cue @@ -0,0 +1,15 @@ +package cloudrun + +import ( + "dagger.io/gcp" + "dagger.io/gcp/cloudrun" +) + +TestConfig: gcpConfig: gcp.#Config + +TestCloudRun: deploy: cloudrun.#Deploy & { + config: TestConfig.gcpConfig + serviceName: "cloudrun-test" + region: "us-west2" + image: "gcr.io/dagger-ci/cloudrun-test:latest" +} diff --git a/tests/stdlib/gcp/cloudrun/.dagger/env/default/values.yaml b/tests/stdlib/gcp/cloudrun/.dagger/env/default/values.yaml new file mode 100644 index 00000000..bff70a40 --- /dev/null +++ b/tests/stdlib/gcp/cloudrun/.dagger/env/default/values.yaml @@ -0,0 +1,28 @@ +name: default +inputs: + TestConfig.gcpConfig.project: + text: dagger-ci + TestConfig.gcpConfig.region: + text: us-west2-a + TestConfig.gcpConfig.serviceKey: + secret: ENC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twahzwdmrskhf90ppwlnze30lgpm056kuesrxzeuyclrwvpsupwtpk + enc: | + -----BEGIN AGE ENCRYPTED FILE----- + YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBCRThSTEE1Rm5HU2Y2NkJZ + SEd2blAyeEVnMHBqRGxXMEQ3TGFzWTBwd1EwCnA0OFVmTCsxSmpNV29adGt2ZHFH + WE9vN1ZoNENFV2t1TGVuZkdwVndNbVUKLS0tIGpHZEptYWxEZVNjcXF4NkoyWHRv + ZXd6Qmd1YUtxMnVTVkYybWgrV3pVK2MKowMeOZU3j3BxERT0DwhQYCGUDBK6gCdo + WByubiBATdsb7h7ytCC4HutWppynK4MpU+Ya9NP83AZuXo+Wa2u6aQ== + -----END AGE ENCRYPTED FILE----- + lastmodified: "2021-05-28T02:07:09Z" + mac: ENC[AES256_GCM,data:QqbgWep3l7dIfE4imJ3SKsMdexh7DgUvjtGwSgKbHHnT0p2MwIdFMY7pB0ZJvlc3ZwQyioT3wqF9xgn4U60a4piGtDYsyWjZn52tQAPy0p9c+sOHn+WlFVu1FJeljU4Q3mlEqdA6g993nsbJp9RnNShpc65rQXUMLkw2lXhOAak=,iv:1pp1D1fUFGI+Kn/H2efaqroJV+rzJRGmWo2ZTseTDis=,tag:ePCkD/G2KEbN7cxiMpy9fg==,type:str] + pgp: [] + encrypted_suffix: secret + version: 3.7.1 From 83eebf82fa3aacde7f14e2cb0dc11ddbbaff6c92 Mon Sep 17 00:00:00 2001 From: Tihomir Jovicic Date: Thu, 10 Jun 2021 11:45:52 +0200 Subject: [PATCH 05/18] Move Cloud Run image property to GCP config struct Signed-off-by: Tihomir Jovicic --- examples/README.md | 13 ++++---- .../.dagger/env/cloud-run-app/.gitignore | 2 -- .../.dagger/env/cloud-run-app/plan/main.cue | 26 ---------------- .../.dagger/env/cloud-run-app/values.yaml | 30 ------------------- examples/cloud-run-app/main.cue | 26 ---------------- .../go-http-server/.dockerignore | 0 .../go-http-server/Dockerfile | 0 .../go-http-server/go.mod | 0 .../go-http-server/main.go | 0 examples/cloudrun-app/main.cue | 20 +++++++++++++ .../gcp/cloudrun/{cloudrun.cue => main.cue} | 5 +--- .../.dagger/env/default/plan/main.cue | 16 ++++++++++ .../cloudrun/.dagger/env/default/values.yaml | 20 ++++++------- .../default/plan/cloudrun.cue => main.cue} | 7 +++-- 14 files changed, 56 insertions(+), 109 deletions(-) delete mode 100644 examples/cloud-run-app/.dagger/env/cloud-run-app/.gitignore delete mode 100644 examples/cloud-run-app/.dagger/env/cloud-run-app/plan/main.cue delete mode 100644 examples/cloud-run-app/.dagger/env/cloud-run-app/values.yaml delete mode 100644 examples/cloud-run-app/main.cue rename examples/{cloud-run-app => cloudrun-app}/go-http-server/.dockerignore (100%) rename examples/{cloud-run-app => cloudrun-app}/go-http-server/Dockerfile (100%) rename examples/{cloud-run-app => cloudrun-app}/go-http-server/go.mod (100%) rename examples/{cloud-run-app => cloudrun-app}/go-http-server/main.go (100%) create mode 100644 examples/cloudrun-app/main.cue rename stdlib/gcp/cloudrun/{cloudrun.cue => main.cue} (87%) create mode 100644 tests/stdlib/gcp/cloudrun/.dagger/env/default/plan/main.cue rename tests/stdlib/gcp/cloudrun/{.dagger/env/default/plan/cloudrun.cue => main.cue} (79%) diff --git a/examples/README.md b/examples/README.md index 2fa83d9c..11ac2d75 100644 --- a/examples/README.md +++ b/examples/README.md @@ -298,9 +298,9 @@ dagger up ## Deploy an application to GCP Cloud Run -This example shows how to deploy an application to GCP Cloud Run. Read the deployment [plan](https://github.com/dagger/dagger/tree/main/examples/cloud-run-app) +This example shows how to deploy an application to GCP Cloud Run. Read the deployment [plan](https://github.com/dagger/dagger/tree/main/examples/cloudrun-app) -NOTE: this example requires an EKS cluster to allow authentication with your AWS credentials; but can easily be adapter to deploy to any Kubernetes cluster. +NOTE: this example requires the right GCP IAM permissions: `https://cloud.google.com/run/docs/reference/iam/roles#additional-configuration` Components: @@ -311,27 +311,26 @@ How to run: 1. Initialize a new workspace ```sh -cd ./cloud-run-app +cd ./cloudrun-app dagger init ``` 2. Create a new environment ```sh -dagger new cloud-run-app -cp *.cue ./.dagger/env/cloud-run-app/plan/ +dagger new cloudrun-app +cp main.cue ./.dagger/env/cloudrun-app/plan/ ``` 3. Configure the Cloud Run service ```sh dagger input text serviceName MY_APP_NAME -dagger input text region MY_GCP_REGION dagger input text image MY_GCR_IMAGE_NAME dagger input text gcpConfig.project MY_GCP_PROJECT +dagger input text gcpConfig.region MY_GCP_REGION dagger input secret gcpConfig.serviceKey -f MY_GCP_SERVICE_KEY_FILE - ``` 4. Deploy! diff --git a/examples/cloud-run-app/.dagger/env/cloud-run-app/.gitignore b/examples/cloud-run-app/.dagger/env/cloud-run-app/.gitignore deleted file mode 100644 index 01ec19b0..00000000 --- a/examples/cloud-run-app/.dagger/env/cloud-run-app/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# dagger state -state/** diff --git a/examples/cloud-run-app/.dagger/env/cloud-run-app/plan/main.cue b/examples/cloud-run-app/.dagger/env/cloud-run-app/plan/main.cue deleted file mode 100644 index b0eece2f..00000000 --- a/examples/cloud-run-app/.dagger/env/cloud-run-app/plan/main.cue +++ /dev/null @@ -1,26 +0,0 @@ -package main - -import ( - "dagger.io/gcp" - "dagger.io/gcp/cloudrun" -) - -// Cloud Run service name -serviceName: *"cloudrun-test" | string @dagger(input) - -// GCP region -region: *"us-west2" | string @dagger(input) - -// Image name -image: *"gcr.io/dagger-ci/cloudrun-test" | string @dagger(input) - -gcpConfig: gcp.#Config & { - region: region -} - -deploy: cloudrun.#Deploy & { - serviceName: serviceName - image: image - config: gcpConfig - region: region -} diff --git a/examples/cloud-run-app/.dagger/env/cloud-run-app/values.yaml b/examples/cloud-run-app/.dagger/env/cloud-run-app/values.yaml deleted file mode 100644 index c25de1c8..00000000 --- a/examples/cloud-run-app/.dagger/env/cloud-run-app/values.yaml +++ /dev/null @@ -1,30 +0,0 @@ -name: cloud-run-app -inputs: - gcpConfig.project: - text: dagger-ci - gcp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text: us-west2 - serviceName: - text: cloudrun-test3 -sops: - kms: [] - gcp_kms: [] - azure_kv: [] - hc_vault: [] - age: - - recipient: age1j6nrevprudhes65akfpl7sl65pktl4wj272gh7xl82ul3aaugppq6zxujg - enc: | - -----BEGIN AGE ENCRYPTED FILE----- - YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBxWWdlTDFWK0VNQTNoUExS - Y20yNVZTT0hxNi91d3JvTUZ3UFNuRStUQTNvCnVEOVlTUjhvNU5MejdldWt0eWxR - UnZ4T0lUd3dsSURaNzRXWGVKQWllWTgKLS0tIHV0QkFWTDk2RE9hK2EyNm9GRVll - dmE4QXJmK255RHNIVzJjNjFwRCtCMzQKaAfgT/Q7uU4urlcgtz25Pbwx/p4iyEX/ - YpZaWQuVR2J9jtEh86oYZYGLxO5SAvqO5v20tfxXdVzZQkw0/QVPhQ== - -----END AGE ENCRYPTED FILE----- - lastmodified: "2021-06-10T06:06:28Z" - mac: ENC[AES256_GCM,data:qlX0EtuyHMNhMoVtR0xwD6kM2i+Jbq6NC6oQwZkEb4Pe8yy1cXKtHOvzDQAmMOL/vyE82fRtTmvfc85gA8vgw320TzXDcqxkpbVlML/5O7lDvOBwePvwajwG5JOlBXl+UJWMrH5nYfRPas1B4RSV7lksqXf/+a2+O0b2NN0UWDM=,iv:GqffDMMcLDefh6HU8fmaXlOk4xkjhq0sP5jkWAsiZKo=,tag:ttbyp8H7ZviPebmga9oJ7g==,type:str] - pgp: [] - encrypted_suffix: secret - version: 3.7.1 diff --git a/examples/cloud-run-app/main.cue b/examples/cloud-run-app/main.cue deleted file mode 100644 index b0eece2f..00000000 --- a/examples/cloud-run-app/main.cue +++ /dev/null @@ -1,26 +0,0 @@ -package main - -import ( - "dagger.io/gcp" - "dagger.io/gcp/cloudrun" -) - -// Cloud Run service name -serviceName: *"cloudrun-test" | string @dagger(input) - -// GCP region -region: *"us-west2" | string @dagger(input) - -// Image name -image: *"gcr.io/dagger-ci/cloudrun-test" | string @dagger(input) - -gcpConfig: gcp.#Config & { - region: region -} - -deploy: cloudrun.#Deploy & { - serviceName: serviceName - image: image - config: gcpConfig - region: region -} diff --git a/examples/cloud-run-app/go-http-server/.dockerignore b/examples/cloudrun-app/go-http-server/.dockerignore similarity index 100% rename from examples/cloud-run-app/go-http-server/.dockerignore rename to examples/cloudrun-app/go-http-server/.dockerignore diff --git a/examples/cloud-run-app/go-http-server/Dockerfile b/examples/cloudrun-app/go-http-server/Dockerfile similarity index 100% rename from examples/cloud-run-app/go-http-server/Dockerfile rename to examples/cloudrun-app/go-http-server/Dockerfile diff --git a/examples/cloud-run-app/go-http-server/go.mod b/examples/cloudrun-app/go-http-server/go.mod similarity index 100% rename from examples/cloud-run-app/go-http-server/go.mod rename to examples/cloudrun-app/go-http-server/go.mod diff --git a/examples/cloud-run-app/go-http-server/main.go b/examples/cloudrun-app/go-http-server/main.go similarity index 100% rename from examples/cloud-run-app/go-http-server/main.go rename to examples/cloudrun-app/go-http-server/main.go diff --git a/examples/cloudrun-app/main.cue b/examples/cloudrun-app/main.cue new file mode 100644 index 00000000..4491394e --- /dev/null +++ b/examples/cloudrun-app/main.cue @@ -0,0 +1,20 @@ +package main + +import ( + "dagger.io/gcp" + "dagger.io/gcp/cloudrun" +) + +// Cloud Run service name +serviceName: *"cloudrun-test" | string @dagger(input) + +// Image name +image: string @dagger(input) + +gcpConfig: gcp.#Config + +deploy: cloudrun.#Deploy & { + "serviceName": serviceName + "image": image + config: gcpConfig +} diff --git a/stdlib/gcp/cloudrun/cloudrun.cue b/stdlib/gcp/cloudrun/main.cue similarity index 87% rename from stdlib/gcp/cloudrun/cloudrun.cue rename to stdlib/gcp/cloudrun/main.cue index 2ce87b86..ced19ca7 100644 --- a/stdlib/gcp/cloudrun/cloudrun.cue +++ b/stdlib/gcp/cloudrun/main.cue @@ -13,9 +13,6 @@ import ( // service name serviceName: string @dagger(input) - // region to which deploy the service - region: *"us-west2" | string @dagger(input) - // GCR image ref image: string @dagger(input) @@ -44,7 +41,7 @@ import ( env: { SERVICE_NAME: serviceName PLATFORM: platform - REGION: region + REGION: config.region IMAGE: image } }, diff --git a/tests/stdlib/gcp/cloudrun/.dagger/env/default/plan/main.cue b/tests/stdlib/gcp/cloudrun/.dagger/env/default/plan/main.cue new file mode 100644 index 00000000..da16b09e --- /dev/null +++ b/tests/stdlib/gcp/cloudrun/.dagger/env/default/plan/main.cue @@ -0,0 +1,16 @@ +package cloudrun + +import ( + "dagger.io/gcp" + "dagger.io/gcp/cloudrun" +) + +TestConfig: gcpConfig: gcp.#Config & { + region: "us-west2" +} + +TestCloudRun: deploy: cloudrun.#Deploy & { + config: TestConfig.gcpConfig + serviceName: "cloudrun-test4" + image: "gcr.io/dagger-ci/cloudrun-test:latest" +} diff --git a/tests/stdlib/gcp/cloudrun/.dagger/env/default/values.yaml b/tests/stdlib/gcp/cloudrun/.dagger/env/default/values.yaml index bff70a40..100bb271 100644 --- a/tests/stdlib/gcp/cloudrun/.dagger/env/default/values.yaml +++ b/tests/stdlib/gcp/cloudrun/.dagger/env/default/values.yaml @@ -2,27 +2,25 @@ name: default 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+i1BjQbBYef8s9faYdZGEP0hUrvUpPek4Z0ZBDRbxRfRFAiXBbWbvCJErGlsmcNGqllixgDbcYQNKBTjZEKke4PGHtahmPXOI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mWzJS7/4n9MrUn8M4ZIyg//l4bovuR4uiMHNaL57h38cTP0kjhIXeiMWcxLYolzHyy1gs/AOQ8Vni6Wt1K5nWts5BafhXWv2f4AZQkxvtUHeMQykYpK2f+AnrXAWJtoP3s5rE2VoSjvbMEpEIz2DvcGb0cgjIE9WfSx2U/vOuOZ1ryJVr7NNj8HEdM1ueBRo7qtrYFOFhpLVNzEibWzVHUdgjLJSVPdZ10mjRHXQq+rcSHD+u147fmzU/APKG0KrGehr+q4Sq9cfFmbCxfiBbiBx/XWr0OneI2DBETPS4O4/Vnxwo/Ta2tY1EYZ+6yQ1EufxLRbafsqlNcerI8BXNVkR1uchwjMLgSLhMWZgXOl5y7cNJ+kQrwPkAD7sXJJLm4xc/es2usXIViiPoXdqFcEcmEGn3/LifWe8/mzbtkg/iaIWX8waPbdAShysYP4vaWTiM5uV1az4dzI4eeq+cJ0okBDVYVWwgVfaaM1BXpjHus=,iv:z5kMvxwHNWlkPyLSY4m4uJWlI0Ex49Mou5ggjYOAJZU=,tag:X87YuciqrxzbHxN84U/czw==,type:str] sops: kms: [] gcp_kms: [] azure_kv: [] hc_vault: [] age: - - recipient: age1gxwmtwahzwdmrskhf90ppwlnze30lgpm056kuesrxzeuyclrwvpsupwtpk + - recipient: age1j6nrevprudhes65akfpl7sl65pktl4wj272gh7xl82ul3aaugppq6zxujg enc: | -----BEGIN AGE ENCRYPTED FILE----- - YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBCRThSTEE1Rm5HU2Y2NkJZ - SEd2blAyeEVnMHBqRGxXMEQ3TGFzWTBwd1EwCnA0OFVmTCsxSmpNV29adGt2ZHFH - WE9vN1ZoNENFV2t1TGVuZkdwVndNbVUKLS0tIGpHZEptYWxEZVNjcXF4NkoyWHRv - ZXd6Qmd1YUtxMnVTVkYybWgrV3pVK2MKowMeOZU3j3BxERT0DwhQYCGUDBK6gCdo - WByubiBATdsb7h7ytCC4HutWppynK4MpU+Ya9NP83AZuXo+Wa2u6aQ== + YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBlS2FGbmN6NHUvQURxNHFM + VGhOSkpzemlqRy9VRm1YWmgzVjlyL3dwYmdvCjFCKzVZU0F6c3d1cW1zY2dhenF5 + VDNWMkU1Tk9jNzhiZFJyTmdWS0hSMFkKLS0tIHFka3R5M3lIaUUwQy9vL2psVlda + bmNoN29yMHhPQ3cwVzNpUkxIQ0ZnM1EKJht8ms14xoJljhph1bC8E7zZAp9NIYAR + pSpl03AeVHVO8TIJT7P4Fb/sWTpeO43WNDVpLdVOqb1zYSAKZ5G3AQ== -----END AGE ENCRYPTED FILE----- - lastmodified: "2021-05-28T02:07:09Z" - mac: ENC[AES256_GCM,data:QqbgWep3l7dIfE4imJ3SKsMdexh7DgUvjtGwSgKbHHnT0p2MwIdFMY7pB0ZJvlc3ZwQyioT3wqF9xgn4U60a4piGtDYsyWjZn52tQAPy0p9c+sOHn+WlFVu1FJeljU4Q3mlEqdA6g993nsbJp9RnNShpc65rQXUMLkw2lXhOAak=,iv:1pp1D1fUFGI+Kn/H2efaqroJV+rzJRGmWo2ZTseTDis=,tag:ePCkD/G2KEbN7cxiMpy9fg==,type:str] + lastmodified: "2021-06-10T09:04:25Z" + mac: ENC[AES256_GCM,data:CKp5GwZZWUk35GsqU7447Km24t7B1pqV6VwcRZetzVbeXPT9Wc5hVfTqR8HYWE/vxz8CwkkJSkqYgdS72JUBJaoZLSXBLO6C50QqPDUdMunZp0pTidKuubET4Jmr2hflMv473CQhBr0wmhKlRJLv3u83Zx/XqKljgl7gZ2HkJ7c=,iv:7RaadjoAANIo21IA/myn+pXsQdAgH5I6LZw4iK2y2rA=,tag:pASgOqReKaoG/yUSr9BCyA==,type:str] pgp: [] encrypted_suffix: secret version: 3.7.1 diff --git a/tests/stdlib/gcp/cloudrun/.dagger/env/default/plan/cloudrun.cue b/tests/stdlib/gcp/cloudrun/main.cue similarity index 79% rename from tests/stdlib/gcp/cloudrun/.dagger/env/default/plan/cloudrun.cue rename to tests/stdlib/gcp/cloudrun/main.cue index 879666e4..22e849d1 100644 --- a/tests/stdlib/gcp/cloudrun/.dagger/env/default/plan/cloudrun.cue +++ b/tests/stdlib/gcp/cloudrun/main.cue @@ -5,11 +5,12 @@ import ( "dagger.io/gcp/cloudrun" ) -TestConfig: gcpConfig: gcp.#Config +TestConfig: gcpConfig: gcp.#Config & { + region: "us-west2" +} TestCloudRun: deploy: cloudrun.#Deploy & { - config: TestConfig.gcpConfig serviceName: "cloudrun-test" - region: "us-west2" + config: TestConfig.gcpConfig image: "gcr.io/dagger-ci/cloudrun-test:latest" } From 78567ede6a5c63d0036050f8ece5b3f458d7efed Mon Sep 17 00:00:00 2001 From: Tihomir Jovicic Date: Thu, 10 Jun 2021 11:54:03 +0200 Subject: [PATCH 06/18] Update cloudrun universe docs Signed-off-by: Tihomir Jovicic --- docs/reference/universe/gcp/cloudrun.md | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/docs/reference/universe/gcp/cloudrun.md b/docs/reference/universe/gcp/cloudrun.md index aa9e2121..a4213ca4 100644 --- a/docs/reference/universe/gcp/cloudrun.md +++ b/docs/reference/universe/gcp/cloudrun.md @@ -10,15 +10,14 @@ Deploy deploys a Cloud Run service based on provided GCR image ### #Deploy Inputs -| Name | Type | Description | -| ------------- |:-------------: |:-------------: | -|*config.region* | `string` |GCP region | -|*config.project* | `string` |GCP project | -|*config.serviceKey* | `dagger.#Secret` |GCP service key | -|*serviceName* | `string` |service name | -|*region* | `*"us-west2" \| string` |region to which deploy the service | -|*image* | `string` |GCR image ref | -|*platform* | `*"managed" \| string` |Cloud Run platform | +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*config.region* | `string` |GCP region | +|*config.project* | `string` |GCP project | +|*config.serviceKey* | `dagger.#Secret` |GCP service key | +|*serviceName* | `string` |service name | +|*image* | `string` |GCR image ref | +|*platform* | `*"managed" \| string` |Cloud Run platform | ### #Deploy Outputs From a78a678db3cc9e05954cc6753d782e30aeaf6680 Mon Sep 17 00:00:00 2001 From: Tihomir Jovicic Date: Mon, 21 Jun 2021 11:26:54 +0200 Subject: [PATCH 07/18] move Cloud Run tests to universe/stdlib env Signed-off-by: Tihomir Jovicic --- docs/reference/universe/gcp/cloudrun.md | 10 ++++--- stdlib/.dagger/env/google-cloudrun/.gitignore | 2 ++ .../.dagger/env/google-cloudrun/plan/main.cue | 16 ++++++++++++ .../.dagger/env/google-cloudrun/values.yaml | 26 +++++++++++++++++++ stdlib/universe.bats | 4 +++ 5 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 stdlib/.dagger/env/google-cloudrun/.gitignore create mode 100644 stdlib/.dagger/env/google-cloudrun/plan/main.cue create mode 100644 stdlib/.dagger/env/google-cloudrun/values.yaml diff --git a/docs/reference/universe/gcp/cloudrun.md b/docs/reference/universe/gcp/cloudrun.md index a4213ca4..23b2a9c0 100644 --- a/docs/reference/universe/gcp/cloudrun.md +++ b/docs/reference/universe/gcp/cloudrun.md @@ -4,11 +4,15 @@ sidebar_label: cloudrun # dagger.io/gcp/cloudrun -## #Deploy +```cue +import "dagger.io/gcp/cloudrun" +``` + +## cloudrun.#Deploy Deploy deploys a Cloud Run service based on provided GCR image -### #Deploy Inputs +### cloudrun.#Deploy Inputs | Name | Type | Description | | ------------- |:-------------: |:-------------: | @@ -19,6 +23,6 @@ Deploy deploys a Cloud Run service based on provided GCR image |*image* | `string` |GCR image ref | |*platform* | `*"managed" \| string` |Cloud Run platform | -### #Deploy Outputs +### cloudrun.#Deploy Outputs _No output._ diff --git a/stdlib/.dagger/env/google-cloudrun/.gitignore b/stdlib/.dagger/env/google-cloudrun/.gitignore new file mode 100644 index 00000000..01ec19b0 --- /dev/null +++ b/stdlib/.dagger/env/google-cloudrun/.gitignore @@ -0,0 +1,2 @@ +# dagger state +state/** diff --git a/stdlib/.dagger/env/google-cloudrun/plan/main.cue b/stdlib/.dagger/env/google-cloudrun/plan/main.cue new file mode 100644 index 00000000..dc1b428f --- /dev/null +++ b/stdlib/.dagger/env/google-cloudrun/plan/main.cue @@ -0,0 +1,16 @@ +package cloudrun + +import ( + "dagger.io/gcp" + "dagger.io/gcp/cloudrun" +) + +TestConfig: gcpConfig: gcp.#Config & { + region: "us-west2" +} + +TestCloudRun: deploy: cloudrun.#Deploy & { + config: TestConfig.gcpConfig + serviceName: "cloudrun-test" + image: "gcr.io/dagger-ci/cloudrun-test:latest" +} diff --git a/stdlib/.dagger/env/google-cloudrun/values.yaml b/stdlib/.dagger/env/google-cloudrun/values.yaml new file mode 100644 index 00000000..100bb271 --- /dev/null +++ b/stdlib/.dagger/env/google-cloudrun/values.yaml @@ -0,0 +1,26 @@ +name: default +inputs: + TestConfig.gcpConfig.project: + text: dagger-ci + TestConfig.gcpConfig.serviceKey: + secret: ENC[AES256_GCM,data:VqpVNjpxHKLxVWY9PJSUt7SjAwiP8a89JeK3iXir+k8rsNXgb2NlWGjoCc0JzHcManmqEtwuK5uwJu35xmpzzGB1gUumh7NYm26IupEAEXwq9zw1sO9BQwFPjCejfvnfjWXhUIVsHxWNPTSoOLjZkakZ5RGVB8+3nlLkFyUPm0pxF3lhg1Bd737VZvix4h0EyE0i03+zypc2QmBzxGcONmq2L7y686JaQkGuDA6REtl94OGmk18dfJ7UmtGJgSuDh91bXWmUJQpnyItE87+cgaq4EX/VbHY0p88fA2r+qIDQaZjhb1xSwfw9IV4q2RkcZdgCXtIK0X5U+2W+lrASitfTVr31S5LEe0PDqIBxUKriNXbX5zzxpZEkzVygAiIAGkHrcJro2H3jkmNmAMM5grrZN/fSUBsom02zqGkByyFLjD3moFFgg7aoXS+mVSxH7fhruzi9K2/Tz6Ld6n+hSSh6KYqoYsW8u1bWBlclCa9wLSU+6uyLW6sihfcTaI6vB46WG1QbTEaNbKGKx5CqryCJj886GjYWzKF2fHIb8gybhq+VlMwvRxQb0Sbt5YcmOuO7ZTll0nTvGexa43EID254SclEXt50SrPgfvNc9259UC+RvVwn+ezEFmMfBqTKG1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BRo7qtrYFOFhpLVNzEibWzVHUdgjLJSVPdZ10mjRHXQq+rcSHD+u147fmzU/APKG0KrGehr+q4Sq9cfFmbCxfiBbiBx/XWr0OneI2DBETPS4O4/Vnxwo/Ta2tY1EYZ+6yQ1EufxLRbafsqlNcerI8BXNVkR1uchwjMLgSLhMWZgXOl5y7cNJ+kQrwPkAD7sXJJLm4xc/es2usXIViiPoXdqFcEcmEGn3/LifWe8/mzbtkg/iaIWX8waPbdAShysYP4vaWTiM5uV1az4dzI4eeq+cJ0okBDVYVWwgVfaaM1BXpjHus=,iv:z5kMvxwHNWlkPyLSY4m4uJWlI0Ex49Mou5ggjYOAJZU=,tag:X87YuciqrxzbHxN84U/czw==,type:str] +sops: + kms: [] + gcp_kms: [] + azure_kv: [] + hc_vault: [] + age: + - recipient: age1j6nrevprudhes65akfpl7sl65pktl4wj272gh7xl82ul3aaugppq6zxujg + enc: | + -----BEGIN AGE ENCRYPTED FILE----- + YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBlS2FGbmN6NHUvQURxNHFM + VGhOSkpzemlqRy9VRm1YWmgzVjlyL3dwYmdvCjFCKzVZU0F6c3d1cW1zY2dhenF5 + VDNWMkU1Tk9jNzhiZFJyTmdWS0hSMFkKLS0tIHFka3R5M3lIaUUwQy9vL2psVlda + bmNoN29yMHhPQ3cwVzNpUkxIQ0ZnM1EKJht8ms14xoJljhph1bC8E7zZAp9NIYAR + pSpl03AeVHVO8TIJT7P4Fb/sWTpeO43WNDVpLdVOqb1zYSAKZ5G3AQ== + -----END AGE ENCRYPTED FILE----- + lastmodified: "2021-06-10T09:04:25Z" + mac: ENC[AES256_GCM,data:CKp5GwZZWUk35GsqU7447Km24t7B1pqV6VwcRZetzVbeXPT9Wc5hVfTqR8HYWE/vxz8CwkkJSkqYgdS72JUBJaoZLSXBLO6C50QqPDUdMunZp0pTidKuubET4Jmr2hflMv473CQhBr0wmhKlRJLv3u83Zx/XqKljgl7gZ2HkJ7c=,iv:7RaadjoAANIo21IA/myn+pXsQdAgH5I6LZw4iK2y2rA=,tag:pASgOqReKaoG/yUSr9BCyA==,type:str] + pgp: [] + encrypted_suffix: secret + version: 3.7.1 diff --git a/stdlib/universe.bats b/stdlib/universe.bats index 2bceeac2..c505cdb7 100644 --- a/stdlib/universe.bats +++ b/stdlib/universe.bats @@ -60,3 +60,7 @@ setup() { @test "google cloud: gke" { dagger -e google-gke up } + +@test "google cloud: cloudrun" { + dagger -e google-cloudrun up +} From 6451e2e40d880141e9d473b66af402b7e962774a Mon Sep 17 00:00:00 2001 From: Tihomir Jovicic Date: Mon, 21 Jun 2021 11:35:33 +0200 Subject: [PATCH 08/18] remove old gcp cloudrun tests Signed-off-by: Tihomir Jovicic --- .../cloudrun/.dagger/env/default/.gitignore | 2 -- .../.dagger/env/default/plan/main.cue | 16 ------------ .../cloudrun/.dagger/env/default/values.yaml | 26 ------------------- tests/stdlib/gcp/cloudrun/main.cue | 16 ------------ 4 files changed, 60 deletions(-) delete mode 100644 tests/stdlib/gcp/cloudrun/.dagger/env/default/.gitignore delete mode 100644 tests/stdlib/gcp/cloudrun/.dagger/env/default/plan/main.cue delete mode 100644 tests/stdlib/gcp/cloudrun/.dagger/env/default/values.yaml delete mode 100644 tests/stdlib/gcp/cloudrun/main.cue diff --git a/tests/stdlib/gcp/cloudrun/.dagger/env/default/.gitignore b/tests/stdlib/gcp/cloudrun/.dagger/env/default/.gitignore deleted file mode 100644 index 01ec19b0..00000000 --- a/tests/stdlib/gcp/cloudrun/.dagger/env/default/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# dagger state -state/** diff --git a/tests/stdlib/gcp/cloudrun/.dagger/env/default/plan/main.cue b/tests/stdlib/gcp/cloudrun/.dagger/env/default/plan/main.cue deleted file mode 100644 index da16b09e..00000000 --- a/tests/stdlib/gcp/cloudrun/.dagger/env/default/plan/main.cue +++ /dev/null @@ -1,16 +0,0 @@ -package cloudrun - -import ( - "dagger.io/gcp" - "dagger.io/gcp/cloudrun" -) - -TestConfig: gcpConfig: gcp.#Config & { - region: "us-west2" -} - -TestCloudRun: deploy: cloudrun.#Deploy & { - config: TestConfig.gcpConfig - serviceName: "cloudrun-test4" - image: "gcr.io/dagger-ci/cloudrun-test:latest" -} diff --git a/tests/stdlib/gcp/cloudrun/.dagger/env/default/values.yaml b/tests/stdlib/gcp/cloudrun/.dagger/env/default/values.yaml deleted file mode 100644 index 100bb271..00000000 --- a/tests/stdlib/gcp/cloudrun/.dagger/env/default/values.yaml +++ /dev/null @@ -1,26 +0,0 @@ -name: default -inputs: - TestConfig.gcpConfig.project: - text: dagger-ci - TestConfig.gcpConfig.serviceKey: - secret: ENC[AES256_GCM,data:VqpVNjpxHKLxVWY9PJSUt7SjAwiP8a89JeK3iXir+k8rsNXgb2NlWGjoCc0JzHcManmqEtwuK5uwJu35xmpzzGB1gUumh7NYm26IupEAEXwq9zw1sO9BQwFPjCejfvnfjWXhUIVsHxWNPTSoOLjZkakZ5RGVB8+3nlLkFyUPm0pxF3lhg1Bd737VZvix4h0EyE0i03+zypc2QmBzxGcONmq2L7y686JaQkGuDA6REtl94OGmk18dfJ7UmtGJgSuDh91bXWmUJQpnyItE87+cgaq4EX/VbHY0p88fA2r+qIDQaZjhb1xSwfw9IV4q2RkcZdgCXtIK0X5U+2W+lrASitfTVr31S5LEe0PDqIBxUKriNXbX5zzxpZEkzVygAiIAGkHrcJro2H3jkmNmAMM5grrZN/fSUBsom02zqGkByyFLjD3moFFgg7aoXS+mVSxH7fhruzi9K2/Tz6Ld6n+hSSh6KYqoYsW8u1bWBlclCa9wLSU+6uyLW6sihfcTaI6vB46WG1QbTEaNbKGKx5CqryCJj886GjYWzKF2fHIb8gybhq+VlMwvRxQb0Sbt5YcmOuO7ZTll0nTvGexa43EID254SclEXt50SrPgfvNc9259UC+RvVwn+ezEFmMfBqTKG1oo/Z40D4jaYr07M6pPUCTtqbGce+OFlWArKwYq37J9TS4gojv71KEL1N7gUSJPN6MZ1yP3H4hzbmZ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9cfFmbCxfiBbiBx/XWr0OneI2DBETPS4O4/Vnxwo/Ta2tY1EYZ+6yQ1EufxLRbafsqlNcerI8BXNVkR1uchwjMLgSLhMWZgXOl5y7cNJ+kQrwPkAD7sXJJLm4xc/es2usXIViiPoXdqFcEcmEGn3/LifWe8/mzbtkg/iaIWX8waPbdAShysYP4vaWTiM5uV1az4dzI4eeq+cJ0okBDVYVWwgVfaaM1BXpjHus=,iv:z5kMvxwHNWlkPyLSY4m4uJWlI0Ex49Mou5ggjYOAJZU=,tag:X87YuciqrxzbHxN84U/czw==,type:str] -sops: - kms: [] - gcp_kms: [] - azure_kv: [] - hc_vault: [] - age: - - recipient: age1j6nrevprudhes65akfpl7sl65pktl4wj272gh7xl82ul3aaugppq6zxujg - enc: | - -----BEGIN AGE ENCRYPTED FILE----- - YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBlS2FGbmN6NHUvQURxNHFM - VGhOSkpzemlqRy9VRm1YWmgzVjlyL3dwYmdvCjFCKzVZU0F6c3d1cW1zY2dhenF5 - VDNWMkU1Tk9jNzhiZFJyTmdWS0hSMFkKLS0tIHFka3R5M3lIaUUwQy9vL2psVlda - bmNoN29yMHhPQ3cwVzNpUkxIQ0ZnM1EKJht8ms14xoJljhph1bC8E7zZAp9NIYAR - pSpl03AeVHVO8TIJT7P4Fb/sWTpeO43WNDVpLdVOqb1zYSAKZ5G3AQ== - -----END AGE ENCRYPTED FILE----- - lastmodified: "2021-06-10T09:04:25Z" - mac: ENC[AES256_GCM,data:CKp5GwZZWUk35GsqU7447Km24t7B1pqV6VwcRZetzVbeXPT9Wc5hVfTqR8HYWE/vxz8CwkkJSkqYgdS72JUBJaoZLSXBLO6C50QqPDUdMunZp0pTidKuubET4Jmr2hflMv473CQhBr0wmhKlRJLv3u83Zx/XqKljgl7gZ2HkJ7c=,iv:7RaadjoAANIo21IA/myn+pXsQdAgH5I6LZw4iK2y2rA=,tag:pASgOqReKaoG/yUSr9BCyA==,type:str] - pgp: [] - encrypted_suffix: secret - version: 3.7.1 diff --git a/tests/stdlib/gcp/cloudrun/main.cue b/tests/stdlib/gcp/cloudrun/main.cue deleted file mode 100644 index 22e849d1..00000000 --- a/tests/stdlib/gcp/cloudrun/main.cue +++ /dev/null @@ -1,16 +0,0 @@ -package cloudrun - -import ( - "dagger.io/gcp" - "dagger.io/gcp/cloudrun" -) - -TestConfig: gcpConfig: gcp.#Config & { - region: "us-west2" -} - -TestCloudRun: deploy: cloudrun.#Deploy & { - serviceName: "cloudrun-test" - config: TestConfig.gcpConfig - image: "gcr.io/dagger-ci/cloudrun-test:latest" -} From 293ee0680fb31fa0db8eeadcc9ed46d7cdde1e96 Mon Sep 17 00:00:00 2001 From: Tihomir Jovicic Date: Mon, 21 Jun 2021 11:36:01 +0200 Subject: [PATCH 09/18] rename Cloud Run Deploy to Service Signed-off-by: Tihomir Jovicic --- stdlib/.dagger/env/google-cloudrun/plan/main.cue | 8 ++++---- stdlib/gcp/cloudrun/main.cue | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/stdlib/.dagger/env/google-cloudrun/plan/main.cue b/stdlib/.dagger/env/google-cloudrun/plan/main.cue index dc1b428f..82c46025 100644 --- a/stdlib/.dagger/env/google-cloudrun/plan/main.cue +++ b/stdlib/.dagger/env/google-cloudrun/plan/main.cue @@ -9,8 +9,8 @@ TestConfig: gcpConfig: gcp.#Config & { region: "us-west2" } -TestCloudRun: deploy: cloudrun.#Deploy & { - config: TestConfig.gcpConfig - serviceName: "cloudrun-test" - image: "gcr.io/dagger-ci/cloudrun-test:latest" +TestCloudRun: deploy: cloudrun.#Service & { + config: TestConfig.gcpConfig + name: "cloudrun-test" + image: "gcr.io/dagger-ci/cloudrun-test:latest" } diff --git a/stdlib/gcp/cloudrun/main.cue b/stdlib/gcp/cloudrun/main.cue index ced19ca7..abae659b 100644 --- a/stdlib/gcp/cloudrun/main.cue +++ b/stdlib/gcp/cloudrun/main.cue @@ -5,13 +5,13 @@ import ( "dagger.io/gcp" ) -// Deploy deploys a Cloud Run service based on provided GCR image -#Deploy: { +// Service deploys a Cloud Run service based on provided GCR image +#Service: { // GCP Config config: gcp.#Config // service name - serviceName: string @dagger(input) + name: string @dagger(input) // GCR image ref image: string @dagger(input) @@ -39,7 +39,7 @@ import ( """#, ] env: { - SERVICE_NAME: serviceName + SERVICE_NAME: name PLATFORM: platform REGION: config.region IMAGE: image From a1dbbf7a7fe6bf581ac630fd03acbbb63af12a51 Mon Sep 17 00:00:00 2001 From: Tihomir Jovicic Date: Mon, 21 Jun 2021 12:26:24 +0200 Subject: [PATCH 10/18] update cloudrun tests Signed-off-by: Tihomir Jovicic --- docs/reference/universe/gcp/cloudrun.md | 10 ++++----- .../plan/{main.cue => cloudrun.cue} | 0 .../.dagger/env/google-cloudrun/values.yaml | 21 +++++++------------ 3 files changed, 13 insertions(+), 18 deletions(-) rename stdlib/.dagger/env/google-cloudrun/plan/{main.cue => cloudrun.cue} (100%) diff --git a/docs/reference/universe/gcp/cloudrun.md b/docs/reference/universe/gcp/cloudrun.md index 23b2a9c0..db97ed5b 100644 --- a/docs/reference/universe/gcp/cloudrun.md +++ b/docs/reference/universe/gcp/cloudrun.md @@ -8,21 +8,21 @@ sidebar_label: cloudrun import "dagger.io/gcp/cloudrun" ``` -## cloudrun.#Deploy +## cloudrun.#Service -Deploy deploys a Cloud Run service based on provided GCR image +Service deploys a Cloud Run service based on provided GCR image -### cloudrun.#Deploy Inputs +### cloudrun.#Service Inputs | Name | Type | Description | | ------------- |:-------------: |:-------------: | |*config.region* | `string` |GCP region | |*config.project* | `string` |GCP project | |*config.serviceKey* | `dagger.#Secret` |GCP service key | -|*serviceName* | `string` |service name | +|*name* | `string` |service name | |*image* | `string` |GCR image ref | |*platform* | `*"managed" \| string` |Cloud Run platform | -### cloudrun.#Deploy Outputs +### cloudrun.#Service Outputs _No output._ diff --git a/stdlib/.dagger/env/google-cloudrun/plan/main.cue b/stdlib/.dagger/env/google-cloudrun/plan/cloudrun.cue similarity index 100% rename from stdlib/.dagger/env/google-cloudrun/plan/main.cue rename to stdlib/.dagger/env/google-cloudrun/plan/cloudrun.cue diff --git a/stdlib/.dagger/env/google-cloudrun/values.yaml b/stdlib/.dagger/env/google-cloudrun/values.yaml index 100bb271..21d35314 100644 --- a/stdlib/.dagger/env/google-cloudrun/values.yaml +++ b/stdlib/.dagger/env/google-cloudrun/values.yaml @@ -1,9 +1,4 @@ -name: default -inputs: - TestConfig.gcpConfig.project: - text: dagger-ci - TestConfig.gcpConfig.serviceKey: - secret: ENC[AES256_GCM,data:VqpVNjpxHKLxVWY9PJSUt7SjAwiP8a89JeK3iXir+k8rsNXgb2NlWGjoCc0JzHcManmqEtwuK5uwJu35xmpzzGB1gUumh7NYm26IupEAEXwq9zw1sO9BQwFPjCejfvnfjWXhUIVsHxWNPTSoOLjZkakZ5RGVB8+3nlLkFyUPm0pxF3lhg1Bd737VZvix4h0EyE0i03+zypc2QmBzxGcONmq2L7y686JaQkGuDA6REtl94OGmk18dfJ7UmtGJgSuDh91bXWmUJQpnyItE87+cgaq4EX/VbHY0p88fA2r+qIDQaZjhb1xSwfw9IV4q2RkcZdgCXtIK0X5U+2W+lrASitfTVr31S5LEe0PDqIBxUKriNXbX5zzxpZEkzVygAiIAGkHrcJro2H3jkmNmAMM5grrZN/fSUBsom02zqGkByyFLjD3moFFgg7aoXS+mVSxH7fhruzi9K2/Tz6Ld6n+hSSh6KYqoYsW8u1bWBlclCa9wLSU+6uyLW6sihfcTaI6vB46WG1QbTEaNbKGKx5CqryCJj886GjYWzKF2fHIb8gybhq+VlMwvRxQb0Sbt5YcmOuO7ZTll0nTvGexa43EID254SclEXt50SrPgfvNc9259UC+RvVwn+ezEFmMfBqTKG1oo/Z40D4jaYr07M6pPUCTtqbGce+OFlWArKwYq37J9TS4gojv71KEL1N7gUSJPN6MZ1yP3H4hzbmZyycxVUHzOJ73BTTS/9cly8ros7OJJV8JBxR9KCT2RCR22/RG6COG1DktH/4/SYCl/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xLRbafsqlNcerI8BXNVkR1uchwjMLgSLhMWZgXOl5y7cNJ+kQrwPkAD7sXJJLm4xc/es2usXIViiPoXdqFcEcmEGn3/LifWe8/mzbtkg/iaIWX8waPbdAShysYP4vaWTiM5uV1az4dzI4eeq+cJ0okBDVYVWwgVfaaM1BXpjHus=,iv:z5kMvxwHNWlkPyLSY4m4uJWlI0Ex49Mou5ggjYOAJZU=,tag:X87YuciqrxzbHxN84U/czw==,type:str] +name: google-cloudrun sops: kms: [] gcp_kms: [] @@ -13,14 +8,14 @@ sops: - recipient: age1j6nrevprudhes65akfpl7sl65pktl4wj272gh7xl82ul3aaugppq6zxujg enc: | -----BEGIN AGE ENCRYPTED FILE----- - YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBlS2FGbmN6NHUvQURxNHFM - VGhOSkpzemlqRy9VRm1YWmgzVjlyL3dwYmdvCjFCKzVZU0F6c3d1cW1zY2dhenF5 - VDNWMkU1Tk9jNzhiZFJyTmdWS0hSMFkKLS0tIHFka3R5M3lIaUUwQy9vL2psVlda - bmNoN29yMHhPQ3cwVzNpUkxIQ0ZnM1EKJht8ms14xoJljhph1bC8E7zZAp9NIYAR - pSpl03AeVHVO8TIJT7P4Fb/sWTpeO43WNDVpLdVOqb1zYSAKZ5G3AQ== + YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSA2eU4vTE0rY1NpOERvVEdv + YnoyZUVLLzVZeDdUZjk4eGdLTkFyZE9vNzBvCk9wYnZzWFJMRVpMajVkcjgvbWV5 + ZVlkZzlzSWIxa2JTOWxVV01DQXZkV00KLS0tIEJNcEhCdU9vQkVITjd4dGFTdHNI + SEwwZ05LUjRVcmhvVDltVEFUL255c3MKoXyFKSXJpu0wtgfUTc7a5qBxA8Mur6v1 + iV1TLQ9zNkKB2xnxNdUL8c6DplL1LPvkU/ogcnbm2JxwM8cGAFLFLw== -----END AGE ENCRYPTED FILE----- - lastmodified: "2021-06-10T09:04:25Z" - mac: ENC[AES256_GCM,data:CKp5GwZZWUk35GsqU7447Km24t7B1pqV6VwcRZetzVbeXPT9Wc5hVfTqR8HYWE/vxz8CwkkJSkqYgdS72JUBJaoZLSXBLO6C50QqPDUdMunZp0pTidKuubET4Jmr2hflMv473CQhBr0wmhKlRJLv3u83Zx/XqKljgl7gZ2HkJ7c=,iv:7RaadjoAANIo21IA/myn+pXsQdAgH5I6LZw4iK2y2rA=,tag:pASgOqReKaoG/yUSr9BCyA==,type:str] + lastmodified: "2021-06-21T10:11:25Z" + mac: ENC[AES256_GCM,data:Cvkmvt3vaqGthlrSaPfsbsVlWr6rxVNQkYkRmNLX+/+saz3GiOLZURfydWhcaFTjTeL9jUqO7g03Jq+D3qGHiWTBpiZQfOBLv8UP/zXYhptP6eilAV3/ahAH+tAmUdyU67lwxz1rfEtGPOupqIZID2dgDcI+m1aMoJbtyvH2PmA=,iv:8MPlRpX5PIoGmqD0xRYSS3PDgs37GAP2OKmPbTaNW6w=,tag:VS9oC1AyLBb98i9kF2tRFw==,type:str] pgp: [] encrypted_suffix: secret version: 3.7.1 From c480a74687bff3425a6f1b085acc778f5f2334a5 Mon Sep 17 00:00:00 2001 From: Tihomir Jovicic Date: Tue, 22 Jun 2021 12:12:17 +0200 Subject: [PATCH 11/18] update cloudrun tests inputs Signed-off-by: Tihomir Jovicic --- .../.dagger/env/google-cloudrun/plan/cloudrun.cue | 4 +--- stdlib/.dagger/env/google-cloudrun/values.yaml | 13 +++++++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/stdlib/.dagger/env/google-cloudrun/plan/cloudrun.cue b/stdlib/.dagger/env/google-cloudrun/plan/cloudrun.cue index 82c46025..7c8c37be 100644 --- a/stdlib/.dagger/env/google-cloudrun/plan/cloudrun.cue +++ b/stdlib/.dagger/env/google-cloudrun/plan/cloudrun.cue @@ -5,9 +5,7 @@ import ( "dagger.io/gcp/cloudrun" ) -TestConfig: gcpConfig: gcp.#Config & { - region: "us-west2" -} +TestConfig: gcpConfig: gcp.#Config TestCloudRun: deploy: cloudrun.#Service & { config: TestConfig.gcpConfig diff --git a/stdlib/.dagger/env/google-cloudrun/values.yaml b/stdlib/.dagger/env/google-cloudrun/values.yaml index 21d35314..8da7d2a6 100644 --- a/stdlib/.dagger/env/google-cloudrun/values.yaml +++ b/stdlib/.dagger/env/google-cloudrun/values.yaml @@ -1,4 +1,13 @@ +plan: + module: .dagger/env/google-cloudrun/plan name: google-cloudrun +inputs: + TestConfig.gcpConfig.project: + text: dagger-ci + TestConfig.gcpConfig.region: + text: us-west2 + TestConfig.gcpConfig.serviceKey: + secret: ENC[AES256_GCM,data:ntVZMN2z7TNFzQRjvuZewwRpag9GeDhEZHa6yQ3tBCqTPhaPLaWuyk1yWc9DbP2zS2sjn/HtcnKi6wf/yi2O4estbCA9SZ1qohABtJCk4EYdOwlJOlXSzL4RQ8/PkL2T1H+EW3B6f+57WoCMRKa0eZ541l6YKFgtT2eg5OSjDDRTdSjWS76xgTB/SULMitxW/ua5t8Lkl4xuurn7bO4Af6zJQgpNvI8a2i+Don/QeOOt4WBsC8f/yGdphJvpN/zqyTUjX6bjZPmLZcG7vQSUXsAoypBWY+e6eleXhElqNxcBfsuIw7XsEJ0UTjf3Fw2mBdgm3Lee0LCXsoYGh0I7QTlfXEyPaYxhzk8+i0dlr3zlCWQ6w/PJNz7xjgKUAS6dmQXzncYrsegVfyb83swK8InO/mQ+u5TC4g0H/3k2lClYhOUcAPM2E0tS3/pxBrbrbLRFHpGOc8HZDs7OtcEzLpTEmyMg49Es8KjMzGdYQsZww+ZOEEOjQPA7dxNayXZ60Ow31TKovuDCbr8vZKGq8W8Ai3PG7nLe7Orxk6ueK6p5htziq0WBiOoxhNcKCkhLJnv4APYeS60Dj5igEA2zdFWfqcVXeijr2ZpWEzLYy9PJumQRSt+AyEr/jv1NzanyxzPqz96N48iXhS0BlGpM61e+qQyJx9LHBtuOoE+HrkeCjt2r3OwhTQ0qnpiYZOj5k5R1Sx3fcbwAE5lU1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GUOWWE1uNgLywXBGXapwqLMnu+T4sn9OHzKfTBlNjpkSyzUxC7blJ0DrfilUUDssZ+mdvHRqU21xbRCEOLOxgZE5+Syh2HIS41xoQnXIiiPfmbUAcneJTvG6R4USWuuI2ujExud1jV7xzcU21/CWX0x0h1QduGyCEr3fIrO6tfCbysG4q/3YHEjnQ70xyzql+JQMgBK7PW284k1kxPVTns3evU=,iv:0vdyhT05PLL4nwBGho9FGtCcAWpuwJUKB9n0/W7aYt0=,tag:RvqOheTKWysvejIghtU3zw==,type:str] sops: kms: [] gcp_kms: [] @@ -14,8 +23,8 @@ sops: SEwwZ05LUjRVcmhvVDltVEFUL255c3MKoXyFKSXJpu0wtgfUTc7a5qBxA8Mur6v1 iV1TLQ9zNkKB2xnxNdUL8c6DplL1LPvkU/ogcnbm2JxwM8cGAFLFLw== -----END AGE ENCRYPTED FILE----- - lastmodified: "2021-06-21T10:11:25Z" - mac: ENC[AES256_GCM,data:Cvkmvt3vaqGthlrSaPfsbsVlWr6rxVNQkYkRmNLX+/+saz3GiOLZURfydWhcaFTjTeL9jUqO7g03Jq+D3qGHiWTBpiZQfOBLv8UP/zXYhptP6eilAV3/ahAH+tAmUdyU67lwxz1rfEtGPOupqIZID2dgDcI+m1aMoJbtyvH2PmA=,iv:8MPlRpX5PIoGmqD0xRYSS3PDgs37GAP2OKmPbTaNW6w=,tag:VS9oC1AyLBb98i9kF2tRFw==,type:str] + lastmodified: "2021-06-22T10:10:16Z" + mac: ENC[AES256_GCM,data:AdUtAYjBfMR405tsFJKQ/5chBqFUzwEWN3W2+e4uI0la5Wh481GyoEHsGoX56GaHFfHztgx0pY6e7UO+6NFIUC0m9/TW2uoa+R3n4WTHpb9gys/0KXwJZ0a1KYZDJJtK5fwsP7md3BSrp0jGPitZNzkLIvVmCXUgJ8UwhHsGFnk=,iv:4FzZdfeGn0CxibzS/lvwIUb98PlnFyrFDjcuiY30BbE=,tag:ijrgtqfh+vszSHmDnXdh5w==,type:str] pgp: [] encrypted_suffix: secret version: 3.7.1 From a24595da20e9f572adbe9df883e01153b435411b Mon Sep 17 00:00:00 2001 From: Tihomir Jovicic Date: Tue, 22 Jun 2021 13:07:59 +0200 Subject: [PATCH 12/18] Fix tests Signed-off-by: Tihomir Jovicic --- docs/programming/guides/cloudrun.md | 37 +++++++++---------- .../.dagger/env/google-cloudrun/values.yaml | 18 ++++----- 2 files changed, 27 insertions(+), 28 deletions(-) diff --git a/docs/programming/guides/cloudrun.md b/docs/programming/guides/cloudrun.md index 9a1ef73b..61250308 100644 --- a/docs/programming/guides/cloudrun.md +++ b/docs/programming/guides/cloudrun.md @@ -12,32 +12,31 @@ How to run: 1. Initialize a new workspace -```sh -cd ./cloud-run-app -dagger init -``` + ```sh + cd ./cloud-run-app + dagger init + ``` 2. Create a new environment -```sh -dagger new cloud-run-app -cp *.cue ./.dagger/env/cloud-run-app/plan/ -``` + ```sh + dagger new cloud-run-app + cp *.cue ./.dagger/env/cloud-run-app/plan/ + ``` 3. Configure the Cloud Run service -```sh -dagger input text serviceName MY_APP_NAME -dagger input text region MY_GCP_REGION -dagger input text image MY_GCR_IMAGE_NAME + ```sh + dagger input text serviceName MY_APP_NAME + dagger input text region MY_GCP_REGION + dagger input text image MY_GCR_IMAGE_NAME -dagger input text gcpConfig.project MY_GCP_PROJECT -dagger input secret gcpConfig.serviceKey -f MY_GCP_SERVICE_KEY_FILE - -``` + dagger input text gcpConfig.project MY_GCP_PROJECT + dagger input secret gcpConfig.serviceKey -f MY_GCP_SERVICE_KEY_FILE + ``` 4. Deploy! -```sh -dagger up -``` + ```sh + dagger up + ``` diff --git a/stdlib/.dagger/env/google-cloudrun/values.yaml b/stdlib/.dagger/env/google-cloudrun/values.yaml index 8da7d2a6..d9b91491 100644 --- a/stdlib/.dagger/env/google-cloudrun/values.yaml +++ b/stdlib/.dagger/env/google-cloudrun/values.yaml @@ -7,24 +7,24 @@ inputs: TestConfig.gcpConfig.region: text: us-west2 TestConfig.gcpConfig.serviceKey: - secret: ENC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65pktl4wj272gh7xl82ul3aaugppq6zxujg + - recipient: age1gxwmtwahzwdmrskhf90ppwlnze30lgpm056kuesrxzeuyclrwvpsupwtpk enc: | -----BEGIN AGE ENCRYPTED FILE----- - YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSA2eU4vTE0rY1NpOERvVEdv - YnoyZUVLLzVZeDdUZjk4eGdLTkFyZE9vNzBvCk9wYnZzWFJMRVpMajVkcjgvbWV5 - ZVlkZzlzSWIxa2JTOWxVV01DQXZkV00KLS0tIEJNcEhCdU9vQkVITjd4dGFTdHNI - SEwwZ05LUjRVcmhvVDltVEFUL255c3MKoXyFKSXJpu0wtgfUTc7a5qBxA8Mur6v1 - iV1TLQ9zNkKB2xnxNdUL8c6DplL1LPvkU/ogcnbm2JxwM8cGAFLFLw== + YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBFMkRmY0dVcWVieEg5QWNw + MVRxMXVjZXBqTnQ4bmNEK1FBSTdZckdJZWhzCmk4ZFhrUUJVYXU0V2V1MmdPVDIz + LzlBSHFrR0xIVFlMblNHN3EyZ2lHNWsKLS0tIFZPNVVDUUFzclRXYUwrdnVuUTJW + MS9KVmtwczR3R3luU3pzaExXdEVMck0KBDEHK2xu5xnaIuX3vxJV5kUVJvtdWXbs + UU1xOdXor67vnppQuydXjmS4KHj9sUuv7ZieJdb6ncnuNxClizlWYA== -----END AGE ENCRYPTED FILE----- - lastmodified: "2021-06-22T10:10:16Z" - mac: ENC[AES256_GCM,data:AdUtAYjBfMR405tsFJKQ/5chBqFUzwEWN3W2+e4uI0la5Wh481GyoEHsGoX56GaHFfHztgx0pY6e7UO+6NFIUC0m9/TW2uoa+R3n4WTHpb9gys/0KXwJZ0a1KYZDJJtK5fwsP7md3BSrp0jGPitZNzkLIvVmCXUgJ8UwhHsGFnk=,iv:4FzZdfeGn0CxibzS/lvwIUb98PlnFyrFDjcuiY30BbE=,tag:ijrgtqfh+vszSHmDnXdh5w==,type:str] + lastmodified: "2021-06-22T11:07:23Z" + mac: ENC[AES256_GCM,data:zFPKL0MUd4ln0RHypt9XUQtEK3hCzvUDIBjTnn5oqiCSkEw/IqRcCiRcpnJYiKep/U+zGuWbzKvKIaVYXBasCJrivltQDwd0cRqhPxl73MXBlJjB6JI2jlnoaUfg1F2Xxx48V9FYEva1v3RlQ0GscNz80ER1+f1zFH+mlIALtVI=,iv:yomz6lf6eAj8HCAnezHbgbgum+ekYkl6rojJnLq12uE=,tag:YLounxMcAvwjsK12k0DjuQ==,type:str] pgp: [] encrypted_suffix: secret version: 3.7.1 From dd73df5ef9832ff7bfec4503d9493492b2cef961 Mon Sep 17 00:00:00 2001 From: Tihomir Jovicic Date: Thu, 1 Jul 2021 09:15:04 +0200 Subject: [PATCH 13/18] Move CloudRun tests to stdlib/gcp/cloudrun Signed-off-by: Tihomir Jovicic --- stdlib/.dagger/env/google-cloudrun/values.yaml | 7 ++++--- stdlib/gcp/cloudrun/{main.cue => cloudrun.cue} | 0 .../plan => gcp/cloudrun/tests}/cloudrun.cue | 0 3 files changed, 4 insertions(+), 3 deletions(-) rename stdlib/gcp/cloudrun/{main.cue => cloudrun.cue} (100%) rename stdlib/{.dagger/env/google-cloudrun/plan => gcp/cloudrun/tests}/cloudrun.cue (100%) diff --git a/stdlib/.dagger/env/google-cloudrun/values.yaml b/stdlib/.dagger/env/google-cloudrun/values.yaml index d9b91491..72682a01 100644 --- a/stdlib/.dagger/env/google-cloudrun/values.yaml +++ b/stdlib/.dagger/env/google-cloudrun/values.yaml @@ -1,5 +1,6 @@ plan: - module: .dagger/env/google-cloudrun/plan + module: ./gcp/cloudrun/ + package: ./tests name: google-cloudrun inputs: TestConfig.gcpConfig.project: @@ -23,8 +24,8 @@ sops: MS9KVmtwczR3R3luU3pzaExXdEVMck0KBDEHK2xu5xnaIuX3vxJV5kUVJvtdWXbs UU1xOdXor67vnppQuydXjmS4KHj9sUuv7ZieJdb6ncnuNxClizlWYA== -----END AGE ENCRYPTED FILE----- - lastmodified: "2021-06-22T11:07:23Z" - mac: ENC[AES256_GCM,data:zFPKL0MUd4ln0RHypt9XUQtEK3hCzvUDIBjTnn5oqiCSkEw/IqRcCiRcpnJYiKep/U+zGuWbzKvKIaVYXBasCJrivltQDwd0cRqhPxl73MXBlJjB6JI2jlnoaUfg1F2Xxx48V9FYEva1v3RlQ0GscNz80ER1+f1zFH+mlIALtVI=,iv:yomz6lf6eAj8HCAnezHbgbgum+ekYkl6rojJnLq12uE=,tag:YLounxMcAvwjsK12k0DjuQ==,type:str] + lastmodified: "2021-07-01T07:05:02Z" + mac: ENC[AES256_GCM,data:JToQ5grcEkfvUPxMKTdSW2lx3B6oRJdOwduQA7/F+7GJweaAcsxc7LjMRCvEv2uoeUcWS7et/T3Nei9tk59lEPNjqLhHjF+Mc1lBJFZN2BXZiOhX58TEr+klfnmxAsLOiWFFubnlQxSoVv/GiiE9KCE7/sYo4Fs9siIhps4T+bM=,iv:YxLqCwJWGYkBtzC6XcAsuRGfszhYc0D50PyAbiLuXn4=,tag:ZXaPOH75+BSJWL0DOxsecw==,type:str] pgp: [] encrypted_suffix: secret version: 3.7.1 diff --git a/stdlib/gcp/cloudrun/main.cue b/stdlib/gcp/cloudrun/cloudrun.cue similarity index 100% rename from stdlib/gcp/cloudrun/main.cue rename to stdlib/gcp/cloudrun/cloudrun.cue diff --git a/stdlib/.dagger/env/google-cloudrun/plan/cloudrun.cue b/stdlib/gcp/cloudrun/tests/cloudrun.cue similarity index 100% rename from stdlib/.dagger/env/google-cloudrun/plan/cloudrun.cue rename to stdlib/gcp/cloudrun/tests/cloudrun.cue From ebc05170ea26ff50d534ac1de3bac15de471c57a Mon Sep 17 00:00:00 2001 From: Tihomir Jovicic Date: Thu, 1 Jul 2021 09:17:23 +0200 Subject: [PATCH 14/18] remove the cloudrun example Signed-off-by: Tihomir Jovicic --- examples/README.md | 340 ------------------ .../cloudrun-app/go-http-server/.dockerignore | 13 - .../cloudrun-app/go-http-server/Dockerfile | 33 -- examples/cloudrun-app/go-http-server/go.mod | 3 - examples/cloudrun-app/go-http-server/main.go | 35 -- 5 files changed, 424 deletions(-) delete mode 100644 examples/README.md delete mode 100644 examples/cloudrun-app/go-http-server/.dockerignore delete mode 100644 examples/cloudrun-app/go-http-server/Dockerfile delete mode 100644 examples/cloudrun-app/go-http-server/go.mod delete mode 100644 examples/cloudrun-app/go-http-server/main.go diff --git a/examples/README.md b/examples/README.md deleted file mode 100644 index 11ac2d75..00000000 --- a/examples/README.md +++ /dev/null @@ -1,340 +0,0 @@ -# Dagger Examples - -All example commands should be executed in the `examples/` directory -in an up-to-date checkout of the [dagger repository](https://github.com/dagger/dagger). - -## Deploy a static page to S3 - -This example shows how to generate a simple HTML page and serve it from an S3 bucket. - -Components: - -- [Amazon S3](https://aws.amazon.com/s3/) for hosting - -1. Initialize a new workspace - -```sh -cd ./simple-s3 -dagger init -``` - -2. Create a new environment - -```sh -dagger new simple-s3 -cp *.cue ./.dagger/env/simple-s3/plan/ -``` - -3. Configure your AWS credentials - -```sh -dagger input secret awsConfig.accessKey MY_AWS_ACCESS_KEY -dagger input secret awsConfig.secretKey MY_AWS_SECRET_KEY -``` - -4. Specify the source code location - -```sh -dagger input dir source website -``` - -5. Deploy! - -```sh -dagger up -``` - -6. Check the URL - -```sh -curl -i $(dagger query url -f text) -``` - -## Deploy a simple React application - -This example shows how to deploy an example React Application. [Read the deployment plan](https://github.com/dagger/dagger/tree/main/examples/react) - -Audience: Javascript developers looking to deploy their application. - -Components: - -- [Netlify](https://netlify.com) for application hosting -- [Yarn](https://yarnpkg.com) for building -- [Github](https://github.com) for source code hosting -- [React-Todo-App](https://github.com/kabirbaidhya/react-todo-app) by Kabir Baidhya as a sample application. - -1. Initialize a new workspace - -```sh -cd ./react -dagger init -``` - -2. Create a new environment - -```sh -dagger new react -cp *.cue ./.dagger/env/react/plan/ -``` - -3. Configure the deployment with your Netlify access token. - You can create new tokens from the [Netlify dashboard](https://app.netlify.com/user/applications/personal). - -```sh -dagger input secret www.account.token MY_TOKEN -``` - -_NOTE: there is a dedicated command for encrypted secret inputs, but it is -not yet implemented. Coming soon!_ - -4. Deploy! - -```sh -dagger up -``` - -## Deploy a complete JAMstack app - -This example shows how to deploy a complete app with a backend, a database and a frontend. - -This app assumes the following infrastructure is available: - -- AWS ECS Cluster -- AWS ALB with a TLS certificate -- AWS RDS Instance (MySQL or PostgreSQL) -- AWS ECR repository - -1. Initialize a new workspace - -```sh -cd ./jamstack -dagger init -``` - -2. Create a new environment - -```sh -dagger new jamstack -cp *.cue ./.dagger/env/jamstack/plan/ -``` - -3. Edit the inputs - -Edit the file `inputs.yaml` and review all values to match to your infrastructure. - -Add the inputs to the deployment: - -```sh -dagger input yaml "" -f ./inputs.yaml -``` - -4. Deploy! - -```sh -dagger up -``` - -The example `inputs.yaml` from the `./examples/jamstack` directory takes the source code from a remote git repository, but you can remove this from the file and instead points to a local source code: - -```sh -dagger input dir backend.source ./my/local/backend/code -``` - -And the same mechanism applies for every single key in this file. - -5. Get the App URL - -```sh -dagger query url -``` - -## Provision a Kubernetes cluster on AWS - -This example shows how to provision a new Kubernetes cluster on AWS, and configure your `kubectl` client to use it. [Read the deployment plan](https://github.com/dagger/dagger/tree/main/examples/kubernetes-aws) - -Audience: infrastructure teams looking to provisioning kubernetes clusters as part of automated CICD pipelines. - -Components: - -- [Amazon EKS](https://aws.amazon.com/eks) for Kubernetes hosting -- [Amazon CloudFormation](https://aws.amazon.com/cloudformation) for infrastructure provisioning -- [Kubectl](https://kubernetes.io/docs/tasks/tools/#kubectl) as kubernetes client - -1. Initialize a new workspace - -```sh -cd ./kubernetes-aws -dagger init -``` - -2. Create a new environment - -```sh -dagger new kubernetes-aws -cp *.cue ./.dagger/env/kubernetes-aws/plan/ -``` - -3. Configure the deployment with your AWS credentials - -```sh -dagger input secret awsConfig.accessKey MY_AWS_ACCESS_KEY -dagger input secret awsConfig.secretKey MY_AWS_SECRET_KEY -``` - -4. Deploy! - -```sh -dagger up -``` - -5. Export the generated kubectl config - -```sh -dagger query kubeconfig.kubeconfig | jq . > kubeconfig -``` - -## Add HTTP monitoring to your application - -This example shows how to implement a robust HTTP(s) monitoring service on top of AWS. [Read the deployment plan](https://github.com/dagger/dagger/tree/main/examples/monitoring). - -Audience: application team looking to improve the reliability of their application. - -Components: - -- [Amazon Cloudwatch Synthetics](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries.html) for hosting the monitoring scripts -- [Amazon CloudFormation](https://aws.amazon.com/cloudformation) for infrastructure provisioning - -1. Initialize a new workspace - -```sh -cd ./monitoring -dagger init -``` - -2. Create a new environment - -```sh -dagger new monitoring -cp *.cue ./.dagger/env/monitoring/plan/ -``` - -2. Configure the deployment with your AWS credentials - -```sh -dagger input text awsConfig.accessKey MY_AWS_ACCESS_KEY -dagger input text awsConfig.secretKey MY_AWS_SECRET_KEY -``` - -3. Configure the monitoring parameters - -```sh -dagger input text website https://MYWEBSITE.TLD -``` - -```sh -dagger input text email my_email@my_domain.tld -``` - -4. Deploy! - -```sh -dagger up -``` - -## Deploy an application to your Kubernetes cluster - -This example shows two different ways to deploy an application to an existing Kubernetes cluster: with and without a Helm chart. Read the deployment plan](https://github.com/dagger/dagger/tree/main/examples/kubernetes-app) - -NOTE: this example requires an EKS cluster to allow authentication with your AWS credentials; but can easily be adapter to deploy to any Kubernetes cluster. - -Components: - -- [Amazon EKS](https://aws.amazon.com/eks) for Kubernetes hosting -- [Kubectl](https://kubernetes.io/docs/tasks/tools/#kubectl) as kubernetes client -- [Helm](https://helm.sh) to manage kubernetes configuration (optional) - -How to run: - -1. Initialize a new workspace - -```sh -cd ./kubernetes-app -dagger init -``` - -2. Create a new environment - -```sh -dagger new kubernetes-app -cp *.cue ./.dagger/env/kubernetes-app/plan/ -``` - -3. Configure the deployment with your AWS credentials - -```sh -dagger input secret awsConfig.accessKey MY_AWS_ACCESS_KEY -dagger input secret awsConfig.secretKey MY_AWS_SECRET_KEY -``` - -4. Configure the EKS cluster to deploy to - -Note: if you have run the `kubernetes-aws` example, you may skip this step. - -```sh -dagger input text cluster.clusterName MY_CLUSTER_NAME -``` - -5. Load the Helm chart - -```sh -dagger input dir helmChart.chart ./testdata/mychart -``` - -6. Deploy! - -```sh -dagger up -``` - -## Deploy an application to GCP Cloud Run - -This example shows how to deploy an application to GCP Cloud Run. Read the deployment [plan](https://github.com/dagger/dagger/tree/main/examples/cloudrun-app) - -NOTE: this example requires the right GCP IAM permissions: `https://cloud.google.com/run/docs/reference/iam/roles#additional-configuration` - -Components: - -- [Cloud Run](https://cloud.google.com/run) - -How to run: - -1. Initialize a new workspace - -```sh -cd ./cloudrun-app -dagger init -``` - -2. Create a new environment - -```sh -dagger new cloudrun-app -cp main.cue ./.dagger/env/cloudrun-app/plan/ -``` - -3. Configure the Cloud Run service - -```sh -dagger input text serviceName MY_APP_NAME -dagger input text image MY_GCR_IMAGE_NAME - -dagger input text gcpConfig.project MY_GCP_PROJECT -dagger input text gcpConfig.region MY_GCP_REGION -dagger input secret gcpConfig.serviceKey -f MY_GCP_SERVICE_KEY_FILE -``` - -4. Deploy! - -```sh -dagger up -``` diff --git a/examples/cloudrun-app/go-http-server/.dockerignore b/examples/cloudrun-app/go-http-server/.dockerignore deleted file mode 100644 index 4cc30b02..00000000 --- a/examples/cloudrun-app/go-http-server/.dockerignore +++ /dev/null @@ -1,13 +0,0 @@ -# The .dockerignore file excludes files from the container build process. -# -# https://docs.docker.com/engine/reference/builder/#dockerignore-file - -# Exclude locally vendored dependencies. -vendor/ - -# Exclude "build-time" ignore files. -.dockerignore -.gcloudignore - -# Exclude git history and configuration. -.gitignore diff --git a/examples/cloudrun-app/go-http-server/Dockerfile b/examples/cloudrun-app/go-http-server/Dockerfile deleted file mode 100644 index 21e1f572..00000000 --- a/examples/cloudrun-app/go-http-server/Dockerfile +++ /dev/null @@ -1,33 +0,0 @@ -# Use the offical golang image to create a binary. -# This is based on Debian and sets the GOPATH to /go. -# https://hub.docker.com/_/golang -FROM golang:1.16-buster as builder - -# Create and change to the app directory. -WORKDIR /app - -# Retrieve application dependencies. -# This allows the container build to reuse cached dependencies. -# Expecting to copy go.mod and if present go.sum. -COPY go.* ./ -RUN go mod download - -# Copy local code to the container image. -COPY . ./ - -# Build the binary. -RUN go build -v -o server - -# Use the official Debian slim image for a lean production container. -# https://hub.docker.com/_/debian -# https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds -FROM debian:buster-slim -RUN set -x && apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ - ca-certificates && \ - rm -rf /var/lib/apt/lists/* - -# Copy the binary to the production image from the builder stage. -COPY --from=builder /app/server /app/server - -# Run the web service on container startup. -CMD ["/app/server"] diff --git a/examples/cloudrun-app/go-http-server/go.mod b/examples/cloudrun-app/go-http-server/go.mod deleted file mode 100644 index c7f4692c..00000000 --- a/examples/cloudrun-app/go-http-server/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module github.com/dagger-cloud-run-example - -go 1.16 diff --git a/examples/cloudrun-app/go-http-server/main.go b/examples/cloudrun-app/go-http-server/main.go deleted file mode 100644 index ced0a060..00000000 --- a/examples/cloudrun-app/go-http-server/main.go +++ /dev/null @@ -1,35 +0,0 @@ -// Sample run-helloworld is a minimal Cloud Run service. -package main - -import ( - "fmt" - "log" - "net/http" - "os" -) - -func main() { - log.Print("starting server...") - http.HandleFunc("/", handler) - - // Determine port for HTTP service. - port := os.Getenv("PORT") - if port == "" { - port = "8080" - log.Printf("defaulting to port %s", port) - } - - // Start HTTP server. - log.Printf("listening on port %s", port) - if err := http.ListenAndServe(":"+port, nil); err != nil { - log.Fatal(err) - } -} - -func handler(w http.ResponseWriter, r *http.Request) { - name := os.Getenv("NAME") - if name == "" { - name = "World" - } - fmt.Fprintf(w, "Hello %s!\n", name) -} From c2442120ca84e9e98a5456fcc01e42c487e455e5 Mon Sep 17 00:00:00 2001 From: Tihomir Jovicic Date: Thu, 1 Jul 2021 09:23:47 +0200 Subject: [PATCH 15/18] update cloudrun imports to use alpha.dagger.io Signed-off-by: Tihomir Jovicic --- docs/reference/universe/README.md | 1 + docs/reference/universe/gcp/cloudrun.md | 4 ++-- stdlib/gcp/cloudrun/cloudrun.cue | 4 ++-- stdlib/gcp/cloudrun/tests/cloudrun.cue | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/reference/universe/README.md b/docs/reference/universe/README.md index 139b2b41..c0458a15 100644 --- a/docs/reference/universe/README.md +++ b/docs/reference/universe/README.md @@ -14,6 +14,7 @@ - [docker](./docker/README.md) - Docker container operations - [docker/compose](./docker/compose.md) - Docker-compose operations - [gcp](./gcp/README.md) - Google Cloud Platform +- [gcp/cloudrun](./gcp/cloudrun.md) - - - [gcp/gcr](./gcp/gcr.md) - Google Container Registry - [gcp/gcs](./gcp/gcs.md) - Google Cloud Storage - [gcp/gke](./gcp/gke.md) - Google Kubernetes Engine diff --git a/docs/reference/universe/gcp/cloudrun.md b/docs/reference/universe/gcp/cloudrun.md index db97ed5b..85bfdfdb 100644 --- a/docs/reference/universe/gcp/cloudrun.md +++ b/docs/reference/universe/gcp/cloudrun.md @@ -2,10 +2,10 @@ sidebar_label: cloudrun --- -# dagger.io/gcp/cloudrun +# alpha.dagger.io/gcp/cloudrun ```cue -import "dagger.io/gcp/cloudrun" +import "alpha.dagger.io/gcp/cloudrun" ``` ## cloudrun.#Service diff --git a/stdlib/gcp/cloudrun/cloudrun.cue b/stdlib/gcp/cloudrun/cloudrun.cue index abae659b..705d834a 100644 --- a/stdlib/gcp/cloudrun/cloudrun.cue +++ b/stdlib/gcp/cloudrun/cloudrun.cue @@ -1,8 +1,8 @@ package cloudrun import ( - "dagger.io/dagger/op" - "dagger.io/gcp" + "alpha.dagger.io/dagger/op" + "alpha.dagger.io/gcp" ) // Service deploys a Cloud Run service based on provided GCR image diff --git a/stdlib/gcp/cloudrun/tests/cloudrun.cue b/stdlib/gcp/cloudrun/tests/cloudrun.cue index 7c8c37be..aa82cd67 100644 --- a/stdlib/gcp/cloudrun/tests/cloudrun.cue +++ b/stdlib/gcp/cloudrun/tests/cloudrun.cue @@ -1,8 +1,8 @@ package cloudrun import ( - "dagger.io/gcp" - "dagger.io/gcp/cloudrun" + "alpha.dagger.io/gcp" + "alpha.dagger.io/gcp/cloudrun" ) TestConfig: gcpConfig: gcp.#Config From 92278cfd5bf3eca187d76c483e69fbb47a013dda Mon Sep 17 00:00:00 2001 From: Tihomir Jovicic Date: Thu, 1 Jul 2021 10:14:06 +0200 Subject: [PATCH 16/18] move cloudrun guide to docs/learn Signed-off-by: Tihomir Jovicic --- .../cloudrun.md => learn/106-cloudrun.md} | 13 + docs/programming/programming.md | 242 ------------------ 2 files changed, 13 insertions(+), 242 deletions(-) rename docs/{programming/guides/cloudrun.md => learn/106-cloudrun.md} (80%) delete mode 100644 docs/programming/programming.md diff --git a/docs/programming/guides/cloudrun.md b/docs/learn/106-cloudrun.md similarity index 80% rename from docs/programming/guides/cloudrun.md rename to docs/learn/106-cloudrun.md index 61250308..04930c9f 100644 --- a/docs/programming/guides/cloudrun.md +++ b/docs/learn/106-cloudrun.md @@ -1,3 +1,15 @@ +--- +slug: /learn/106-cloudrun +--- + +# Dagger 106: deploy to CloudRun + +This tutorial illustrates how to use dagger to push and deploy Docker +images to CloudRun. + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + # Deploy an application to GCP Cloud Run This example shows how to deploy an application to GCP Cloud Run. Read the deployment [plan](https://github.com/dagger/dagger/tree/main/examples/cloud-run-app) @@ -40,3 +52,4 @@ How to run: ```sh dagger up ``` + diff --git a/docs/programming/programming.md b/docs/programming/programming.md deleted file mode 100644 index a0c8736c..00000000 --- a/docs/programming/programming.md +++ /dev/null @@ -1,242 +0,0 @@ ---- -sidebar_position: 1 -slug: /programming ---- - -# Programming - -## Writing your first Dagger plan - -1\. Initialize a Dagger workspace anywhere in your git repository: - -`dagger init` - -It will create a `.dagger` directory in your current directory with an empty `env` directory inside it: - -```bash -.dagger/ -└── env -``` - -2\. Create a new environment, for example `staging`: - -`dagger new staging` - -```bash -.dagger/ -└── env - └── staging - ├── plan - └── values.yaml - -``` - -3\. Create a new file [Cue](#programming-in-cue) config file in `.dagger/env/staging/plan`, and open it with any text editor or IDE: - -```bash -.dagger/ -└── env - └── staging - ├── plan - │   └── staging.cue - └── values.yaml - -``` - -4\. Describe each [relay](#relays) in your plan as a field in the Cue configuration: - -For example: - -```cue -package main - -import ( - "dagger.io/docker" - "dagger.io/git" -) - -// Relay for fetching a git repository -repo: git.#Repository & { - remote: "https://github.com/dagger/dagger" - ref: "main" -} - -// Relay for building a docker image -ctr: docker.#Build & { - source: repo -} -``` - -For more inspiration, see these examples: - -- [Deploy a static page to S3](https://github.com/dagger/dagger/blob/main/examples/README.md#deploy-a-static-page-to-s3) -- [Deploy a simple React application](https://github.com/dagger/dagger/blob/main/examples/README.md#deploy-a-simple-react-application) -- [Deploy a complete JAMstack app](https://github.com/dagger/dagger/blob/main/examples/README.md#deploy-a-complete-jamstack-app) -- [Provision a Kubernetes cluster on AWS](https://github.com/dagger/dagger/blob/main/examples/README.md#provision-a-kubernetes-cluster-on-aws) -- [Add HTTP monitoring to your application](https://github.com/dagger/dagger/blob/main/examples/README.md#add-http-monitoring-to-your-application) -- [Deploy an application to your Kubernetes cluster](https://github.com/dagger/dagger/blob/main/examples/README.md#deploy-an-application-to-your-kubernetes-cluster) -- [Deploy an application to GCP Cloud Run](https://github.com/dagger/dagger/blob/main/examples/README.md#deploy-an-application-to-gcp-cloud-run) - -5\. Extend your plan with relay definitions from [Dagger -Universe](https://github.com/dagger/dagger/tree/main/stdlib), an encyclopedia of -Cue packages curated by the Dagger community. - -6\. If you can't find the relay you need in the Universe, you can simply create your own. - -For example: - -```cue -import ( - "strings" -) - -// Create a relay definition which generates a greeting message -#Greeting: { - salutation: string | *"hello" - name: string | *"world" - message: "\(strings.ToTitle(salutation)), \(name)!" -} -``` - -You may then create any number of relays from the same definition: - -```cue -french: #Greeting & { - salutation: "bonjour" - name: "monde" -} - -american: #Greeting & { - salutation: "hi" - name: "y'all" -} -``` - -## Programming in Cue - -[Cue](https://cuelang.org) is a next-generation data language by Marcel van Lohuizen and the spiritual successor -of GCL, the language used to configure all of Google's infrastructure. - -Cue extends JSON with powerful features: - -- Composition: layering, templating, references -- Correctness: types, schemas -- Developer experience: comments, packages, first-class tooling, builtin functions -- And much more. - -To get started with Cue, we recommend the following resources: - -- [Cuetorials](https://cuetorials.com) -- [Cue playground](https://cuelang.org/play) - -## Concepts - -### Overview - -1. A developer writes a _plan_ specifying how to deliver their application. Plans are written in the [Cue](https://cuelang.org) data language. -2. Dagger executes plans in isolated _environments_. Each environment has its own configuration and state. - -### Plans - -A _plan_ specifies, in code, how to deliver a particular application in a particular way. - -It lays out the application's supply chain as a graph of interconnected nodes: - -- Development tools: source control, CI, build systems, testing systems -- Hosting infrastructure: compute, storage, networking, databases, CDN.. -- Software dependencies: operating systems, languages, libraries, frameworks, etc. - -The graph models the flow of code and data through the supply chain: - -- source code flows from a git repository to a build system; -- system dependencies are combined in a docker image, then uploaded to a registry; -- configuration files are generated then sent to a compute cluster or load balancer; -- etc. - -Dagger plans are written in [Cue](https://cuelang.org), a powerful declarative language by the creator of GQL, the language used to deploy all applications at Google. - -### Environments - -An _environment_ is a live implementation of a _plan_, with its own user inputs and state. -The same plan can be executed in multiple environments, for example to differentiate production from staging. - -An environment can be updated with `dagger up`. When updating an environment, Dagger determines which inputs have -changed since the last update, and runs them through the corresponding pipelines to produce new outputs. - -For example, if an application has a new version of its frontend source code available, but no changes to -the frontend, it will build, test and deploy the new frontend, without changing the backend. - -### Relays - -_Relays_ are the basic components of a _plan_. Each relay is a node in the graph defined by the plan, -performing the task assigned to that node. For example one relay fetches source code; another runs a build; -another uploads a container image; etc. - -Relays are standalone software components: they are defined in [Cue](https://cuelang.org/), but can -execute code in any language using the [Dagger pipeline -API](https://github.com/dagger/dagger/blob/main/stdlib/dagger/op/op.cue). - -A relay is made of 3 parts: - -- Inputs: data received from the user, or upstream relays -- A processing pipeline: code executed against each new input, using the - [pipeline - API](https://github.com/dagger/dagger/blob/main/stdlib/dagger/op/op.cue) -- Outputs: data produced by the processing pipeline - -Relays run in parallel, with their inputs and outputs interconnected into a special kind of graph, -called a _DAG_. When a relay receives a new input, it runs it through the processing pipeline, -and produces new outputs, which are propagated to downstream relays as inputs, and so on. - -### Using third-party relays - -Cue includes a complete package system. This makes it easy to create a complex plan in very few -lines of codes, simply by importing relays from third-party packages. - -For example, to create a plan involving Github, Heroku and Amazon RDS, one might import the three -corresponding packages: - -```cue -import ( - "dagger.io/github" - "dagger.io/heroku" - "dagger.io/amazon/rds" -) - -repo: github.#Repository & { - // Github configuration values -} - -backend: heroku.#App & { - // Heroku configuration values -} - -db: rds.#Database & { - // RDS configuration values -} -``` - -### Creating a new relay - -Sometimes there is no third-party relay available for a particular task in your workflow; or it may exist but need to be customized. - -A relay is typically contained in a [cue definition](https://cuetorials.com/overview/foundations/#definitions), with the definition name describing its function. -For example a relay for a git repository might be defined as `#Repository`. - -The processing pipeline is a crucial feature of Dagger. It uses the [LLB](https://github.com/moby/buildkit) -executable format pioneered by the BuildKit project. It allows Dagger components to run -sophisticated pipelines to ingest produce artifacts such as source code, binaries, database exports, etc. -Best of all, LLB pipelines can securely build and run any docker container, effectively making Dagger -scriptable in any language. - -### Docker compatibility - -Thanks to its native support of LLB, Dagger offers native compatibility with Docker. - -This makes it very easy to extend an existing Docker-based workflow, including: - -- Reusing Dockerfiles and docker-compose files without modification -- Wrapping other deployment tools in a Dagger relay by running them inside a container -- Robust multi-arch and multi-OS support, including Arm and Windows. -- Integration with existing Docker engines and registries -- Integration with Docker for Mac and Docker for Windows on developer machines From 31714de4e3345555d34412b812085d46790db962 Mon Sep 17 00:00:00 2001 From: Tihomir Jovicic Date: Mon, 5 Jul 2021 12:40:45 +0200 Subject: [PATCH 17/18] Update Cloud Run docs Signed-off-by: Tihomir Jovicic --- docs/learn/106-cloudrun.md | 122 ++++++++++++++++++------- stdlib/gcp/cloudrun/cloudrun.cue | 8 +- stdlib/gcp/cloudrun/tests/cloudrun.cue | 4 +- 3 files changed, 99 insertions(+), 35 deletions(-) diff --git a/docs/learn/106-cloudrun.md b/docs/learn/106-cloudrun.md index 04930c9f..2a954c05 100644 --- a/docs/learn/106-cloudrun.md +++ b/docs/learn/106-cloudrun.md @@ -2,54 +2,114 @@ slug: /learn/106-cloudrun --- -# Dagger 106: deploy to CloudRun +# Dagger 106: deploy to Cloud Run -This tutorial illustrates how to use dagger to push and deploy Docker -images to CloudRun. +This tutorial illustrates how to use Dagger to build, push and deploy Docker images to Cloud Run. import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; -# Deploy an application to GCP Cloud Run +## Initialize a Dagger Workspace and Environment -This example shows how to deploy an application to GCP Cloud Run. Read the deployment [plan](https://github.com/dagger/dagger/tree/main/examples/cloud-run-app) +### (optional) Setup example app -NOTE: this example requires an EKS cluster to allow authentication with your AWS credentials; but can easily be adapter to deploy to any Kubernetes cluster. +You will need the local copy of the [Dagger examples repository](https://github.com/dagger/examples) used in previous guides -Components: +```shell +git clone https://github.com/dagger/examples +``` -- [Cloud Run](https://cloud.google.com/run) +Make sure that all commands are being ran from the todoapp directory: -How to run: +```shell +cd examples/todoapp +``` -1. Initialize a new workspace +### (optional) Initialize a Cue module - ```sh - cd ./cloud-run-app - dagger init - ``` +In this guide we will use the same directory as the root of the Dagger workspace and the root of the Cue module; but you can create your Cue module anywhere inside the Dagger workspace. -2. Create a new environment +```shell +cue mod init +``` - ```sh - dagger new cloud-run-app - cp *.cue ./.dagger/env/cloud-run-app/plan/ - ``` +### Organize your package -3. Configure the Cloud Run service +Let's create a new directory for our Cue package: - ```sh - dagger input text serviceName MY_APP_NAME - dagger input text region MY_GCP_REGION - dagger input text image MY_GCR_IMAGE_NAME +```shell +mkdir cue.mod/gcpcloudrun +``` - dagger input text gcpConfig.project MY_GCP_PROJECT - dagger input secret gcpConfig.serviceKey -f MY_GCP_SERVICE_KEY_FILE - ``` +### Create a basic plan -4. Deploy! +```cue title="todoapp/cue.mod/gcpcloudrun/source.cue" +package gcpcloudrun - ```sh - dagger up - ``` +import ( + "alpha.dagger.io/dagger" + "alpha.dagger.io/docker" + "alpha.dagger.io/gcp" + "alpha.dagger.io/gcp/cloudrun" + "alpha.dagger.io/gcp/gcr" +) +// Source code of the sample application +src: dagger.#Artifact & dagger.#Input + +// GCR full image name +imageRef: string & dagger.#Input + +image: docker.#Build & { + source: src +} + +gcpConfig: gcp.#Config + +creds: gcr.#Credentials & { + config: gcpConfig +} + +push: docker.#Push & { + target: imageRef + source: image + auth: { + username: creds.username + secret: creds.secret + } +} + +deploy: cloudrun.#Service & { + config: gcpConfig + image: push.ref +} +``` + +## Set up the environment + +### Create a new environment + +Now that your Cue package is ready, let's create an environment to run it: + +```shell +dagger new 'gcpcloudrun' -m cue.mod/gcpcloudrun +``` + +### Configure user inputs + +```shell +dagger input dir src . -e gcpcloudrun +dagger input text deploy.name todoapp -e gcpcloudrun +dagger input text imageRef gcr.io//todoapp -e gcpcloudrun +dagger input text gcpConfig.region us-west2 -e gcpcloudrun +dagger input text gcpConfig.project -e gcpcloudrun +dagger input secret gcpConfig.serviceKey -f ./gcp-sa-key.json -e gcpcloudrun +``` + +## Deploy + +Now that everything is properly set, let's deploy on Cloud Run: + +```shell +dagger up -e gcpcloudrun +``` diff --git a/stdlib/gcp/cloudrun/cloudrun.cue b/stdlib/gcp/cloudrun/cloudrun.cue index 705d834a..ada3fdf0 100644 --- a/stdlib/gcp/cloudrun/cloudrun.cue +++ b/stdlib/gcp/cloudrun/cloudrun.cue @@ -10,7 +10,7 @@ import ( // GCP Config config: gcp.#Config - // service name + // Cloud Run service name name: string @dagger(input) // GCR image ref @@ -19,6 +19,9 @@ import ( // Cloud Run platform platform: *"managed" | string @dagger(input) + // Cloud Run service exposed port + port: *"80" | string @dagger(input) + #up: [ op.#Load & { from: gcp.#GCloud & { @@ -35,7 +38,7 @@ import ( "pipefail", "-c", #""" - gcloud run deploy "$SERVICE_NAME" --image "$IMAGE" --region "$REGION" --platform "$PLATFORM" --allow-unauthenticated + gcloud run deploy "$SERVICE_NAME" --image "$IMAGE" --region "$REGION" --port "$PORT" --platform "$PLATFORM" --allow-unauthenticated """#, ] env: { @@ -43,6 +46,7 @@ import ( PLATFORM: platform REGION: config.region IMAGE: image + PORT: port } }, ] diff --git a/stdlib/gcp/cloudrun/tests/cloudrun.cue b/stdlib/gcp/cloudrun/tests/cloudrun.cue index aa82cd67..18112608 100644 --- a/stdlib/gcp/cloudrun/tests/cloudrun.cue +++ b/stdlib/gcp/cloudrun/tests/cloudrun.cue @@ -9,6 +9,6 @@ TestConfig: gcpConfig: gcp.#Config TestCloudRun: deploy: cloudrun.#Service & { config: TestConfig.gcpConfig - name: "cloudrun-test" - image: "gcr.io/dagger-ci/cloudrun-test:latest" + name: "todoapp" + image: "gcr.io/dagger-ci/todoapp:latest" } From 25ff825f7437833bd08f8cf349f68247b288f3ae Mon Sep 17 00:00:00 2001 From: Tihomir Jovicic Date: Mon, 5 Jul 2021 12:43:26 +0200 Subject: [PATCH 18/18] Update Cloud Run docs Signed-off-by: Tihomir Jovicic --- docs/learn/106-cloudrun.md | 20 ++++++++++---------- docs/reference/universe/gcp/cloudrun.md | 17 +++++++++-------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/docs/learn/106-cloudrun.md b/docs/learn/106-cloudrun.md index 2a954c05..96aec4ca 100644 --- a/docs/learn/106-cloudrun.md +++ b/docs/learn/106-cloudrun.md @@ -61,27 +61,27 @@ src: dagger.#Artifact & dagger.#Input imageRef: string & dagger.#Input image: docker.#Build & { - source: src + source: src } gcpConfig: gcp.#Config creds: gcr.#Credentials & { - config: gcpConfig + config: gcpConfig } push: docker.#Push & { - target: imageRef - source: image - auth: { - username: creds.username - secret: creds.secret - } + target: imageRef + source: image + auth: { + username: creds.username + secret: creds.secret + } } deploy: cloudrun.#Service & { - config: gcpConfig - image: push.ref + config: gcpConfig + image: push.ref } ``` diff --git a/docs/reference/universe/gcp/cloudrun.md b/docs/reference/universe/gcp/cloudrun.md index 85bfdfdb..74bc240b 100644 --- a/docs/reference/universe/gcp/cloudrun.md +++ b/docs/reference/universe/gcp/cloudrun.md @@ -14,14 +14,15 @@ Service deploys a Cloud Run service based on provided GCR image ### cloudrun.#Service Inputs -| Name | Type | Description | -| ------------- |:-------------: |:-------------: | -|*config.region* | `string` |GCP region | -|*config.project* | `string` |GCP project | -|*config.serviceKey* | `dagger.#Secret` |GCP service key | -|*name* | `string` |service name | -|*image* | `string` |GCR image ref | -|*platform* | `*"managed" \| string` |Cloud Run platform | +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*config.region* | `string` |GCP region | +|*config.project* | `string` |GCP project | +|*config.serviceKey* | `dagger.#Secret` |GCP service key | +|*name* | `string` |Cloud Run service name | +|*image* | `string` |GCR image ref | +|*platform* | `*"managed" \| string` |Cloud Run platform | +|*port* | `*"80" \| string` |Cloud Run service exposed port | ### cloudrun.#Service Outputs