forked from kubernetes-sigs/hierarchical-namespaces
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cloudbuild.yaml
168 lines (167 loc) · 5.71 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
156
157
158
159
160
161
162
163
164
165
166
167
168
# Note: This file is used for the manual release process.
# We intend to sunset this as we create auto created releases.
steps:
# Build release container image
# Pull source and check out correct tag
- name: gcr.io/cloud-builders/git
entrypoint: 'bash'
args:
- '-c'
- |
set -e
echo Cloning from https://github.com/$_HNC_REPO_OWNER/hierarchical-namespaces
git clone https://github.com/$_HNC_REPO_OWNER/hierarchical-namespaces
cd hierarchical-namespaces
echo Checking out $_HNC_IMG_TAG
git checkout $_HNC_IMG_TAG
# Build the manifests and the kubectl plugin
- name: golang:1.20
entrypoint: 'bash'
args:
- '-c'
- |
set -e
cd hierarchical-namespaces
export HNC_REGISTRY=$_HNC_REGISTRY
export HNC_IMG_NAME=$_HNC_IMG_NAME
export HNC_IMG_TAG=$_HNC_IMG_TAG
export HNC_RELEASE_REPO_OWNER=$_HNC_REPO_OWNER
echo "Building HNC manifests and plugin for $$HNC_REGISTRY/$$HNC_IMG_NAME:$$HNC_IMG_TAG"
make build
make krew-build
# Upload default manifest
- name: gcr.io/cloud-builders/curl
args:
- '-X'
- 'POST'
- '-H'
- 'Content-Type: application/x-application'
- '--data-binary'
- '@hierarchical-namespaces/manifests/default.yaml'
- '-u'
- '$_HNC_USER:$_HNC_PERSONAL_ACCESS_TOKEN'
- 'https://uploads.github.com/repos/$_HNC_REPO_OWNER/hierarchical-namespaces/releases/$_HNC_RELEASE_ID/assets?name=default.yaml'
# Upload HA manifest
- name: gcr.io/cloud-builders/curl
args:
- '-X'
- 'POST'
- '-H'
- 'Content-Type: application/x-application'
- '--data-binary'
- '@hierarchical-namespaces/manifests/ha.yaml'
- '-u'
- '$_HNC_USER:$_HNC_PERSONAL_ACCESS_TOKEN'
- 'https://uploads.github.com/repos/$_HNC_REPO_OWNER/hierarchical-namespaces/releases/$_HNC_RELEASE_ID/assets?name=ha.yaml'
# Upload HRQ manifest
- name: gcr.io/cloud-builders/curl
args:
- '-X'
- 'POST'
- '-H'
- 'Content-Type: application/x-application'
- '--data-binary'
- '@hierarchical-namespaces/manifests/hrq.yaml'
- '-u'
- '$_HNC_USER:$_HNC_PERSONAL_ACCESS_TOKEN'
- 'https://uploads.github.com/repos/$_HNC_REPO_OWNER/hierarchical-namespaces/releases/$_HNC_RELEASE_ID/assets?name=hrq.yaml'
# Upload cert-manager manifest
- name: gcr.io/cloud-builders/curl
args:
- '-X'
- 'POST'
- '-H'
- 'Content-Type: application/x-application'
- '--data-binary'
- '@hierarchical-namespaces/manifests/default-cm.yaml'
- '-u'
- '$_HNC_USER:$_HNC_PERSONAL_ACCESS_TOKEN'
- 'https://uploads.github.com/repos/$_HNC_REPO_OWNER/hierarchical-namespaces/releases/$_HNC_RELEASE_ID/assets?name=default-cm.yaml'
# Upload plugin (Linux)
- name: gcr.io/cloud-builders/curl
args:
- '-X'
- 'POST'
- '-H'
- 'Content-Type: application/x-application'
- '--data-binary'
- '@hierarchical-namespaces/bin/kubectl/kubectl-hns_linux_amd64'
- '-u'
- '$_HNC_USER:$_HNC_PERSONAL_ACCESS_TOKEN'
- 'https://uploads.github.com/repos/$_HNC_REPO_OWNER/hierarchical-namespaces/releases/$_HNC_RELEASE_ID/assets?name=kubectl-hns_linux_amd64'
# Upload plugin (Linux arm64)
- name: gcr.io/cloud-builders/curl
args:
- '-X'
- 'POST'
- '-H'
- 'Content-Type: application/x-application'
- '--data-binary'
- '@hierarchical-namespaces/bin/kubectl/kubectl-hns_linux_arm64'
- '-u'
- '$_HNC_USER:$_HNC_PERSONAL_ACCESS_TOKEN'
- 'https://uploads.github.com/repos/$_HNC_REPO_OWNER/hierarchical-namespaces/releases/$_HNC_RELEASE_ID/assets?name=kubectl-hns_linux_arm64'
# Upload plugin (Darwin intel)
- name: gcr.io/cloud-builders/curl
args:
- '-X'
- 'POST'
- '-H'
- 'Content-Type: application/x-application'
- '--data-binary'
- '@hierarchical-namespaces/bin/kubectl/kubectl-hns_darwin_amd64'
- '-u'
- '$_HNC_USER:$_HNC_PERSONAL_ACCESS_TOKEN'
- 'https://uploads.github.com/repos/$_HNC_REPO_OWNER/hierarchical-namespaces/releases/$_HNC_RELEASE_ID/assets?name=kubectl-hns_darwin_amd64'
# Upload plugin (Darwin arm64)
- name: gcr.io/cloud-builders/curl
args:
- '-X'
- 'POST'
- '-H'
- 'Content-Type: application/x-application'
- '--data-binary'
- '@hierarchical-namespaces/bin/kubectl/kubectl-hns_darwin_arm64'
- '-u'
- '$_HNC_USER:$_HNC_PERSONAL_ACCESS_TOKEN'
- 'https://uploads.github.com/repos/$_HNC_REPO_OWNER/hierarchical-namespaces/releases/$_HNC_RELEASE_ID/assets?name=kubectl-hns_darwin_arm64'
# Upload plugin (Windows)
- name: gcr.io/cloud-builders/curl
args:
- '-X'
- 'POST'
- '-H'
- 'Content-Type: application/x-application'
- '--data-binary'
- '@hierarchical-namespaces/bin/kubectl/kubectl-hns_windows_amd64.exe'
- '-u'
- '$_HNC_USER:$_HNC_PERSONAL_ACCESS_TOKEN'
- 'https://uploads.github.com/repos/$_HNC_REPO_OWNER/hierarchical-namespaces/releases/$_HNC_RELEASE_ID/assets?name=kubectl-hns_windows_amd64.exe'
# Upload plugin (Krew tar file)
- name: gcr.io/cloud-builders/curl
args:
- '-X'
- 'POST'
- '-H'
- 'Content-Type: application/x-application'
- '--data-binary'
- '@hierarchical-namespaces/bin/kubectl-hns.tar.gz'
- '-u'
- '$_HNC_USER:$_HNC_PERSONAL_ACCESS_TOKEN'
- 'https://uploads.github.com/repos/$_HNC_REPO_OWNER/hierarchical-namespaces/releases/$_HNC_RELEASE_ID/assets?name=kubectl-hns.tar.gz'
# Upload plugin (Krew manifest file - to add to the Krew index)
- name: gcr.io/cloud-builders/curl
args:
- '-X'
- 'POST'
- '-H'
- 'Content-Type: application/x-application'
- '--data-binary'
- '@hierarchical-namespaces/manifests/krew-kubectl-hns.yaml'
- '-u'
- '$_HNC_USER:$_HNC_PERSONAL_ACCESS_TOKEN'
- 'https://uploads.github.com/repos/$_HNC_REPO_OWNER/hierarchical-namespaces/releases/$_HNC_RELEASE_ID/assets?name=krew-kubectl-hns.yaml'
# Build Docker image
- name: gcr.io/cloud-builders/docker
args: ['build', '-t', 'gcr.io/$PROJECT_ID/$_HNC_IMG_NAME:$_HNC_IMG_TAG', 'hierarchical-namespaces']
images: ['gcr.io/$PROJECT_ID/$_HNC_IMG_NAME:$_HNC_IMG_TAG']