1006 test implementation
Signed-off-by: Guillaume de Rouville <guillaume.derouville@gmail.com>
This commit is contained in:
parent
82d45985a5
commit
6744045ce7
@ -43,46 +43,7 @@ mkdir gcpcloudrun
|
||||
|
||||
### Create a basic plan
|
||||
|
||||
```cue title="todoapp/gcpcloudrun/source.cue"
|
||||
package gcpcloudrun
|
||||
|
||||
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
|
||||
}
|
||||
```cue file=./tests/gcpcloudrun/source.cue title="todoapp/cue.mod/gcpcloudrun/source.cue"
|
||||
```
|
||||
|
||||
## Set up the environment
|
||||
|
2
docs/learn/tests/.dagger/env/gcpcloudrun/.gitignore
vendored
Normal file
2
docs/learn/tests/.dagger/env/gcpcloudrun/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
# dagger state
|
||||
state/**
|
34
docs/learn/tests/.dagger/env/gcpcloudrun/values.yaml
vendored
Normal file
34
docs/learn/tests/.dagger/env/gcpcloudrun/values.yaml
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
plan:
|
||||
package: ./gcpcloudrun
|
||||
name: gcpcloudrun
|
||||
inputs:
|
||||
deploy.name:
|
||||
text: test-cloudrun-doc
|
||||
gcpConfig.project:
|
||||
text: dagger-ci
|
||||
gcpConfig.region:
|
||||
text: us-west2
|
||||
gcpConfig.serviceKey:
|
||||
secret: ENC[AES256_GCM,data:Uxivg7fNTD6LrnTEKYmN7RkGuGIp2VyUqEVcnCnQjGzPdKLOd9ExpB/KoA6O6Vut2Mo/oG2+Dz0J/nhR5zH35bdsfDaNHs84xqrDDBW5MkILvEHS30O24lSS75CKJljhWpEM2D+LqHCegPwrMxunHTIpZXMF78A0oEBXJSbqtpMIJY/R8rMRMcZ8jAIOLn+JMbJrcBP8SiYow478G9B/Rd5lFjDQyPp5y5FBc4/xdgDYccJLLufZsuC1ABJjpFcovpF6wXwby0hY08mY6cyynIisf8Qhvyxu2srNW6UYTf9kSmgCw+exPo20i1kYNu/WhgsLIr30k5axOoRaMbBKYFzw/+SeeedNIlVbmykYT5xEllR1MGFea9cg1H6DwINQfL/CSJ6Ai7Uj5LyErhh9ZoYinUzklFQYWh52oOqIO+nCuKCrKpkLK2wY8W1WeK95IDMyLdvrkGcprQcCFaaBLs/HthWPXWwxaXEaRycTG3tqV+AFKuyN9chFLBVEVX6gUbexovGpK78oPhTVcJlDFMHEkve06HvbeV5T8Ee0Qpbqgzqx+wjbvSbYPumd+hd7OLHNMIOgfDp+UXPk1DwpXuRMBn0l4Pp9hoMzjZ8MCAU1aEismctWKbNj8OeqOexn1Rhkrx66+MLCRgg27Lpqsi2u1yFXtOxO0oHNm8+H7CwUFXbYERDnwG98mR7GUeprgbStMTI9VhhoKOZvzXRoHKExpgLrreUlYkF2b8NowiMe4OEp8GmCafC/z3IjtAFaMnY5+Z4mGCCVihgySTQRhNrrniUdZJJWTvfKk7GVIknF8QhkyGCIkkr1wUF4HYPAXhbUx3WcSIhegJFUwO98MEyb8kn+IkLI9gu0/VtBqzzvVRqDazWB07QADflPrSqGVt4PkX27cUeVkcUY8HjOR3FhvG58QHCGGOFmrZJU4eOrMcyYpMBSTlk9KXVI1uma2VV7mYIvITMmN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gA0NxTAP6ckw=,tag:Jt6C/CSNFcZAb1oqQP7h0A==,type:str]
|
||||
imageRef:
|
||||
text: gcr.io/dagger-ci/test-cloudrun-doc
|
||||
sops:
|
||||
kms: []
|
||||
gcp_kms: []
|
||||
azure_kv: []
|
||||
hc_vault: []
|
||||
age:
|
||||
- recipient: age1gxwmtwahzwdmrskhf90ppwlnze30lgpm056kuesrxzeuyclrwvpsupwtpk
|
||||
enc: |
|
||||
-----BEGIN AGE ENCRYPTED FILE-----
|
||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBaTkF6bUFZVXZmQ1ZlV1cx
|
||||
dDVEUnZiRVBOanlNb1lHVU9BdDVjV01QeDNvCjZmV1ZKckE2eVpYS0JHU0l4V0VW
|
||||
NDdpVHloQjRWM01Kak81Z1dKZnB2UnMKLS0tIE1rZmo5YkFCUjZ5VVJXcmt0YlU1
|
||||
bnhOalppZXdFbFArTndlWnU1TUZDOFkKY4irnpH33+GagucvGkVcEw1KKCJivlCW
|
||||
rpLd+7EE5bXheiHFphtXTtkUIDCkbC4nTAJ1/37iEKrWsRRFv/CL/g==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
lastmodified: "2021-08-13T00:57:43Z"
|
||||
mac: ENC[AES256_GCM,data:2Pk+6XFyPayexXsUFbDIXG/m6O7WkttraML4D0Y74XKsIjoq8gqNSAJrRmF+brw58j4F2h28PScp8t068byA97QIaWG8Q201vCJ6bpgMcZ4OEXRTLMuoZtpDLa9AoOT/rBaSIu7G5uA4oivVkfed90Nuq5+TGBSp/+me81679us=,iv:gUMpTjR0TwFonLed1fdegaRXtM4NghdZxVjGPJRdLSM=,tag:5SW7uAabLrrNx4h2Tf+9Ww==,type:str]
|
||||
pgp: []
|
||||
encrypted_suffix: secret
|
||||
version: 3.7.1
|
@ -59,3 +59,22 @@ setup() {
|
||||
run curl $url
|
||||
assert_output --partial "./static/css/main.9149988f.chunk.css"
|
||||
}
|
||||
|
||||
@test "doc-1006-google-cloud-run" {
|
||||
setup_example_sandbox "doc"
|
||||
|
||||
mkdir gcpcloudrun
|
||||
cp $CODEBLOC_SRC/gcpcloudrun/source.cue gcpcloudrun
|
||||
|
||||
# Initialize new env
|
||||
dagger new 'gcpcloudrun' -p gcpcloudrun
|
||||
|
||||
# Copy corresponding env
|
||||
cp -r $CODEBLOC_SRC/.dagger/env/gcpcloudrun .dagger/env/
|
||||
# Add missing src input
|
||||
dagger -e gcpcloudrun input dir src .
|
||||
|
||||
# Run test
|
||||
run dagger -e gcpcloudrun up
|
||||
assert_success
|
||||
}
|
39
docs/learn/tests/gcpcloudrun/source.cue
Normal file
39
docs/learn/tests/gcpcloudrun/source.cue
Normal file
@ -0,0 +1,39 @@
|
||||
package gcpcloudrun
|
||||
|
||||
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
|
||||
}
|
Reference in New Issue
Block a user