File: cloudbuild.yaml

package info (click to toggle)
trillian 1.7.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,600 kB
  • sloc: sh: 1,181; javascript: 474; sql: 330; makefile: 39
file content (187 lines) | stat: -rw-r--r-- 5,158 bytes parent folder | download | duplicates (2)
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# This file contains Google Cloud Build configuration for presubmit checks, unit
# and integration tests, triggered by pull requests and commits to branches.

timeout: 1800s
substitutions:
  _CODECOV_TOKEN: "" # The auth token for uploading coverage to Codecov.
options:
  machineType: E2_HIGHCPU_32
  volumes:
  # A shared volume for caching Go modules between steps.
  - name: go-modules
    path: /go
  env:
    - GOPATH=/go
    - GOLANG_PROTOBUF_REGISTRATION_CONFLICT=ignore # Temporary work-around v1.proto already registered error.
    - DOCKER_CLIENT_TIMEOUT=120
    - COMPOSE_HTTP_TIMEOUT=120

# Cache the testbase image in Container Regisrty, to be reused by subsequent
# builds. The technique is described here:
# https://cloud.google.com/cloud-build/docs/speeding-up-builds#using_a_cached_docker_image
#
# TODO(pavelkalinnikov): Consider pushing this image only on commits to master.
images: ['gcr.io/$PROJECT_ID/trillian_testbase:latest']

# Cloud Build logs sent to GCS bucket
logsBucket: 'gs://trillian-cloudbuild-logs'

steps:

# Try to pull the testbase image from Container Registry.
- name: 'gcr.io/cloud-builders/docker'
  entrypoint: 'bash'
  args: ['-c', 'docker pull gcr.io/$PROJECT_ID/trillian_testbase:latest || exit 0']
# Build the testbase image reusing as much of the cached image as possible.
- name: 'gcr.io/cloud-builders/docker'
  args: [
    'build',
    '-t', 'gcr.io/$PROJECT_ID/trillian_testbase:latest',
    '--cache-from', 'gcr.io/$PROJECT_ID/trillian_testbase:latest',
    '-f', './integration/cloudbuild/testbase/Dockerfile',
    '.'
  ]

# Set up tools and any other common steps which should not be part of Docker image.
- id: prepare
  name: 'gcr.io/${PROJECT_ID}/trillian_testbase'
  entrypoint: ./integration/cloudbuild/prepare.sh

# Run porcelain checks, make sure the diff is empty and no files need
# to be updated. This includes gofmt, go mod tidy, go mod generate
# and a few more.
- id: check
  name: 'gcr.io/${PROJECT_ID}/trillian_testbase'
  entrypoint: ./scripts/presubmit.sh
  args:
    - --no-build
    - --no-linters
    - --fix
    - --no-mod-tidy
    - --empty-diff
  waitFor:
    - prepare

# Presubmit
- id: presubmit
  name: 'gcr.io/${PROJECT_ID}/trillian_testbase'
  entrypoint: ./integration/cloudbuild/run_presubmit.sh
  args:
    - --no-linters
    - --no-generate
  env:
    - GOFLAGS=-race
    - GO_TEST_TIMEOUT=20m
  waitFor:
    - check

# Codecov
- id: codecov
  name: 'gcr.io/${PROJECT_ID}/trillian_testbase'
  entrypoint: ./integration/cloudbuild/run_presubmit.sh
  args:
    - --coverage
    - --no-linters
    - --no-generate
  env:
    - GOFLAGS=-race
    - GO_TEST_TIMEOUT=20m
    - CODECOV_TOKEN=${_CODECOV_TOKEN}
  waitFor:
    - check

# Presubmit (Batched queue)
- id: presubmit_batched
  name: 'gcr.io/${PROJECT_ID}/trillian_testbase'
  entrypoint: ./integration/cloudbuild/run_presubmit.sh
  args:
    - --no-linters
    - --no-generate
  env:
    - GOFLAGS=-race --tags=batched_queue
    - GO_TEST_TIMEOUT=20m
  waitFor:
    - check

# Presubmit (PKCS11)
- id: presubmit_pkcs11
  name: 'gcr.io/${PROJECT_ID}/trillian_testbase'
  entrypoint: ./integration/cloudbuild/run_presubmit.sh
  args:
    - --no-linters
    - --no-generate
  env:
    - GOFLAGS=-race --tags=pkcs11
    - GO_TEST_TIMEOUT=20m
  waitFor:
    - check

# Try to spread the load a bit, we'll wait for all the presubmit.* steps
# to finish before starting the integration.* ones.
# Having too many "big" things running concurrently leads to problems
# with timeouts and mysql issues.
- id: presubmits_done
  name: 'gcr.io/${PROJECT_ID}/trillian_testbase'
  entrypoint: /bin/true
  waitFor:
    - codecov
    - presubmit
    - presubmit_batched
    - presubmit_pkcs11

# Integration
- id: integration
  name: 'gcr.io/${PROJECT_ID}/trillian_testbase'
  entrypoint: ./integration/cloudbuild/run_integration.sh
  env:
    - GO_TEST_TIMEOUT=20m
  waitFor:
    - presubmits_done

# Integration (Docker)
- id: integration_docker
  name: 'gcr.io/${PROJECT_ID}/trillian_testbase'
  entrypoint: ./integration/docker_compose_integration_test.sh
  waitFor:
    - presubmits_done

# Integration (etcd)
- id: integration_etcd
  name: 'gcr.io/${PROJECT_ID}/trillian_testbase'
  entrypoint: ./integration/cloudbuild/run_integration.sh
  env:
    - ETCD_DIR=/go/bin
    - GOFLAGS=-race
    - GO_TEST_TIMEOUT=20m
  waitFor:
    - presubmits_done

# Integration (Batched queue)
- id: integration_batched
  name: 'gcr.io/${PROJECT_ID}/trillian_testbase'
  entrypoint: ./integration/cloudbuild/run_integration.sh
  env:
    - GOFLAGS=-race -tags=batched_queue
    - GO_TEST_TIMEOUT=20m
  waitFor:
    - presubmits_done

# Integration (PKCS11)
- id: integration_pkcs11
  name: 'gcr.io/${PROJECT_ID}/trillian_testbase'
  entrypoint: ./integration/cloudbuild/run_integration.sh
  env:
    - GOFLAGS=-race -tags=pkcs11
    - GO_TEST_TIMEOUT=20m
  waitFor:
    - presubmits_done

# Integration (MariaDB)
- id: integration_mariadb
  name: 'gcr.io/${PROJECT_ID}/trillian_testbase'
  entrypoint: ./integration/cloudbuild/run_integration.sh
  env:
    - GO_TEST_TIMEOUT=20m
    - MYSQLD_IMAGE=mariadb:11.1
  waitFor:
    - presubmits_done