-
Notifications
You must be signed in to change notification settings - Fork 92
/
integration.cloudbuild.yaml
88 lines (70 loc) · 2.98 KB
/
integration.cloudbuild.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
steps:
- id: build go
name: golang:${_VERSION}
env:
- CGO_ENABLED=0
- GOOS=linux
args:
[
"go",
"build",
"-o",
"/workspace/cloudshell_open",
"./cmd/cloudshell_open",
]
- id: docker build
name: "gcr.io/cloud-builders/docker"
args: ["build", "-t", "gcr.io/$PROJECT_ID/button", "."]
- id: docker push
name: "gcr.io/cloud-builders/docker"
args: ["push", "gcr.io/$PROJECT_ID/button"]
- id: image validation
name: "gcr.io/cloudshell-images/custom-image-validation"
args: ["image_test.py", "--image", "gcr.io/$PROJECT_ID/button"]
- id: run tests
name: gcr.io/$PROJECT_ID/button
env:
- "DEBUG=${_DEBUG}"
- "GOOGLE_CLOUD_PROJECT=$PROJECT_ID"
- "GOOGLE_CLOUD_REGION=${_REGION}"
- "GIT_BRANCH=${BRANCH_NAME}"
- "PYTHONUNBUFFERED=true"
- "TEST_CMD=python3 tests/run_integration_test.py deploy --repo_url $_REPO_URL --repo_branch $_REPO_BRANCH"
script: |
#!/bin/bash -e
gcloud version
pip3 install -r tests/requirements.txt --user
$TEST_CMD --description "no config" --directory empty-appjson --expected_text 'hello, world'
$TEST_CMD --description "inline hooks" --directory hooks-prepostcreate-inline --expected_text 'AB'
$TEST_CMD --description "external hooks" --directory hooks-prepostcreate-external --expected_text '3'
$TEST_CMD --description "external hooks, dirty" --directory hooks-prepostcreate-external --expected_text '3' --dirty
$TEST_CMD --description "generator" --directory envvars-generated
GEN_URL=$(gcloud run services describe envvars-generated --region $GOOGLE_CLOUD_REGION --format "value(status.url)")
OUTPUT=$(curl $GEN_URL --silent)
$TEST_CMD --description "generator, dirty" --directory envvars-generated --dirty --expected_text $OUTPUT
$TEST_CMD --description "options" --directory options --expected_text 'hello, world'
$TEST_CMD --description "options - http2" --directory options-http2 --expected_text 'hello, world'
$TEST_CMD --description "options - require auth" --directory options-require-auth --expected_status 403
$TEST_CMD --description "custom buildpacks" --directory buildpacks-builder --expected_text 'hello, world'
- id: cleanup
name: 'gcr.io/google.com/cloudsdktool/cloud-sdk:slim'
env:
- "GOOGLE_CLOUD_REGION=${_REGION}"
script: |
#!/bin/bash -e
gcloud run services list --region $GOOGLE_CLOUD_REGION
for service in $(gcloud run services list --region $GOOGLE_CLOUD_REGION --format "value(name)"); do
echo "🧹 Cleaning up $service"
gcloud run services delete $service --region $GOOGLE_CLOUD_REGION --quiet
done;
timeout: "3600s"
substitutions:
_VERSION: "1.21"
_REGION: us-central1
_REPO_URL: https://github.com/GoogleCloudPlatform/cloud-run-button
_REPO_BRANCH: master
_DEBUG: ""
options:
machineType: "N1_HIGHCPU_32"
dynamic_substitutions: true
logsBucket: ${PROJECT_ID}-buildlogs