-
Notifications
You must be signed in to change notification settings - Fork 43
/
cloudbuild.yaml
64 lines (60 loc) · 2.34 KB
/
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
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
timeout: 10800s
options:
machineType: 'N1_HIGHCPU_32'
diskSizeGb: 100
logStreamingOption: STREAM_ON
logsBucket: 'gs://bazel_rules_hdl'
steps:
# Access secrets from Secret Manager
- name: gcr.io/cloud-builders/gcloud
entrypoint: 'bash'
args:
- '-c'
- |
gcloud secrets versions access latest --secret=buildbuddy-cert > /root/.ssh/buildbuddy-cert.pem
gcloud secrets versions access latest --secret=buildbuddy-key > /root/.ssh/buildbuddy-key.pem
gcloud secrets versions access latest --secret=github-app-key-cloud-build-status-reporter > /root/.ssh/github-app-key-cloud-build-status-reporter.pem
volumes:
- name: 'ssh'
path: /root/.ssh
# Run the build
- name: gcr.io/cloud-builders/bazel:6.4.0
entrypoint: 'bash'
args:
- '-c'
- |
set -e
BUILD_INVOCATION_ID=$(python3 tools/generate_uuid.py)
TEST_INVOCATION_ID=$(python3 tools/generate_uuid.py)
echo STATUS: Reporting logs with build invocation id $$BUILD_INVOCATION_ID and test invocation id $$TEST_INVOCATION_ID to GitHub.
bazel run --config=ciremotebuild //tools:report_status_to_github -- \
--head_sha=${COMMIT_SHA} \
--build_invocation_id=$$BUILD_INVOCATION_ID \
--test_invocation_id=$$TEST_INVOCATION_ID \
--github_app_key_file=/root/.ssh/github-app-key-cloud-build-status-reporter.pem
echo STATUS: Reported logs to GitHub.
EXTRA_BAZEL_ARGS="--build_metadata=USER=${_USERNAME} \
--config=ciremotebuild \
--bes_results_url=https://app.buildbuddy.io/invocation/" \
EXTRA_BUILD_BAZEL_ARGS="--invocation_id=$$BUILD_INVOCATION_ID" \
EXTRA_TEST_BAZEL_ARGS="--invocation_id=$$TEST_INVOCATION_ID" \
tools/test_everything.py
timeout: 10800s
volumes:
- name: 'ssh'
path: /root/.ssh
substitutions:
_USERNAME: $(commit.author.login)