-
Notifications
You must be signed in to change notification settings - Fork 6
/
pipeline-deployment.yaml
67 lines (58 loc) · 2.19 KB
/
pipeline-deployment.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
# Copyright 2021 Google Inc. All Rights Reserved.
#
# 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.
# Referenced from:
# https://github.com/GoogleCloudPlatform/mlops-with-vertex-ai/blob/main/build/pipeline-deployment.yaml
#################################################################################
# CI/CD steps for Cloud Build to get a compiled TFX pipeline ready for exectuion.
#################################################################################
steps:
# Clone the repository.
- name: 'gcr.io/cloud-builders/git'
args: ['clone', '--single-branch', '--branch',
'$_BRANCH', '$_REPO_URL',
'--depth', '1',
'--verbose']
id: 'Clone Repository'
# Build the image that encapsulates the pipeline.
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', '$_TFX_IMAGE_URI', '.']
dir: 'CI-CD-for-Model-Training'
id: 'Build TFX Image'
waitFor: ['Clone Repository']
# Compile the pipeline.
- name: '$_CICD_IMAGE_URI'
entrypoint: 'python'
args: ['build/compile_pipeline.py',
'--use-gpu', "False"
]
dir: 'CI-CD-for-Model-Training'
env:
- 'PROJECT=$_PROJECT'
- 'REGION=$_REGION'
- 'PIPELINE_NAME=$_PIPELINE_NAME'
- 'PIPELINE_ROOT=$_PIPELINE_ROOT'
- 'TFX_IMAGE_URI=$_TFX_IMAGE_URI'
- 'DATA_ROOT=$_DATA_ROOT'
- 'MODULE_ROOT=$_MODULE_ROOT'
- 'SERVING_MODEL_DIR=$_SERVING_MODEL_DIR'
id: 'Compile Pipeline'
waitFor: ['Clone Repository']
# Upload compiled pipeline to GCS.
- name: 'gcr.io/cloud-builders/gsutil'
args: ['cp', '$_PIPELINE_NAME.json', '$_PIPELINE_ROOT/']
dir: 'CI-CD-for-Model-Training'
id: 'Upload Pipeline to GCS'
waitFor: ['Compile Pipeline']
# Push TFX Image to Container Registry.
images: ['$_TFX_IMAGE_URI']