generated from kubernetes/kubernetes-template-project
-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathcloudbuild.yaml
155 lines (151 loc) · 5.13 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
steps:
- id: build-manager-image
name: gcr.io/cloud-builders/docker
args:
- build
- --build-arg
- TARGET=manager
- --tag=gcr.io/$PROJECT_ID/kernel-module-management-operator:$_GIT_TAG
- --tag=gcr.io/$PROJECT_ID/kernel-module-management-operator:latest
- .
waitFor: ['-']
- id: push-manager-image
name: gcr.io/cloud-builders/docker
args:
- push
- --all-tags
- gcr.io/$PROJECT_ID/kernel-module-management-operator
waitFor: [build-manager-image]
- id: build-manager-hub-image
name: gcr.io/cloud-builders/docker
args:
- build
- --build-arg
- TARGET=manager-hub
- --tag=gcr.io/$PROJECT_ID/kernel-module-management-operator-hub:$_GIT_TAG
- --tag=gcr.io/$PROJECT_ID/kernel-module-management-operator-hub:latest
- .
waitFor: ['-']
- id: push-manager-hub-image
name: gcr.io/cloud-builders/docker
args:
- push
- --all-tags
- gcr.io/$PROJECT_ID/kernel-module-management-operator-hub
waitFor: [build-manager-hub-image]
- id: build-signimage
name: gcr.io/cloud-builders/docker
args:
- build
- --tag=gcr.io/$PROJECT_ID/kernel-module-management-signimage:$_GIT_TAG
- --tag=gcr.io/$PROJECT_ID/kernel-module-management-signimage:latest
- --file=Dockerfile.signimage
- .
waitFor: ['-']
- id: push-signimage
name: gcr.io/cloud-builders/docker
args:
- push
- --all-tags
- gcr.io/$PROJECT_ID/kernel-module-management-signimage
waitFor: [build-signimage]
- id: build-webhook-server
name: gcr.io/cloud-builders/docker
args:
- build
- --tag=gcr.io/$PROJECT_ID/kernel-module-management-webhook-server:$_GIT_TAG
- --tag=gcr.io/$PROJECT_ID/kernel-module-management-webhook-server:latest
- --file=Dockerfile.webhook
- .
waitFor: ['-']
- id: push-webhook-server
name: gcr.io/cloud-builders/docker
args:
- push
- --all-tags
- gcr.io/$PROJECT_ID/kernel-module-management-webhook-server
waitFor: [build-webhook-server]
- id: build-worker
name: gcr.io/cloud-builders/docker
args:
- build
- --tag=gcr.io/$PROJECT_ID/kernel-module-management-worker:$_GIT_TAG
- --tag=gcr.io/$PROJECT_ID/kernel-module-management-worker:latest
- --file=Dockerfile.worker
- .
waitFor: ['-']
- id: push-worker
name: gcr.io/cloud-builders/docker
args:
- push
- --all-tags
- gcr.io/$PROJECT_ID/kernel-module-management-worker
waitFor: [build-worker]
- id: build-bundles
name: golang:1.22-alpine3.19
env:
- '_GIT_TAG=$_GIT_TAG'
entrypoint: sh
args:
- -eEuo
- pipefail
- -c
- |-
set -euxo pipefail
apk add bash curl gcc make musl-dev
# Install kubectl
curl -Lo /usr/local/bin/kubectl "https://dl.k8s.io/release/$$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x /usr/local/bin/kubectl
# Include the destination directory of `go install` in $$PATH
export PATH=$$(go env GOPATH)/bin:$${PATH}
# KMM
make bundle IMAGE_TAG=$_GIT_TAG USE_IMAGE_DIGESTS=true
mv bundle bundle.Dockerfile /bundle-kmm
# KMM Hub
make bundle-hub IMAGE_TAG=$_GIT_TAG USE_IMAGE_DIGESTS=true
mv bundle bundle.Dockerfile /bundle-hub
volumes:
- name: bundle-kmm
path: /bundle-kmm
- name: bundle-hub
path: /bundle-hub
waitFor: [push-manager-image, push-manager-hub-image, push-signimage, push-webhook-server, push-worker]
- id: build-kmm-bundle-image
name: gcr.io/cloud-builders/docker
args:
- build
- --file=bundle.Dockerfile
- --cache-from=gcr.io/$PROJECT_ID/kernel-module-management-operator-bundle:latest
- --tag=gcr.io/$PROJECT_ID/kernel-module-management-operator-bundle:$_GIT_TAG
- --tag=gcr.io/$PROJECT_ID/kernel-module-management-operator-bundle:latest
- .
dir: /bundle-kmm
volumes:
- name: bundle-kmm
path: /bundle-kmm
waitFor: [build-bundles]
- id: build-hub-bundle-image
name: gcr.io/cloud-builders/docker
args:
- build
- --file=bundle.Dockerfile
- --cache-from=gcr.io/$PROJECT_ID/kernel-module-management-operator-hub-bundle:latest
- --tag=gcr.io/$PROJECT_ID/kernel-module-management-operator-hub-bundle:$_GIT_TAG
- --tag=gcr.io/$PROJECT_ID/kernel-module-management-operator-hub-bundle:latest
- .
dir: /bundle-hub
volumes:
- name: bundle-hub
path: /bundle-hub
waitFor: [build-bundles]
# this prevents errors if you don't use both _GIT_TAG and _PULL_BASE_REF,
# or any new substitutions added in the future.
options:
substitution_option: ALLOW_LOOSE
images:
# Binary images pushed manually in steps so that they are available in build-bundles,
# which looks for their SHA on their registry.
- gcr.io/$PROJECT_ID/kernel-module-management-operator-bundle:$_GIT_TAG
- gcr.io/$PROJECT_ID/kernel-module-management-operator-bundle:latest
- gcr.io/$PROJECT_ID/kernel-module-management-operator-hub-bundle:$_GIT_TAG
- gcr.io/$PROJECT_ID/kernel-module-management-operator-hub-bundle:latest