-
-
Notifications
You must be signed in to change notification settings - Fork 51
/
cloudbuild.yaml
82 lines (76 loc) · 2.22 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
timeout: 3600s
options:
machineType: "N1_HIGHCPU_32"
substitutions:
_USE_CACHE: "true"
_APP_NAME: gstreamer
_IMAGE_PREFIX: selkies
_IMAGE_TAG: latest
_APT_REGION: "us-central1"
tags:
- selkies-gstreamer-image
###
# Images to be pushed
###
images: [
'gcr.io/${PROJECT_ID}/${_IMAGE_PREFIX}-${_APP_NAME}:${_IMAGE_TAG}',
'gcr.io/${PROJECT_ID}/${_IMAGE_PREFIX}-${_APP_NAME}:latest',
]
###
# deb packages created
###
artifacts:
objects:
location: gs://${PROJECT_ID}-vdi/selkies-gstreamer/
paths:
- ${_IMAGE_PREFIX}-${_APP_NAME}-${_IMAGE_TAG}.tar.gz
- dist/selkies_gstreamer*.whl
steps:
###
# App Image
###
- name: 'gcr.io/cloud-builders/docker'
id: image-pull
entrypoint: 'bash'
args: ["-c", "if [ '${_USE_CACHE}' = 'true' ]; then (docker pull gcr.io/${PROJECT_ID}/${_IMAGE_PREFIX}-${_APP_NAME}:latest || exit 0); fi"]
waitFor: ["-"]
- name: 'gcr.io/cloud-builders/docker'
id: image
args: [
'build',
'-t', 'gcr.io/${PROJECT_ID}/${_IMAGE_PREFIX}-${_APP_NAME}:${_IMAGE_TAG}',
'--cache-from', 'gcr.io/${PROJECT_ID}/${_IMAGE_PREFIX}-${_APP_NAME}:latest',
'--build-arg', 'GCE_REGION=${_APT_REGION}',
'.'
]
waitFor:
- image-pull
- name: 'gcr.io/cloud-builders/docker'
id: image-tags
args: [
'tag',
'gcr.io/${PROJECT_ID}/${_IMAGE_PREFIX}-${_APP_NAME}:${_IMAGE_TAG}',
'gcr.io/${PROJECT_ID}/${_IMAGE_PREFIX}-${_APP_NAME}:latest',
]
waitFor:
- image
- name: 'gcr.io/cloud-builders/docker'
id: copy-artifacts
entrypoint: 'bash'
args:
- -exc
- |
docker create --name copy gcr.io/${PROJECT_ID}/${_IMAGE_PREFIX}-${_APP_NAME}:${_IMAGE_TAG}
docker cp copy:/opt/selkies-gstreamer-latest.tar.gz ./${_IMAGE_PREFIX}-${_APP_NAME}-${_IMAGE_TAG}.tar.gz
docker cp copy:/opt/pypi/dist/ ./
docker rm copy
- name: 'gcr.io/cloud-builders/gcloud'
id: make-artifact-bucket
entrypoint: 'bash'
args:
- -exc
- |
gsutil mb gs://${PROJECT_ID}-vdi 2>/dev/null || true