-
Notifications
You must be signed in to change notification settings - Fork 453
179 lines (162 loc) · 5.65 KB
/
build-kube-ovn-base.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
169
170
171
172
173
174
175
176
177
178
179
name: Build Base
on:
workflow_dispatch:
inputs:
branch:
description: "Select branch"
required: true
type: choice
options:
- master
- release-1.12
- release-1.11
- release-1.9
- release-1.12-mc
schedule:
- cron: "20 19 * * *"
jobs:
build-amd64:
strategy:
fail-fast: false
matrix:
branch:
- master
- release-1.12
- release-1.11
- release-1.9
- release-1.12-mc
name: Build AMD64
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
if: (github.event.inputs.branch || matrix.branch) == matrix.branch
with:
ref: ${{ matrix.branch }}
- uses: docker/setup-buildx-action@v3
if: (github.event.inputs.branch || matrix.branch) == matrix.branch
- uses: actions/setup-go@v5
if: (github.event.inputs.branch || matrix.branch) == matrix.branch
id: setup-go
with:
go-version-file: go.mod
check-latest: true
cache: false
- name: Build
if: (github.event.inputs.branch || matrix.branch) == matrix.branch
env:
GO_VERSION: ${{ steps.setup-go.outputs.go-version }}
TRIVY_DB_REPOSITORY: public.ecr.aws/aquasecurity/trivy-db:2
run: |
make base-amd64
make base-tar-amd64
- name: Upload image to artifact
if: (github.event.inputs.branch || matrix.branch) == matrix.branch
uses: actions/upload-artifact@v4
with:
name: image-amd64-${{ matrix.branch }}
path: image-amd64.tar
retention-days: 7
build-arm64:
strategy:
fail-fast: false
matrix:
branch:
- master
- release-1.12
- release-1.11
- release-1.9
- release-1.12-mc
name: Build ARM64
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
if: (github.event.inputs.branch || matrix.branch) == matrix.branch
with:
ref: ${{ matrix.branch }}
- uses: docker/setup-buildx-action@v3
if: (github.event.inputs.branch || matrix.branch) == matrix.branch
- uses: docker/setup-qemu-action@v3
if: (github.event.inputs.branch || matrix.branch) == matrix.branch
with:
platforms: arm64
- uses: actions/setup-go@v5
if: (github.event.inputs.branch || matrix.branch) == matrix.branch
id: setup-go
with:
go-version-file: go.mod
check-latest: true
cache: false
- name: Build
if: (github.event.inputs.branch || matrix.branch) == matrix.branch
env:
GO_VERSION: ${{ steps.setup-go.outputs.go-version }}
TRIVY_DB_REPOSITORY: public.ecr.aws/aquasecurity/trivy-db:2
run: |
make base-arm64 || make base-arm64
make base-tar-arm64
- name: Upload image to artifact
if: (github.event.inputs.branch || matrix.branch) == matrix.branch
uses: actions/upload-artifact@v4
with:
name: image-arm64-${{ matrix.branch }}
path: image-arm64.tar
retention-days: 7
push:
strategy:
fail-fast: false
matrix:
branch:
- master
- release-1.12
- release-1.11
- release-1.9
- release-1.12-mc
needs:
- build-arm64
- build-amd64
name: push
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
if: (github.event.inputs.branch || matrix.branch) == matrix.branch
with:
ref: ${{ matrix.branch }}
- name: Download image
if: (github.event.inputs.branch || matrix.branch) == matrix.branch
uses: actions/download-artifact@v4
with:
name: image-amd64-${{ matrix.branch }}
- name: Download image
if: (github.event.inputs.branch || matrix.branch) == matrix.branch
uses: actions/download-artifact@v4
with:
name: image-arm64-${{ matrix.branch }}
- name: Load Image
if: (github.event.inputs.branch || matrix.branch) == matrix.branch
run: |
docker load --input image-amd64.tar
docker load --input image-arm64.tar
- name: Push
if: (github.event.inputs.branch || matrix.branch) == matrix.branch
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
COMMIT: ${{ github.sha }}
run: |
cat VERSION
TAG=$(cat VERSION)
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
docker images
docker push kubeovn/kube-ovn-base:$TAG-amd64
docker push kubeovn/kube-ovn-base:$TAG-arm64
docker manifest create kubeovn/kube-ovn-base:$TAG kubeovn/kube-ovn-base:$TAG-amd64 kubeovn/kube-ovn-base:$TAG-arm64
docker manifest push kubeovn/kube-ovn-base:$TAG
if [ "${{ matrix.branch }}" = "master" -o "`printf '${{ matrix.branch }}\nrelease-1.11' | sort -Vr | head -n1`" = "${{ matrix.branch }}" ]; then
docker push kubeovn/kube-ovn-base:$TAG-debug-amd64
docker push kubeovn/kube-ovn-base:$TAG-debug-arm64
docker manifest create kubeovn/kube-ovn-base:$TAG-debug kubeovn/kube-ovn-base:$TAG-debug-amd64 kubeovn/kube-ovn-base:$TAG-debug-arm64
docker manifest push kubeovn/kube-ovn-base:$TAG-debug
fi
if [ "${{ matrix.branch }}" = "master" -o "`printf '${{ matrix.branch }}\nrelease-1.13' | sort -Vr | head -n1`" = "${{ matrix.branch }}" ]; then
docker push kubeovn/kube-ovn-base:$TAG-amd64-legacy
fi