Skip to content

Commit 25c1907

Browse files
committed
fix github actions workflows (kubeovn#2363)
1 parent 0264ddc commit 25c1907

File tree

3 files changed

+117
-53
lines changed

3 files changed

+117
-53
lines changed

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

+93-40
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:
@@ -427,16 +480,20 @@ jobs:
427480

428481
kube-ovn-ic-conformance-e2e:
429482
name: Kube-OVN IC Conformance E2E
430-
needs: build-kube-ovn
483+
needs:
484+
- build-kube-ovn
485+
- build-e2e-binaries
431486
runs-on: ubuntu-22.04
432487
timeout-minutes: 30
433488
steps:
434489
- uses: actions/checkout@v3
435490

436491
- name: Create the default branch directory
492+
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
437493
run: mkdir -p test/e2e/source
438494

439495
- name: Check out the default branch
496+
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
440497
uses: actions/checkout@v3
441498
with:
442499
ref: ${{ github.event.repository.default_branch }}
@@ -460,18 +517,14 @@ jobs:
460517
run: echo "GO_FULL_VER=$(go version | awk '{print $3}')" >> "$GITHUB_ENV"
461518

462519
- name: Go cache
463-
uses: actions/cache@v3
520+
uses: actions/cache/restore@v3
464521
with:
465522
path: |
466523
~/.cache/go-build
467524
~/go/pkg/mod
468525
key: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-${{ hashFiles(format('{0}/**/go.sum', env.E2E_DIR)) }}
469526
restore-keys: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-
470527

471-
- name: Build e2e binaries
472-
working-directory: ${{ env.E2E_DIR }}
473-
run: make e2e-compile
474-
475528
- name: Install kind
476529
uses: helm/kind-action@v1
477530
with:
@@ -720,7 +773,9 @@ jobs:
720773

721774
cilium-chaining-e2e:
722775
name: Cilium Chaining E2E
723-
needs: build-kube-ovn
776+
needs:
777+
- build-kube-ovn
778+
- build-e2e-binaries
724779
runs-on: ubuntu-22.04
725780
timeout-minutes: 30
726781
steps:
@@ -730,9 +785,11 @@ jobs:
730785
version: '${{ env.HELM_VERSION }}'
731786

732787
- name: Create the default branch directory
788+
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
733789
run: mkdir -p test/e2e/source
734790

735791
- name: Check out the default branch
792+
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
736793
uses: actions/checkout@v3
737794
with:
738795
ref: ${{ github.event.repository.default_branch }}
@@ -761,18 +818,14 @@ jobs:
761818
run: echo "GO_FULL_VER=$(go version | awk '{print $3}')" >> "$GITHUB_ENV"
762819

763820
- name: Go cache
764-
uses: actions/cache@v3
821+
uses: actions/cache/restore@v3
765822
with:
766823
path: |
767824
~/.cache/go-build
768825
~/go/pkg/mod
769826
key: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-${{ hashFiles(format('{0}/**/go.sum', env.E2E_DIR)) }}
770827
restore-keys: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-
771828

772-
- name: Build e2e binaries
773-
working-directory: ${{ env.E2E_DIR }}
774-
run: make e2e-compile
775-
776829
- name: Install kind
777830
uses: helm/kind-action@v1
778831
with:
@@ -806,7 +859,9 @@ jobs:
806859

807860
kube-ovn-security-e2e:
808861
name: Kube-OVN Security E2E
809-
needs: build-kube-ovn
862+
needs:
863+
- build-kube-ovn
864+
- build-e2e-binaries
810865
runs-on: ubuntu-22.04
811866
timeout-minutes: 30
812867
strategy:
@@ -826,9 +881,11 @@ jobs:
826881
- uses: actions/checkout@v3
827882

828883
- name: Create the default branch directory
884+
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
829885
run: mkdir -p test/e2e/source
830886

831887
- name: Check out the default branch
888+
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
832889
uses: actions/checkout@v3
833890
with:
834891
ref: ${{ github.event.repository.default_branch }}
@@ -852,18 +909,14 @@ jobs:
852909
run: echo "GO_FULL_VER=$(go version | awk '{print $3}')" >> "$GITHUB_ENV"
853910

854911
- name: Go cache
855-
uses: actions/cache@v3
912+
uses: actions/cache/restore@v3
856913
with:
857914
path: |
858915
~/.cache/go-build
859916
~/go/pkg/mod
860917
key: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-${{ hashFiles(format('{0}/**/go.sum', env.E2E_DIR)) }}
861918
restore-keys: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-
862919

863-
- name: Build e2e binaries
864-
working-directory: ${{ env.E2E_DIR }}
865-
run: make e2e-compile
866-
867920
- name: Install kind
868921
uses: helm/kind-action@v1
869922
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

0 commit comments

Comments
 (0)