forked from googleapis/google-cloud-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcloudbuild.yaml
More file actions
43 lines (39 loc) · 1.88 KB
/
cloudbuild.yaml
File metadata and controls
43 lines (39 loc) · 1.88 KB
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
# Copyright 2025 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.
# TODO(https://github.com/googleapis/google-cloud-python/issues/14142):
# Reduce this timeout by moving the installation of Python runtimes to a separate base image
timeout: 7200s # 2 hours for the first uncached run, can be lowered later.
steps:
# STEP 1: Pull the latest version of the image to use as a cache.
# The '|| exit 0' part ensures the build doesn't fail if the image
# doesn't exist yet (e.g., on the very first run).
- name: 'gcr.io/cloud-builders/docker'
entrypoint: 'bash'
args: ['-c', 'docker pull gcr.io/$PROJECT_ID/python-librarian-generator:latest || exit 0']
# STEP 2: Build the new image, using the pulled image as a cache source.
- name: 'gcr.io/cloud-builders/docker'
args:
- 'build'
- '--tag=gcr.io/$PROJECT_ID/python-librarian-generator:latest'
- '--cache-from=gcr.io/$PROJECT_ID/python-librarian-generator:latest'
- '--file=.generator/Dockerfile'
- '.'
# STEP 3: Push the newly built image to the registry so it can be used
# as the cache for the next run. Cloud Build does this automatically if
# the image is listed in the 'images' section.
images:
- 'gcr.io/$PROJECT_ID/python-librarian-generator:latest'
# This section automatically creates a storage bucket for storing docker build logs.
options:
default_logs_bucket_behavior: REGIONAL_USER_OWNED_BUCKET