1
- name : Build Docker Images and Push to Image Registry
2
-
3
- on :
4
- push :
5
- tags :
6
- - " v*.*.*"
7
- workflow_dispatch : ~
8
-
9
- jobs :
10
- build-controller-image :
11
- runs-on : ubuntu-latest
12
- environment :
13
- name : image-registry-controller
14
- env :
15
- CONTROLLER_IMAGE_REGISTRY : ${{ vars.IMAGE_REGISTRY || 'higress-registry.cn-hangzhou.cr.aliyuncs.com' }}
16
- CONTROLLER_IMAGE_NAME : ${{ vars.CONTROLLER_IMAGE_NAME || 'higress/higress' }}
17
- steps :
18
- - name : " Checkout ${{ github.ref }}"
19
- uses : actions/checkout@v4
20
- with :
21
- fetch-depth : 1
22
-
23
- - name : Free Up GitHub Actions Ubuntu Runner Disk Space 🔧
24
- uses : jlumbroso/free-disk-space@main
25
- with :
26
- tool-cache : false
27
- android : true
28
- dotnet : true
29
- haskell : true
30
- large-packages : true
31
- swap-storage : true
32
-
33
- - name : " Setup Go"
34
- uses : actions/setup-go@v5
35
- with :
36
- go-version : 1.21.5
37
-
38
- - name : Setup Golang Caches
39
- uses : actions/cache@v4
40
- with :
41
- path : |-
42
- ~/.cache/go-build
43
- ~/go/pkg/mod
44
- key : ${{ runner.os }}-go-${{ github.run_id }}
45
- restore-keys : ${{ runner.os }}-go
46
-
47
- - name : Calculate Docker metadata
48
- id : docker-meta
49
- uses : docker/metadata-action@v5
50
- with :
51
- images : |
52
- ${{ env.CONTROLLER_IMAGE_REGISTRY }}/${{ env.CONTROLLER_IMAGE_NAME }}
53
- tags : |
54
- type=sha
55
- type=ref,event=tag
56
- type=semver,pattern={{version}}
57
- type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
58
-
59
- - name : Login to Docker Registry
60
- uses : docker/login-action@v3
61
- with :
62
- registry : ${{ env.CONTROLLER_IMAGE_REGISTRY }}
63
- username : ${{ secrets.REGISTRY_USERNAME }}
64
- password : ${{ secrets.REGISTRY_PASSWORD }}
65
-
66
- - name : Build Docker Image and Push
67
- run : |
68
- GOPROXY="https://proxy.golang.org,direct" make docker-buildx-push
69
- BUILT_IMAGE="higress-registry.cn-hangzhou.cr.aliyuncs.com/higress/higress"
70
- readarray -t IMAGES <<< "${{ steps.docker-meta.outputs.tags }}"
71
- for image in ${IMAGES[@]}; do
72
- echo "Image: $image"
73
- docker buildx imagetools create $BUILT_IMAGE:$GITHUB_SHA --tag $image
74
- done
75
-
76
- build-pilot-image :
77
- runs-on : ubuntu-latest
78
- environment :
79
- name : image-registry-pilot
80
- env :
81
- PILOT_IMAGE_REGISTRY : ${{ vars.IMAGE_REGISTRY || 'higress-registry.cn-hangzhou.cr.aliyuncs.com' }}
82
- PILOT_IMAGE_NAME : ${{ vars.PILOT_IMAGE_NAME || 'higress/pilot' }}
83
- steps :
84
- - name : " Checkout ${{ github.ref }}"
85
- uses : actions/checkout@v4
86
- with :
87
- fetch-depth : 1
88
-
89
- - name : Free Up GitHub Actions Ubuntu Runner Disk Space 🔧
90
- uses : jlumbroso/free-disk-space@main
91
- with :
92
- tool-cache : false
93
- android : true
94
- dotnet : true
95
- haskell : true
96
- large-packages : true
97
- swap-storage : true
98
-
99
- - name : " Setup Go"
100
- uses : actions/setup-go@v5
101
- with :
102
- go-version : 1.21.5
103
-
104
- - name : Setup Golang Caches
105
- uses : actions/cache@v4
106
- with :
107
- path : |-
108
- ~/.cache/go-build
109
- ~/go/pkg/mod
110
- key : ${{ runner.os }}-go-${{ github.run_id }}
111
- restore-keys : ${{ runner.os }}-go
112
-
113
- - name : Set up Docker Buildx
114
- uses : docker/setup-buildx-action@v1
115
-
116
- - name : Cache Docker layers
117
- uses : actions/cache@v2
118
- with :
119
- path : /tmp/.buildx-cache
120
- key : ${{ runner.os }}-buildx-${{ github.sha }}
121
- restore-keys : |
122
- ${{ runner.os }}-buildx-
123
-
124
- - name : Calculate Docker metadata
125
- id : docker-meta
126
- uses : docker/metadata-action@v5
127
- with :
128
- images : |
129
- ${{ env.PILOT_IMAGE_REGISTRY }}/${{ env.PILOT_IMAGE_NAME }}
130
- tags : |
131
- type=sha
132
- type=ref,event=tag
133
- type=semver,pattern={{version}}
134
- type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
135
-
136
- - name : Login to Docker Registry
137
- uses : docker/login-action@v3
138
- with :
139
- registry : ${{ env.PILOT_IMAGE_REGISTRY }}
140
- username : ${{ secrets.REGISTRY_USERNAME }}
141
- password : ${{ secrets.REGISTRY_PASSWORD }}
142
-
143
- - name : Build Pilot-Discovery Image and Push
144
- run : |
145
- GOPROXY="https://proxy.golang.org,direct" make build-istio
146
- BUILT_IMAGE="higress-registry.cn-hangzhou.cr.aliyuncs.com/higress/pilot"
147
- readarray -t IMAGES <<< "${{ steps.docker-meta.outputs.tags }}"
148
- for image in ${IMAGES[@]}; do
149
- echo "Image: $image"
150
- docker buildx imagetools create $BUILT_IMAGE:$GITHUB_SHA --tag $image
151
- done
152
-
153
-
154
- build-gateway-image :
155
- runs-on : ubuntu-latest
156
- environment :
157
- name : image-registry-pilot
158
- env :
159
- GATEWAY_IMAGE_REGISTRY : ${{ vars.IMAGE_REGISTRY || 'higress-registry.cn-hangzhou.cr.aliyuncs.com' }}
160
- GATEWAY_IMAGE_NAME : ${{ vars.GATEWAY_IMAGE_NAME || 'higress/gateway' }}
161
- steps :
162
- - name : " Checkout ${{ github.ref }}"
163
- uses : actions/checkout@v4
164
- with :
165
- fetch-depth : 1
166
-
167
- - name : Free Up GitHub Actions Ubuntu Runner Disk Space 🔧
168
- uses : jlumbroso/free-disk-space@main
169
- with :
170
- tool-cache : false
171
- android : true
172
- dotnet : true
173
- haskell : true
174
- large-packages : true
175
- swap-storage : true
176
-
177
- - name : " Setup Go"
178
- uses : actions/setup-go@v5
179
- with :
180
- go-version : 1.21.5
181
-
182
- - name : Setup Golang Caches
183
- uses : actions/cache@v4
184
- with :
185
- path : |-
186
- ~/.cache/go-build
187
- ~/go/pkg/mod
188
- key : ${{ runner.os }}-go-${{ github.run_id }}
189
- restore-keys : ${{ runner.os }}-go
190
-
191
- - name : Set up Docker Buildx
192
- uses : docker/setup-buildx-action@v1
193
-
194
- - name : Cache Docker layers
195
- uses : actions/cache@v2
196
- with :
197
- path : /tmp/.buildx-cache
198
- key : ${{ runner.os }}-buildx-${{ github.sha }}
199
- restore-keys : |
200
- ${{ runner.os }}-buildx-
201
-
202
- - name : Calculate Docker metadata
203
- id : docker-meta
204
- uses : docker/metadata-action@v5
205
- with :
206
- images : |
207
- ${{ env.GATEWAY_IMAGE_REGISTRY }}/${{ env.GATEWAY_IMAGE_NAME }}
208
- tags : |
209
- type=sha
210
- type=ref,event=tag
211
- type=semver,pattern={{version}}
212
- type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
213
-
214
- - name : Login to Docker Registry
215
- uses : docker/login-action@v3
216
- with :
217
- registry : ${{ env.GATEWAY_IMAGE_REGISTRY }}
218
- username : ${{ secrets.REGISTRY_USERNAME }}
219
- password : ${{ secrets.REGISTRY_PASSWORD }}
220
-
221
- - name : Build Gateway Image and Push
222
- run : |
223
- GOPROXY="https://proxy.golang.org,direct" make build-gateway
224
- BUILT_IMAGE="higress-registry.cn-hangzhou.cr.aliyuncs.com/higress/proxyv2"
225
- readarray -t IMAGES <<< "${{ steps.docker-meta.outputs.tags }}"
226
- for image in ${IMAGES[@]}; do
227
- echo "Image: $image"
228
- docker buildx imagetools create $BUILT_IMAGE:$GITHUB_SHA --tag $image
229
- done
1
+ name : Build Docker Images and Push to Image Registry
2
+
3
+ on :
4
+ push :
5
+ tags :
6
+ - " v*.*.*"
7
+ workflow_dispatch : ~
8
+
9
+ jobs :
10
+ build-controller-image :
11
+ runs-on : ubuntu-latest
12
+ environment :
13
+ name : image-registry-controller
14
+ env :
15
+ CONTROLLER_IMAGE_REGISTRY : ${{ vars.IMAGE_REGISTRY || 'higress-registry.cn-hangzhou.cr.aliyuncs.com' }}
16
+ CONTROLLER_IMAGE_NAME : ${{ vars.CONTROLLER_IMAGE_NAME || 'higress/higress' }}
17
+ steps :
18
+ - name : " Checkout ${{ github.ref }}"
19
+ uses : actions/checkout@v4
20
+ with :
21
+ fetch-depth : 1
22
+
23
+ - name : Free Up GitHub Actions Ubuntu Runner Disk Space 🔧
24
+ uses : jlumbroso/free-disk-space@main
25
+ with :
26
+ tool-cache : false
27
+ android : true
28
+ dotnet : true
29
+ haskell : true
30
+ large-packages : true
31
+ swap-storage : true
32
+
33
+ - name : " Setup Go"
34
+ uses : actions/setup-go@v5
35
+ with :
36
+ go-version : 1.21.5
37
+
38
+ - name : Setup Golang Caches
39
+ uses : actions/cache@v4
40
+ with :
41
+ path : |-
42
+ ~/.cache/go-build
43
+ ~/go/pkg/mod
44
+ key : ${{ runner.os }}-go-${{ github.run_id }}
45
+ restore-keys : ${{ runner.os }}-go
46
+
47
+ - name : Calculate Docker metadata
48
+ id : docker-meta
49
+ uses : docker/metadata-action@v5
50
+ with :
51
+ images : |
52
+ ${{ env.CONTROLLER_IMAGE_REGISTRY }}/${{ env.CONTROLLER_IMAGE_NAME }}
53
+ tags : |
54
+ type=sha
55
+ type=ref,event=tag
56
+ type=semver,pattern={{version}}
57
+ type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
58
+
59
+ - name : Login to Docker Registry
60
+ uses : docker/login-action@v3
61
+ with :
62
+ registry : ${{ env.CONTROLLER_IMAGE_REGISTRY }}
63
+ username : ${{ secrets.REGISTRY_USERNAME }}
64
+ password : ${{ secrets.REGISTRY_PASSWORD }}
65
+
66
+ - name : Build Docker Image and Push
67
+ run : |
68
+ BUILT_IMAGE=""
69
+ readarray -t IMAGES <<< "${{ steps.docker-meta.outputs.tags }}"
70
+ for image in ${IMAGES[@]}; do
71
+ echo "Image: $image"
72
+ if [ "$BUILT_IMAGE" == "" ]; then
73
+ GOPROXY="https://proxy.golang.org,direct" IMG_URL="$image" make docker-buildx-push
74
+ BUILT_IMAGE="$image"
75
+ else
76
+ docker buildx imagetools create $BUILT_IMAGE --tag $image
77
+ fi
78
+ done
79
+
80
+ build-pilot-image :
81
+ runs-on : ubuntu-latest
82
+ environment :
83
+ name : image-registry-pilot
84
+ env :
85
+ PILOT_IMAGE_REGISTRY : ${{ vars.IMAGE_REGISTRY || 'higress-registry.cn-hangzhou.cr.aliyuncs.com' }}
86
+ PILOT_IMAGE_NAME : ${{ vars.PILOT_IMAGE_NAME || 'higress/pilot' }}
87
+ steps :
88
+ - name : " Checkout ${{ github.ref }}"
89
+ uses : actions/checkout@v4
90
+ with :
91
+ fetch-depth : 1
92
+
93
+ - name : Free Up GitHub Actions Ubuntu Runner Disk Space 🔧
94
+ uses : jlumbroso/free-disk-space@main
95
+ with :
96
+ tool-cache : false
97
+ android : true
98
+ dotnet : true
99
+ haskell : true
100
+ large-packages : true
101
+ swap-storage : true
102
+
103
+ - name : " Setup Go"
104
+ uses : actions/setup-go@v5
105
+ with :
106
+ go-version : 1.21.5
107
+
108
+ - name : Setup Golang Caches
109
+ uses : actions/cache@v4
110
+ with :
111
+ path : |-
112
+ ~/.cache/go-build
113
+ ~/go/pkg/mod
114
+ key : ${{ runner.os }}-go-${{ github.run_id }}
115
+ restore-keys : ${{ runner.os }}-go
116
+
117
+ - name : Set up QEMU
118
+ uses : docker/setup-qemu-action@v3
119
+ with :
120
+ image : tonistiigi/binfmt:qemu-v7.0.0
121
+
122
+ - name : Set up Docker Buildx
123
+ uses : docker/setup-buildx-action@v3
124
+
125
+ - name : Cache Docker layers
126
+ uses : actions/cache@v2
127
+ with :
128
+ path : /tmp/.buildx-cache
129
+ key : ${{ runner.os }}-buildx-${{ github.sha }}
130
+ restore-keys : |
131
+ ${{ runner.os }}-buildx-
132
+
133
+ - name : Calculate Docker metadata
134
+ id : docker-meta
135
+ uses : docker/metadata-action@v5
136
+ with :
137
+ images : |
138
+ ${{ env.PILOT_IMAGE_REGISTRY }}/${{ env.PILOT_IMAGE_NAME }}
139
+ tags : |
140
+ type=sha
141
+ type=ref,event=tag
142
+ type=semver,pattern={{version}}
143
+ type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
144
+
145
+ - name : Login to Docker Registry
146
+ uses : docker/login-action@v3
147
+ with :
148
+ registry : ${{ env.PILOT_IMAGE_REGISTRY }}
149
+ username : ${{ secrets.REGISTRY_USERNAME }}
150
+ password : ${{ secrets.REGISTRY_PASSWORD }}
151
+
152
+ - name : Build Pilot-Discovery Image and Push
153
+ run : |
154
+ BUILT_IMAGE=""
155
+ readarray -t IMAGES <<< "${{ steps.docker-meta.outputs.tags }}"
156
+ for image in ${IMAGES[@]}; do
157
+ echo "Image: $image"
158
+ if [ "$BUILT_IMAGE" == "" ]; then
159
+ TAG=${image#*:}
160
+ HUB=${image%:*}
161
+ HUB=${HUB%/*}
162
+ BUILT_IMAGE="$HUB/pilot:$TAG"
163
+ GOPROXY="https://proxy.golang.org,direct" IMG_URL="$BUILT_IMAGE" make build-istio
164
+ fi
165
+ if [ "$BUILT_IMAGE" != "$image" ]; then
166
+ docker buildx imagetools create $BUILT_IMAGE --tag $image
167
+ fi
168
+ done
169
+
170
+ build-gateway-image :
171
+ runs-on : ubuntu-latest
172
+ environment :
173
+ name : image-registry-gateway
174
+ env :
175
+ GATEWAY_IMAGE_REGISTRY : ${{ vars.IMAGE_REGISTRY || 'higress-registry.cn-hangzhou.cr.aliyuncs.com' }}
176
+ GATEWAY_IMAGE_NAME : ${{ vars.GATEWAY_IMAGE_NAME || 'higress/gateway' }}
177
+ steps :
178
+ - name : " Checkout ${{ github.ref }}"
179
+ uses : actions/checkout@v4
180
+ with :
181
+ fetch-depth : 1
182
+
183
+ - name : Free Up GitHub Actions Ubuntu Runner Disk Space 🔧
184
+ uses : jlumbroso/free-disk-space@main
185
+ with :
186
+ tool-cache : false
187
+ android : true
188
+ dotnet : true
189
+ haskell : true
190
+ large-packages : true
191
+ swap-storage : true
192
+
193
+ - name : " Setup Go"
194
+ uses : actions/setup-go@v5
195
+ with :
196
+ go-version : 1.21.5
197
+
198
+ - name : Setup Golang Caches
199
+ uses : actions/cache@v4
200
+ with :
201
+ path : |-
202
+ ~/.cache/go-build
203
+ ~/go/pkg/mod
204
+ key : ${{ runner.os }}-go-${{ github.run_id }}
205
+ restore-keys : ${{ runner.os }}-go
206
+
207
+ - name : Set up QEMU
208
+ uses : docker/setup-qemu-action@v3
209
+ with :
210
+ image : tonistiigi/binfmt:qemu-v7.0.0
211
+
212
+ - name : Set up Docker Buildx
213
+ uses : docker/setup-buildx-action@v3
214
+
215
+ - name : Cache Docker layers
216
+ uses : actions/cache@v2
217
+ with :
218
+ path : /tmp/.buildx-cache
219
+ key : ${{ runner.os }}-buildx-${{ github.sha }}
220
+ restore-keys : |
221
+ ${{ runner.os }}-buildx-
222
+
223
+ - name : Calculate Docker metadata
224
+ id : docker-meta
225
+ uses : docker/metadata-action@v5
226
+ with :
227
+ images : |
228
+ ${{ env.GATEWAY_IMAGE_REGISTRY }}/${{ env.GATEWAY_IMAGE_NAME }}
229
+ tags : |
230
+ type=sha
231
+ type=ref,event=tag
232
+ type=semver,pattern={{version}}
233
+ type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
234
+
235
+ - name : Login to Docker Registry
236
+ uses : docker/login-action@v3
237
+ with :
238
+ registry : ${{ env.GATEWAY_IMAGE_REGISTRY }}
239
+ username : ${{ secrets.REGISTRY_USERNAME }}
240
+ password : ${{ secrets.REGISTRY_PASSWORD }}
241
+
242
+ - name : Build Gateway Image and Push
243
+ run : |
244
+ BUILT_IMAGE=""
245
+ readarray -t IMAGES <<< "${{ steps.docker-meta.outputs.tags }}"
246
+ for image in ${IMAGES[@]}; do
247
+ echo "Image: $image"
248
+ if [ "$BUILT_IMAGE" == "" ]; then
249
+ TAG=${image#*:}
250
+ HUB=${image%:*}
251
+ HUB=${HUB%/*}
252
+ BUILT_IMAGE="$HUB/proxyv2:$TAG"
253
+ GOPROXY="https://proxy.golang.org,direct" IMG_URL="$BUILT_IMAGE" make build-gateway
254
+ fi
255
+ if [ "$BUILT_IMAGE" != "$image" ]; then
256
+ docker buildx imagetools create $BUILT_IMAGE --tag $image
257
+ fi
258
+ done
0 commit comments