-
Notifications
You must be signed in to change notification settings - Fork 603
/
Copy pathcloudbuild.yaml
53 lines (52 loc) · 2.06 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
# Copyright 2022 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.
steps:
- name: gcr.io/cloud-builders/gsutil
args: ['cp', $_CACHE_URI, '/workspace/cache'] # always write skaffold cache to filename cache in workspace
- name: gcr.io/k8s-skaffold/skaffold:v2.13.2
args:
- "skaffold"
- "build"
- "--file-output=/workspace/artifacts.json"
- "--default-repo=$_CONTAINER_REGISTRY"
- "--cache-file=/workspace/$_CACHE" # set _CACHE to anything other than "cache" e.g. "no-cache" to reset skaffold cache
- "--module=$_TEAM"
- name: gcr.io/cloud-builders/gsutil
args: ['cp', '/workspace/$_CACHE', $_CACHE_URI]
- name: gcr.io/k8s-skaffold/skaffold:v2.13.2 # python set up should be baked into a custom builder image to speed up build times
script: |
#!/bin/bash
apt-get update
apt-get -y install python3-venv
python3 -m venv $HOME/venv-python-tests
. $HOME/venv-python-tests/bin/activate
pip install --upgrade pip
pip install pylint --no-cache-dir
cd /workspace/src/$TEAM
skaffold test --build-artifacts=/workspace/artifacts.json --assume-yes
env:
- 'TEAM=$_TEAM'
- name: gcr.io/cloud-builders/gcloud
args:
- "deploy"
- "releases"
- "create"
- "$_TEAM-$SHORT_SHA-$$DATE-$$TIME"
- "--delivery-pipeline=$_TEAM"
- "--build-artifacts=/workspace/artifacts.json"
- "--skaffold-file=src/$_TEAM/skaffold.yaml"
- "--region=$LOCATION"
- "--gcs-source-staging-dir=$_SOURCE_STAGING_BUCKET/$SHORT_SHA"
options:
logging: CLOUD_LOGGING_ONLY