-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathcli_tools_cloudbuild.yaml
More file actions
75 lines (66 loc) · 2.28 KB
/
cli_tools_cloudbuild.yaml
File metadata and controls
75 lines (66 loc) · 2.28 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
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
timeout: 14400s
options:
env:
- GO111MODULE=auto
- GOPROXY=https://proxy.golang.org
volumes:
- name: go-pkg
path: /go/pkg
- name: go-src
path: /go/src
substitutions:
_TAG: 'latest'
_RELEASE_PROJECT_FLAG: 'github.com/GoogleCloudPlatform/compute-image-import/cli_tools/common/utils/param.ReleaseProject'
_IMAGE_PROJECT: 'compute-image-import'
steps:
# Build import_precheck.
- name: 'golang'
dir: 'cli_tools/import_precheck'
args: ['go', 'build', '-o=/workspace/linux/import_precheck']
env: ['CGO_ENABLED=0']
- name: 'golang'
dir: 'cli_tools/import_precheck'
args: ['go', 'build', '-o=/workspace/windows/import_precheck.exe']
env: ['GOOS=windows']
- name: 'golang'
dir: 'cli_tools/import_precheck'
args: ['go', 'build', '-o=/workspace/linux/import_precheck_32bit']
env:
- CGO_ENABLED=0
- GOARCH=386
- name: 'golang'
dir: 'cli_tools/import_precheck'
args: ['go', 'build', '-o=/workspace/windows/import_precheck_32bit.exe']
env:
- GOOS=windows
- GOARCH=386
# Copy Linux binaries to GCS
- name: 'gcr.io/cloud-builders/gsutil'
args: ['cp', '/workspace/linux/*', 'gs://$_IMAGE_PROJECT/$_TAG/linux/']
# Copy Windows binaries to GCS
- name: 'gcr.io/cloud-builders/gsutil'
args: ['cp', '/workspace/windows/*', 'gs://$_IMAGE_PROJECT/$_TAG/windows/']
# Push Wrappers to all the Artifact Registry regions
- name: 'google/cloud-sdk:alpine'
args:
- 'bash'
- '-c'
- |
GCP_PROJECTS=($_IMAGE_PROJECT)
REGIONS=()
readarray -t REGIONS < ./supported-regions
TOOLS=("gce_vm_image_export")
for _PROJECT in ${GCP_PROJECTS[@]}
do
for _REGION in ${REGIONS[@]}
do
for _TOOL in ${TOOLS[@]}
do
echo "--> Deploying... $$_TOOL -> $$_REGION in $$_PROJECT project."
gcloud container images add-tag gcr.io/$$_PROJECT/$$_TOOL:$_TAG $$_REGION-docker.pkg.dev/$$_PROJECT/wrappers/$$_TOOL:$_TAG -q
gcloud container images add-tag gcr.io/$$_PROJECT/$$_TOOL:$COMMIT_SHA $$_REGION-docker.pkg.dev/$$_PROJECT/wrappers/$$_TOOL:$COMMIT_SHA -q
gcloud container images add-tag gcr.io/$$_PROJECT/$$_TOOL:$COMMIT_SHA $$_REGION-docker.pkg.dev/$$_PROJECT/wrappers/$$_TOOL:legacy -q
done
done
echo "----> Deployed all tools for all regions in $$_PROJECT project"
done