Skip to content

Commit bb91456

Browse files
committed
fix github actions workflows (kubeovn#2363)
1 parent 6ac19b9 commit bb91456

File tree

3 files changed

+103
-41
lines changed

3 files changed

+103
-41
lines changed

.github/workflows/build-x86-image.yaml

+81-28
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ concurrency:
2626
cancel-in-progress: true
2727

2828
env:
29-
GOSEC_VERSION: '2.14.0'
30-
HELM_VERSION: v3.10.1
29+
GOSEC_VERSION: '2.15.0'
30+
HELM_VERSION: v3.10.3
3131

3232
jobs:
3333
build-kube-ovn:
@@ -60,7 +60,12 @@ jobs:
6060
6161
- name: Install gosec
6262
run: |
63-
curl -sfL https://raw.githubusercontent.com/securego/gosec/master/install.sh | sh -s -- -b $(go env GOPATH)/bin 'v${{ env.GOSEC_VERSION }}'
63+
tmp=$(mktemp -d)
64+
archive="gosec_${{ env.GOSEC_VERSION }}_$(go env GOHOSTOS)_$(go env GOHOSTARCH).tar.gz"
65+
wget -q -O "$tmp/$archive" https://github.com/securego/gosec/releases/download/v${{ env.GOSEC_VERSION }}/$archive
66+
tar --no-same-owner -C "$tmp" -xzf "$tmp/$archive"
67+
install "$tmp/gosec" /usr/local/bin
68+
rm -rf $tmp
6469
6570
- name: Build
6671
run: |
@@ -93,9 +98,57 @@ jobs:
9398
name: vpc-nat-gateway
9499
path: vpc-nat-gateway.tar
95100

101+
build-e2e-binaries:
102+
name: Build E2E Binaries
103+
runs-on: ubuntu-22.04
104+
timeout-minutes: 15
105+
steps:
106+
- uses: actions/checkout@v3
107+
108+
- name: Create the default branch directory
109+
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
110+
run: mkdir -p test/e2e/source
111+
112+
- name: Check out the default branch
113+
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
114+
uses: actions/checkout@v3
115+
with:
116+
ref: ${{ github.event.repository.default_branch }}
117+
fetch-depth: 1
118+
path: test/e2e/source
119+
120+
- name: Export E2E directory
121+
run: |
122+
if [ '${{ github.base_ref || github.ref_name }}' = '${{ github.event.repository.default_branch }}' ]; then
123+
echo "E2E_DIR=." >> "$GITHUB_ENV"
124+
else
125+
echo "E2E_DIR=test/e2e/source" >> "$GITHUB_ENV"
126+
fi
127+
128+
- uses: actions/setup-go@v3
129+
with:
130+
go-version-file: ${{ env.E2E_DIR }}/go.mod
131+
check-latest: true
132+
133+
- name: Export Go full version
134+
run: echo "GO_FULL_VER=$(go version | awk '{print $3}')" >> "$GITHUB_ENV"
135+
136+
- name: Go cache
137+
uses: actions/cache@v3
138+
with:
139+
path: |
140+
~/.cache/go-build
141+
~/go/pkg/mod
142+
key: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-${{ hashFiles(format('{0}/**/go.sum', env.E2E_DIR)) }}
143+
restore-keys: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-
144+
145+
- run: make e2e-compile
146+
96147
k8s-conformance-e2e:
97148
name: Kubernetes Conformance E2E
98-
needs: build-kube-ovn
149+
needs:
150+
- build-kube-ovn
151+
- build-e2e-binaries
99152
runs-on: ubuntu-22.04
100153
timeout-minutes: 60
101154
strategy:
@@ -112,9 +165,11 @@ jobs:
112165
- uses: actions/checkout@v3
113166

114167
- name: Create the default branch directory
168+
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
115169
run: mkdir -p test/e2e/source
116170

117171
- name: Check out the default branch
172+
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
118173
uses: actions/checkout@v3
119174
with:
120175
ref: ${{ github.event.repository.default_branch }}
@@ -143,18 +198,14 @@ jobs:
143198
run: echo "GO_FULL_VER=$(go version | awk '{print $3}')" >> "$GITHUB_ENV"
144199

145200
- name: Go cache
146-
uses: actions/cache@v3
201+
uses: actions/cache/restore@v3
147202
with:
148203
path: |
149204
~/.cache/go-build
150205
~/go/pkg/mod
151-
key: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-${{ hashFiles(format('{0}/**/go.sum', env.E2E_DIR)) }}
206+
key: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-${{ hashFiles(format('{0}/**/go.sum', env.E2E_DIR)) }}
152207
restore-keys: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-
153208

154-
- name: Build e2e binaries
155-
working-directory: ${{ env.E2E_DIR }}
156-
run: make e2e-compile
157-
158209
- name: Install kind
159210
uses: helm/kind-action@v1
160211
with:
@@ -190,7 +241,9 @@ jobs:
190241
k8s-netpol-e2e:
191242
name: Kubernetes Network Policy E2E
192243
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'network policy')
193-
needs: build-kube-ovn
244+
needs:
245+
- build-kube-ovn
246+
- build-e2e-binaries
194247
runs-on: ubuntu-22.04
195248
timeout-minutes: 60
196249
strategy:
@@ -204,9 +257,11 @@ jobs:
204257
- uses: actions/checkout@v3
205258

206259
- name: Create the default branch directory
260+
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
207261
run: mkdir -p test/e2e/source
208262

209263
- name: Check out the default branch
264+
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
210265
uses: actions/checkout@v3
211266
with:
212267
ref: ${{ github.event.repository.default_branch }}
@@ -235,18 +290,14 @@ jobs:
235290
run: echo "GO_FULL_VER=$(go version | awk '{print $3}')" >> "$GITHUB_ENV"
236291

237292
- name: Go cache
238-
uses: actions/cache@v3
293+
uses: actions/cache/restore@v3
239294
with:
240295
path: |
241296
~/.cache/go-build
242297
~/go/pkg/mod
243298
key: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-${{ hashFiles(format('{0}/**/go.sum', env.E2E_DIR)) }}
244299
restore-keys: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-
245300

246-
- name: Build e2e binaries
247-
working-directory: ${{ env.E2E_DIR }}
248-
run: make e2e-compile
249-
250301
- name: Install kind
251302
uses: helm/kind-action@v1
252303
with:
@@ -292,9 +343,11 @@ jobs:
292343
- uses: actions/checkout@v3
293344

294345
- name: Create the default branch directory
346+
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
295347
run: mkdir -p test/e2e/source
296348

297349
- name: Check out the default branch
350+
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
298351
uses: actions/checkout@v3
299352
with:
300353
ref: ${{ github.event.repository.default_branch }}
@@ -339,7 +392,9 @@ jobs:
339392

340393
kube-ovn-conformance-e2e:
341394
name: Kube-OVN Conformance E2E
342-
needs: build-kube-ovn
395+
needs:
396+
- build-kube-ovn
397+
- build-e2e-binaries
343398
runs-on: ubuntu-22.04
344399
timeout-minutes: 30
345400
strategy:
@@ -353,9 +408,11 @@ jobs:
353408
- uses: actions/checkout@v3
354409

355410
- name: Create the default branch directory
411+
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
356412
run: mkdir -p test/e2e/source
357413

358414
- name: Check out the default branch
415+
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
359416
uses: actions/checkout@v3
360417
with:
361418
ref: ${{ github.event.repository.default_branch }}
@@ -379,18 +436,14 @@ jobs:
379436
run: echo "GO_FULL_VER=$(go version | awk '{print $3}')" >> "$GITHUB_ENV"
380437

381438
- name: Go cache
382-
uses: actions/cache@v3
439+
uses: actions/cache/restore@v3
383440
with:
384441
path: |
385442
~/.cache/go-build
386443
~/go/pkg/mod
387444
key: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-${{ hashFiles(format('{0}/**/go.sum', env.E2E_DIR)) }}
388445
restore-keys: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-
389446

390-
- name: Build e2e binaries
391-
working-directory: ${{ env.E2E_DIR }}
392-
run: make e2e-compile
393-
394447
- name: Install kind
395448
uses: helm/kind-action@v1
396449
with:
@@ -570,8 +623,10 @@ jobs:
570623
run: sh dist/images/cleanup.sh
571624

572625
cilium-chaining-e2e:
573-
needs: build-kube-ovn
574626
name: Cilium Chaining E2E
627+
needs:
628+
- build-kube-ovn
629+
- build-e2e-binaries
575630
runs-on: ubuntu-22.04
576631
timeout-minutes: 30
577632
steps:
@@ -581,9 +636,11 @@ jobs:
581636
version: '${{ env.HELM_VERSION }}'
582637

583638
- name: Create the default branch directory
639+
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
584640
run: mkdir -p test/e2e/source
585641

586642
- name: Check out the default branch
643+
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
587644
uses: actions/checkout@v3
588645
with:
589646
ref: ${{ github.event.repository.default_branch }}
@@ -612,18 +669,14 @@ jobs:
612669
run: echo "GO_FULL_VER=$(go version | awk '{print $3}')" >> "$GITHUB_ENV"
613670

614671
- name: Go cache
615-
uses: actions/cache@v3
672+
uses: actions/cache/restore@v3
616673
with:
617674
path: |
618675
~/.cache/go-build
619676
~/go/pkg/mod
620677
key: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-${{ hashFiles(format('{0}/**/go.sum', env.E2E_DIR)) }}
621678
restore-keys: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-
622679

623-
- name: Build e2e binaries
624-
working-directory: ${{ env.E2E_DIR }}
625-
run: make e2e-compile
626-
627680
- name: Install kind
628681
uses: helm/kind-action@v1
629682
with:

.github/workflows/codeql-analysis.yml

+10-5
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ jobs:
3636
# a pull request then we can checkout the head.
3737
fetch-depth: 2
3838

39+
- uses: actions/setup-go@v3
40+
with:
41+
go-version-file: go.mod
42+
check-latest: true
43+
3944
# Initializes the CodeQL tools for scanning.
4045
- name: Initialize CodeQL
4146
uses: github/codeql-action/init@v1
@@ -48,8 +53,8 @@ jobs:
4853

4954
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5055
# If this step fails, then you should remove it and run the build manually (see below)
51-
- name: Autobuild
52-
uses: github/codeql-action/autobuild@v1
56+
# - name: Autobuild
57+
# uses: github/codeql-action/autobuild@v2
5358

5459
# ℹ️ Command-line programs to run using the OS shell.
5560
# 📚 https://git.io/JvXDl
@@ -58,9 +63,9 @@ jobs:
5863
# and modify them (or add more) to build your code if your project
5964
# uses a compiled language
6065

61-
#- run: |
62-
# make bootstrap
63-
# make release
66+
- name: Build
67+
run: |
68+
make build-go
6469
6570
- name: Perform CodeQL Analysis
6671
uses: github/codeql-action/analyze@v1

Makefile

+12-8
Original file line numberDiff line numberDiff line change
@@ -245,15 +245,12 @@ kind-untaint-control-plane:
245245
kind-install: kind-load-image
246246
kubectl config use-context kind-kube-ovn
247247
@$(MAKE) kind-untaint-control-plane
248-
bash dist/images/install.sh
248+
sed 's/VERSION=.*/VERSION=$(VERSION)/' dist/images/install.sh | bash
249249
kubectl describe no
250250

251251
.PHONY: kind-install-dev
252252
kind-install-dev:
253-
$(call kind_load_image,kube-ovn,$(REGISTRY)/kube-ovn:$(DEV_TAG))
254-
kubectl config use-context kind-kube-ovn
255-
@$(MAKE) kind-untaint-control-plane
256-
sed 's/VERSION=.*/VERSION=$(DEV_TAG)/' dist/images/install.sh | bash
253+
@VERSION=$(DEV_TAG) $(MAKE) kind-install
257254

258255
.PHONY: kind-install-ipv4
259256
kind-install-ipv4: kind-install-overlay-ipv4
@@ -268,8 +265,8 @@ kind-install-ovn-ic: kind-load-image kind-install
268265
sed -e 's/10.16.0/10.18.0/g' \
269266
-e 's/10.96.0/10.98.0/g' \
270267
-e 's/100.64.0/100.68.0/g' \
271-
dist/images/install.sh | \
272-
bash
268+
-e 's/VERSION=.*/VERSION=$(VERSION)/' \
269+
dist/images/install.sh | bash
273270
kubectl describe no
274271

275272
docker run -d --name ovn-ic-db --network kind $(REGISTRY)/kube-ovn:$(VERSION) bash start-ic-db.sh
@@ -300,6 +297,7 @@ kind-install-underlay-ipv4: kind-disable-hairpin kind-load-image kind-untaint-co
300297
-e 's@^[[:space:]]*POD_GATEWAY=.*@POD_GATEWAY="$(KIND_IPV4_GATEWAY)"@' \
301298
-e 's@^[[:space:]]*EXCLUDE_IPS=.*@EXCLUDE_IPS="$(KIND_IPV4_EXCLUDE_IPS)"@' \
302299
-e 's@^VLAN_ID=.*@VLAN_ID="0"@' \
300+
-e 's/VERSION=.*/VERSION=$(VERSION)/' \
303301
dist/images/install.sh | \
304302
ENABLE_VLAN=true VLAN_NIC=eth0 bash
305303
kubectl describe no
@@ -311,6 +309,7 @@ kind-install-underlay-hairpin-ipv4: kind-enable-hairpin kind-load-image kind-unt
311309
-e 's@^[[:space:]]*POD_GATEWAY=.*@POD_GATEWAY="$(KIND_IPV4_GATEWAY)"@' \
312310
-e 's@^[[:space:]]*EXCLUDE_IPS=.*@EXCLUDE_IPS="$(KIND_IPV4_EXCLUDE_IPS)"@' \
313311
-e 's@^VLAN_ID=.*@VLAN_ID="0"@' \
312+
-e 's/VERSION=.*/VERSION=$(VERSION)/' \
314313
dist/images/install.sh | \
315314
ENABLE_VLAN=true VLAN_NIC=eth0 bash
316315
kubectl describe no
@@ -329,6 +328,7 @@ kind-install-underlay-ipv6: kind-disable-hairpin kind-load-image kind-untaint-co
329328
-e 's@^[[:space:]]*POD_GATEWAY=.*@POD_GATEWAY="$(KIND_IPV6_GATEWAY)"@' \
330329
-e 's@^[[:space:]]*EXCLUDE_IPS=.*@EXCLUDE_IPS="$(KIND_IPV6_EXCLUDE_IPS)"@' \
331330
-e 's@^VLAN_ID=.*@VLAN_ID="0"@' \
331+
-e 's/VERSION=.*/VERSION=$(VERSION)/' \
332332
dist/images/install.sh | \
333333
IPV6=true ENABLE_VLAN=true VLAN_NIC=eth0 bash
334334

@@ -339,6 +339,7 @@ kind-install-underlay-hairpin-ipv6: kind-enable-hairpin kind-load-image kind-unt
339339
-e 's@^[[:space:]]*POD_GATEWAY=.*@POD_GATEWAY="$(KIND_IPV6_GATEWAY)"@' \
340340
-e 's@^[[:space:]]*EXCLUDE_IPS=.*@EXCLUDE_IPS="$(KIND_IPV6_EXCLUDE_IPS)"@' \
341341
-e 's@^VLAN_ID=.*@VLAN_ID="0"@' \
342+
-e 's/VERSION=.*/VERSION=$(VERSION)/' \
342343
dist/images/install.sh | \
343344
IPV6=true ENABLE_VLAN=true VLAN_NIC=eth0 bash
344345

@@ -356,6 +357,7 @@ kind-install-underlay-dual: kind-disable-hairpin kind-load-image kind-untaint-co
356357
-e 's@^[[:space:]]*POD_GATEWAY=.*@POD_GATEWAY="$(KIND_IPV4_GATEWAY),$(KIND_IPV6_GATEWAY)"@' \
357358
-e 's@^[[:space:]]*EXCLUDE_IPS=.*@EXCLUDE_IPS="$(KIND_IPV4_EXCLUDE_IPS),$(KIND_IPV6_EXCLUDE_IPS)"@' \
358359
-e 's@^VLAN_ID=.*@VLAN_ID="0"@' \
360+
-e 's/VERSION=.*/VERSION=$(VERSION)/' \
359361
dist/images/install.sh | \
360362
DUAL_STACK=true ENABLE_VLAN=true VLAN_NIC=eth0 bash
361363

@@ -366,6 +368,7 @@ kind-install-underlay-hairpin-dual: kind-enable-hairpin kind-load-image kind-unt
366368
-e 's@^[[:space:]]*POD_GATEWAY=.*@POD_GATEWAY="$(KIND_IPV4_GATEWAY),$(KIND_IPV6_GATEWAY)"@' \
367369
-e 's@^[[:space:]]*EXCLUDE_IPS=.*@EXCLUDE_IPS="$(KIND_IPV4_EXCLUDE_IPS),$(KIND_IPV6_EXCLUDE_IPS)"@' \
368370
-e 's@^VLAN_ID=.*@VLAN_ID="0"@' \
371+
-e 's/VERSION=.*/VERSION=$(VERSION)/' \
369372
dist/images/install.sh | \
370373
DUAL_STACK=true ENABLE_VLAN=true VLAN_NIC=eth0 bash
371374

@@ -396,7 +399,8 @@ kind-install-cilium: kind-load-image kind-untaint-control-plane
396399
--set cni.configMap=cni-configuration
397400
kubectl -n kube-system rollout status ds cilium --timeout 300s
398401
bash dist/images/cilium.sh
399-
ENABLE_LB=false ENABLE_NP=false WITHOUT_KUBE_PROXY=true CNI_CONFIG_PRIORITY=10 bash dist/images/install.sh
402+
sed 's/VERSION=.*/VERSION=$(VERSION)/' dist/images/install.sh | \
403+
ENABLE_LB=false ENABLE_NP=false WITHOUT_KUBE_PROXY=true CNI_CONFIG_PRIORITY=10 bash
400404
kubectl describe no
401405

402406
.PHONY: kind-reload

0 commit comments

Comments
 (0)