Skip to content

Commit 74f492e

Browse files
committed
fix github actions workflows (kubeovn#2363)
1 parent 9554adf commit 74f492e

File tree

4 files changed

+122
-59
lines changed

4 files changed

+122
-59
lines changed

.github/workflows/build-windows.yaml

+4-6
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,9 @@ jobs:
6565

6666
build-ovs-and-ovn:
6767
name: Build OVS and OVN
68-
needs:
69-
- filter
68+
needs: filter
7069
runs-on: windows-2019
71-
if: github.event_name != 'pull_request' || needs.filter.outputs.build-ovs-ovn == 'true'
70+
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch' || needs.filter.outputs.build-ovs-ovn == 'true'
7271
steps:
7372
- name: Check out PTHREADS4W
7473
run: |
@@ -172,10 +171,9 @@ jobs:
172171

173172
build-kube-ovn:
174173
name: Build Kube-OVN
175-
needs:
176-
- filter
174+
needs: filter
177175
runs-on: windows-2019
178-
if: github.event_name != 'pull_request' || needs.filter.outputs.build-kube-ovn == 'true'
176+
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch' || needs.filter.outputs.build-kube-ovn == 'true'
179177
steps:
180178
- uses: actions/checkout@v3
181179
- uses: actions/setup-go@v3

.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: |
@@ -118,9 +123,57 @@ jobs:
118123
# name: centos8-compile
119124
# path: centos8-compile.tar
120125

126+
build-e2e-binaries:
127+
name: Build E2E Binaries
128+
runs-on: ubuntu-22.04
129+
timeout-minutes: 15
130+
steps:
131+
- uses: actions/checkout@v3
132+
133+
- name: Create the default branch directory
134+
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
135+
run: mkdir -p test/e2e/source
136+
137+
- name: Check out the default branch
138+
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
139+
uses: actions/checkout@v3
140+
with:
141+
ref: ${{ github.event.repository.default_branch }}
142+
fetch-depth: 1
143+
path: test/e2e/source
144+
145+
- name: Export E2E directory
146+
run: |
147+
if [ '${{ github.base_ref || github.ref_name }}' = '${{ github.event.repository.default_branch }}' ]; then
148+
echo "E2E_DIR=." >> "$GITHUB_ENV"
149+
else
150+
echo "E2E_DIR=test/e2e/source" >> "$GITHUB_ENV"
151+
fi
152+
153+
- uses: actions/setup-go@v3
154+
with:
155+
go-version-file: ${{ env.E2E_DIR }}/go.mod
156+
check-latest: true
157+
158+
- name: Export Go full version
159+
run: echo "GO_FULL_VER=$(go version | awk '{print $3}')" >> "$GITHUB_ENV"
160+
161+
- name: Go cache
162+
uses: actions/cache@v3
163+
with:
164+
path: |
165+
~/.cache/go-build
166+
~/go/pkg/mod
167+
key: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-${{ hashFiles(format('{0}/**/go.sum', env.E2E_DIR)) }}
168+
restore-keys: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-
169+
170+
- run: make e2e-compile
171+
121172
k8s-conformance-e2e:
122173
name: Kubernetes Conformance E2E
123-
needs: build-kube-ovn
174+
needs:
175+
- build-kube-ovn
176+
- build-e2e-binaries
124177
runs-on: ubuntu-22.04
125178
timeout-minutes: 60
126179
strategy:
@@ -137,9 +190,11 @@ jobs:
137190
- uses: actions/checkout@v3
138191

139192
- name: Create the default branch directory
193+
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
140194
run: mkdir -p test/e2e/source
141195

142196
- name: Check out the default branch
197+
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
143198
uses: actions/checkout@v3
144199
with:
145200
ref: ${{ github.event.repository.default_branch }}
@@ -168,18 +223,14 @@ jobs:
168223
run: echo "GO_FULL_VER=$(go version | awk '{print $3}')" >> "$GITHUB_ENV"
169224

170225
- name: Go cache
171-
uses: actions/cache@v3
226+
uses: actions/cache/restore@v3
172227
with:
173228
path: |
174229
~/.cache/go-build
175230
~/go/pkg/mod
176-
key: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-${{ hashFiles(format('{0}/**/go.sum', env.E2E_DIR)) }}
231+
key: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-${{ hashFiles(format('{0}/**/go.sum', env.E2E_DIR)) }}
177232
restore-keys: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-
178233

179-
- name: Build e2e binaries
180-
working-directory: ${{ env.E2E_DIR }}
181-
run: make e2e-compile
182-
183234
- name: Install kind
184235
uses: helm/kind-action@v1
185236
with:
@@ -215,7 +266,9 @@ jobs:
215266
k8s-netpol-e2e:
216267
name: Kubernetes Network Policy E2E
217268
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'network policy')
218-
needs: build-kube-ovn
269+
needs:
270+
- build-kube-ovn
271+
- build-e2e-binaries
219272
runs-on: ubuntu-22.04
220273
timeout-minutes: 60
221274
strategy:
@@ -229,9 +282,11 @@ jobs:
229282
- uses: actions/checkout@v3
230283

231284
- name: Create the default branch directory
285+
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
232286
run: mkdir -p test/e2e/source
233287

234288
- name: Check out the default branch
289+
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
235290
uses: actions/checkout@v3
236291
with:
237292
ref: ${{ github.event.repository.default_branch }}
@@ -260,18 +315,14 @@ jobs:
260315
run: echo "GO_FULL_VER=$(go version | awk '{print $3}')" >> "$GITHUB_ENV"
261316

262317
- name: Go cache
263-
uses: actions/cache@v3
318+
uses: actions/cache/restore@v3
264319
with:
265320
path: |
266321
~/.cache/go-build
267322
~/go/pkg/mod
268323
key: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-${{ hashFiles(format('{0}/**/go.sum', env.E2E_DIR)) }}
269324
restore-keys: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-
270325

271-
- name: Build e2e binaries
272-
working-directory: ${{ env.E2E_DIR }}
273-
run: make e2e-compile
274-
275326
- name: Install kind
276327
uses: helm/kind-action@v1
277328
with:
@@ -317,9 +368,11 @@ jobs:
317368
- uses: actions/checkout@v3
318369

319370
- name: Create the default branch directory
371+
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
320372
run: mkdir -p test/e2e/source
321373

322374
- name: Check out the default branch
375+
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
323376
uses: actions/checkout@v3
324377
with:
325378
ref: ${{ github.event.repository.default_branch }}
@@ -364,7 +417,9 @@ jobs:
364417

365418
kube-ovn-conformance-e2e:
366419
name: Kube-OVN Conformance E2E
367-
needs: build-kube-ovn
420+
needs:
421+
- build-kube-ovn
422+
- build-e2e-binaries
368423
runs-on: ubuntu-22.04
369424
timeout-minutes: 30
370425
strategy:
@@ -378,9 +433,11 @@ jobs:
378433
- uses: actions/checkout@v3
379434

380435
- name: Create the default branch directory
436+
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
381437
run: mkdir -p test/e2e/source
382438

383439
- name: Check out the default branch
440+
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
384441
uses: actions/checkout@v3
385442
with:
386443
ref: ${{ github.event.repository.default_branch }}
@@ -404,18 +461,14 @@ jobs:
404461
run: echo "GO_FULL_VER=$(go version | awk '{print $3}')" >> "$GITHUB_ENV"
405462

406463
- name: Go cache
407-
uses: actions/cache@v3
464+
uses: actions/cache/restore@v3
408465
with:
409466
path: |
410467
~/.cache/go-build
411468
~/go/pkg/mod
412469
key: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-${{ hashFiles(format('{0}/**/go.sum', env.E2E_DIR)) }}
413470
restore-keys: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-
414471

415-
- name: Build e2e binaries
416-
working-directory: ${{ env.E2E_DIR }}
417-
run: make e2e-compile
418-
419472
- name: Install kind
420473
uses: helm/kind-action@v1
421474
with:
@@ -452,16 +505,20 @@ jobs:
452505

453506
kube-ovn-ic-conformance-e2e:
454507
name: Kube-OVN IC Conformance E2E
455-
needs: build-kube-ovn
508+
needs:
509+
- build-kube-ovn
510+
- build-e2e-binaries
456511
runs-on: ubuntu-22.04
457512
timeout-minutes: 30
458513
steps:
459514
- uses: actions/checkout@v3
460515

461516
- name: Create the default branch directory
517+
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
462518
run: mkdir -p test/e2e/source
463519

464520
- name: Check out the default branch
521+
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
465522
uses: actions/checkout@v3
466523
with:
467524
ref: ${{ github.event.repository.default_branch }}
@@ -482,18 +539,14 @@ jobs:
482539
check-latest: true
483540

484541
- name: Go cache
485-
uses: actions/cache@v3
542+
uses: actions/cache/restore@v3
486543
with:
487544
path: |
488545
~/.cache/go-build
489546
~/go/pkg/mod
490547
key: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-${{ hashFiles(format('{0}/**/go.sum', env.E2E_DIR)) }}
491548
restore-keys: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-
492549

493-
- name: Build e2e binaries
494-
working-directory: ${{ env.E2E_DIR }}
495-
run: make e2e-compile
496-
497550
- name: Install kind
498551
uses: helm/kind-action@v1
499552
with:
@@ -703,7 +756,9 @@ jobs:
703756

704757
cilium-chaining-e2e:
705758
name: Cilium Chaining E2E
706-
needs: build-kube-ovn
759+
needs:
760+
- build-kube-ovn
761+
- build-e2e-binaries
707762
runs-on: ubuntu-22.04
708763
timeout-minutes: 30
709764
steps:
@@ -713,9 +768,11 @@ jobs:
713768
version: '${{ env.HELM_VERSION }}'
714769

715770
- name: Create the default branch directory
771+
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
716772
run: mkdir -p test/e2e/source
717773

718774
- name: Check out the default branch
775+
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
719776
uses: actions/checkout@v3
720777
with:
721778
ref: ${{ github.event.repository.default_branch }}
@@ -744,18 +801,14 @@ jobs:
744801
run: echo "GO_FULL_VER=$(go version | awk '{print $3}')" >> "$GITHUB_ENV"
745802

746803
- name: Go cache
747-
uses: actions/cache@v3
804+
uses: actions/cache/restore@v3
748805
with:
749806
path: |
750807
~/.cache/go-build
751808
~/go/pkg/mod
752809
key: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-${{ hashFiles(format('{0}/**/go.sum', env.E2E_DIR)) }}
753810
restore-keys: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-
754811

755-
- name: Build e2e binaries
756-
working-directory: ${{ env.E2E_DIR }}
757-
run: make e2e-compile
758-
759812
- name: Install kind
760813
uses: helm/kind-action@v1
761814
with:
@@ -789,7 +842,9 @@ jobs:
789842

790843
kube-ovn-security-e2e:
791844
name: Kube-OVN Security E2E
792-
needs: build-kube-ovn
845+
needs:
846+
- build-kube-ovn
847+
- build-e2e-binaries
793848
runs-on: ubuntu-22.04
794849
timeout-minutes: 30
795850
strategy:
@@ -809,9 +864,11 @@ jobs:
809864
- uses: actions/checkout@v3
810865

811866
- name: Create the default branch directory
867+
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
812868
run: mkdir -p test/e2e/source
813869

814870
- name: Check out the default branch
871+
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
815872
uses: actions/checkout@v3
816873
with:
817874
ref: ${{ github.event.repository.default_branch }}
@@ -835,18 +892,14 @@ jobs:
835892
run: echo "GO_FULL_VER=$(go version | awk '{print $3}')" >> "$GITHUB_ENV"
836893

837894
- name: Go cache
838-
uses: actions/cache@v3
895+
uses: actions/cache/restore@v3
839896
with:
840897
path: |
841898
~/.cache/go-build
842899
~/go/pkg/mod
843900
key: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-${{ hashFiles(format('{0}/**/go.sum', env.E2E_DIR)) }}
844901
restore-keys: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-
845902

846-
- name: Build e2e binaries
847-
working-directory: ${{ env.E2E_DIR }}
848-
run: make e2e-compile
849-
850903
- name: Install kind
851904
uses: helm/kind-action@v1
852905
with:

0 commit comments

Comments
 (0)