forked from GoogleCloudPlatform/click-to-deploy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cloudbuild-vm.yaml
58 lines (55 loc) · 1.98 KB
/
cloudbuild-vm.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
# Copyright 2018 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.
#
# The following variables are required to be provided:
#
# _LOGS_BUCKET - <GCS BUCKET TO EXPORT PACKER LOGS>
# _SOLUTION_NAME - <VM IMAGE TO BE BUILT>
timeout: 1800s # 30m
options:
workerPool: projects/${PROJECT_ID}/locations/us-central1/workerPools/gcb-workers-pool-e2
steps:
- id: Pull Imagebuilder Image
name: gcr.io/cloud-builders/docker
dir: vm
entrypoint: bash
args:
- -exc
- |
TAG="$$(cat ./IMAGEBUILDER_TAG)"
docker pull "gcr.io/cloud-marketplace-tools/vm/imagebuilder:$$TAG"
docker tag "gcr.io/cloud-marketplace-tools/vm/imagebuilder:$$TAG" "gcr.io/cloud-marketplace-tools/vm/imagebuilder:local"
- id: Build VM-based Solution
name: gcr.io/cloud-builders/docker
waitFor:
- Pull Imagebuilder Image
args:
- run
- --env=PROJECT=${PROJECT_ID}
- --env=BUCKET=${_LOGS_BUCKET}
- --env=SERVICE_ACCOUNT_EMAIL=${PROJECT_NUMBER}@cloudbuild.gserviceaccount.com
- --env=CHEF_DIR=/chef
- --env=PACKER_DIR=/packer/templates
- --env=TESTS_DIR=/tests
- --env=SOLUTION_NAME=${_SOLUTION_NAME}
- --env=RUN_TESTS=true
- --env=ATTACH_LICENSE=true
- --env=LICENSE_PROJECT_NAME=click-to-deploy-images
- --env=USE_INTERNAL_IP=true
- --env=TESTS_CUSTOM_METADATA=google-c2d-startup-enable=0
- --volume=/workspace/vm/chef:/chef:ro
- --volume=/workspace/vm/packer:/packer:ro
- --volume=/workspace/vm/tests:/tests:ro
- --network=cloudbuild
- gcr.io/cloud-marketplace-tools/vm/imagebuilder:local