Skip to content

Commit 6ac19b9

Browse files
committed
simplify github actions workflows (kubeovn#2338)
1 parent 9db146c commit 6ac19b9

File tree

4 files changed

+50
-69
lines changed

4 files changed

+50
-69
lines changed

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

+4-8
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ concurrency:
1919
group: "${{ github.workflow }}-${{ github.ref }}"
2020
cancel-in-progress: true
2121

22-
env:
23-
GO_VERSION: '1.19'
24-
2522
jobs:
2623
build:
2724
name: Build arm64
@@ -30,9 +27,8 @@ jobs:
3027
- uses: actions/checkout@v3
3128
- uses: actions/setup-go@v3
3229
with:
33-
go-version: '${{ env.GO_VERSION }}'
30+
go-version-file: go.mod
3431
check-latest: true
35-
id: go
3632

3733
- name: Set up QEMU
3834
uses: docker/setup-qemu-action@v2
@@ -56,10 +52,10 @@ jobs:
5652
restore-keys: ${{ runner.os }}-${{ env.GO_FULL_VER }}-arm64-
5753

5854
- name: Build
59-
run: |
60-
make release-arm || make release-arm
55+
run: make release-arm || make release-arm
56+
6157
- name: Push
62-
if: ${{ github.ref == 'refs/heads/master' || contains(github.ref, 'release') }}
58+
if: github.ref == github.event.repository.default_branch || startsWith(github.ref, 'release-')
6359
env:
6460
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
6561
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
run: |
1717
make build-dpdk
1818
- name: Push
19-
if: ${{ github.ref == 'refs/heads/master' || contains(github.ref, 'release') }}
19+
if: github.ref == github.event.repository.default_branch || startsWith(github.ref, 'release-')
2020
env:
2121
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
2222
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}

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

+44-55
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ name: Build x86 Image
22

33
on:
44
pull_request:
5+
types:
6+
- opened
7+
- synchronize
8+
- reopened
9+
- labeled
510
branches:
611
- master
712
- release-*
@@ -21,9 +26,7 @@ concurrency:
2126
cancel-in-progress: true
2227

2328
env:
24-
GO_VERSION: '1.19'
25-
GOSEC_VERSION: '2.12.0'
26-
KIND_VERSION: v0.17.0
29+
GOSEC_VERSION: '2.14.0'
2730
HELM_VERSION: v3.10.1
2831

2932
jobs:
@@ -35,9 +38,8 @@ jobs:
3538
- uses: docker/setup-buildx-action@v2
3639
- uses: actions/setup-go@v3
3740
with:
38-
go-version: '${{ env.GO_VERSION }}'
41+
go-version-file: go.mod
3942
check-latest: true
40-
id: go
4143

4244
- name: Export Go full version
4345
run: echo "GO_FULL_VER=$(go version | awk '{print $3}')" >> "$GITHUB_ENV"
@@ -134,9 +136,8 @@ jobs:
134136
135137
- uses: actions/setup-go@v3
136138
with:
137-
go-version: '${{ env.GO_VERSION }}'
139+
go-version-file: ${{ env.E2E_DIR }}/go.mod
138140
check-latest: true
139-
id: go
140141

141142
- name: Export Go full version
142143
run: echo "GO_FULL_VER=$(go version | awk '{print $3}')" >> "$GITHUB_ENV"
@@ -155,10 +156,9 @@ jobs:
155156
run: make e2e-compile
156157

157158
- name: Install kind
158-
run: |
159-
curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64
160-
chmod +x ./kind
161-
sudo mv kind /usr/local/bin
159+
uses: helm/kind-action@v1
160+
with:
161+
install_only: true
162162

163163
- name: Download image
164164
uses: actions/download-artifact@v3
@@ -189,6 +189,7 @@ jobs:
189189

190190
k8s-netpol-e2e:
191191
name: Kubernetes Network Policy E2E
192+
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'network policy')
192193
needs: build-kube-ovn
193194
runs-on: ubuntu-22.04
194195
timeout-minutes: 60
@@ -227,9 +228,8 @@ jobs:
227228
228229
- uses: actions/setup-go@v3
229230
with:
230-
go-version: '${{ env.GO_VERSION }}'
231+
go-version-file: ${{ env.E2E_DIR }}/go.mod
231232
check-latest: true
232-
id: go
233233

234234
- name: Export Go full version
235235
run: echo "GO_FULL_VER=$(go version | awk '{print $3}')" >> "$GITHUB_ENV"
@@ -248,10 +248,9 @@ jobs:
248248
run: make e2e-compile
249249

250250
- name: Install kind
251-
run: |
252-
curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64
253-
chmod +x ./kind
254-
sudo mv kind /usr/local/bin
251+
uses: helm/kind-action@v1
252+
with:
253+
install_only: true
255254

256255
- name: Download image
257256
uses: actions/download-artifact@v3
@@ -278,6 +277,7 @@ jobs:
278277

279278
cyclonus-netpol-e2e:
280279
name: Cyclonus Network Policy E2E
280+
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'network policy')
281281
needs: build-kube-ovn
282282
runs-on: ubuntu-22.04
283283
timeout-minutes: 30
@@ -310,10 +310,10 @@ jobs:
310310
fi
311311
312312
- name: Install kind
313-
run: |
314-
curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64
315-
chmod +x ./kind
316-
sudo mv kind /usr/local/bin
313+
uses: helm/kind-action@v1
314+
with:
315+
install_only: true
316+
317317
- name: Download image
318318
uses: actions/download-artifact@v3
319319
with:
@@ -349,9 +349,6 @@ jobs:
349349
- ipv4
350350
- ipv6
351351
- dual
352-
mode:
353-
- overlay
354-
- underlay
355352
steps:
356353
- uses: actions/checkout@v3
357354

@@ -375,9 +372,8 @@ jobs:
375372
376373
- uses: actions/setup-go@v3
377374
with:
378-
go-version: '${{ env.GO_VERSION }}'
375+
go-version-file: ${{ env.E2E_DIR }}/go.mod
379376
check-latest: true
380-
id: go
381377

382378
- name: Export Go full version
383379
run: echo "GO_FULL_VER=$(go version | awk '{print $3}')" >> "$GITHUB_ENV"
@@ -396,10 +392,9 @@ jobs:
396392
run: make e2e-compile
397393

398394
- name: Install kind
399-
run: |
400-
curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64
401-
chmod +x ./kind
402-
sudo mv kind /usr/local/bin
395+
uses: helm/kind-action@v1
396+
with:
397+
install_only: true
403398

404399
- name: Download image
405400
uses: actions/download-artifact@v3
@@ -418,14 +413,13 @@ jobs:
418413
sudo chown -R $(id -un). ~/.kube/
419414
420415
- name: Install Kube-OVN
421-
run: make kind-install-${{ matrix.mode }}-${{ matrix.ip-family }}
416+
run: make kind-install-${{ matrix.ip-family }}
422417

423418
- name: Run E2E
424419
working-directory: ${{ env.E2E_DIR }}
425420
env:
426421
E2E_BRANCH: ${{ github.base_ref || github.ref_name }}
427422
E2E_IP_FAMILY: ${{ matrix.ip-family }}
428-
E2E_NETWORK_MODE: ${{ matrix.mode }}
429423
run: make kube-ovn-conformance-e2e
430424

431425
- name: Cleanup
@@ -440,10 +434,9 @@ jobs:
440434
- uses: actions/checkout@v3
441435

442436
- name: Install kind
443-
run: |
444-
curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64
445-
chmod +x ./kind
446-
sudo mv kind /usr/local/bin
437+
uses: helm/kind-action@v1
438+
with:
439+
install_only: true
447440

448441
- name: Download image
449442
uses: actions/download-artifact@v3
@@ -476,10 +469,9 @@ jobs:
476469
- uses: actions/checkout@v3
477470

478471
- name: Install kind
479-
run: |
480-
curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64
481-
chmod +x ./kind
482-
sudo mv kind /usr/local/bin
472+
uses: helm/kind-action@v1
473+
with:
474+
install_only: true
483475

484476
- name: Download image
485477
uses: actions/download-artifact@v3
@@ -514,10 +506,9 @@ jobs:
514506
- uses: actions/checkout@v3
515507

516508
- name: Install kind
517-
run: |
518-
curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64
519-
chmod +x ./kind
520-
sudo mv kind /usr/local/bin
509+
uses: helm/kind-action@v1
510+
with:
511+
install_only: true
521512

522513
- name: Download image
523514
uses: actions/download-artifact@v3
@@ -552,10 +543,9 @@ jobs:
552543
- uses: actions/checkout@v3
553544

554545
- name: Install kind
555-
run: |
556-
curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64
557-
chmod +x ./kind
558-
sudo mv kind /usr/local/bin
546+
uses: helm/kind-action@v1
547+
with:
548+
install_only: true
559549

560550
- name: Download image
561551
uses: actions/download-artifact@v3
@@ -615,9 +605,8 @@ jobs:
615605
616606
- uses: actions/setup-go@v3
617607
with:
618-
go-version: '${{ env.GO_VERSION }}'
608+
go-version-file: ${{ env.E2E_DIR }}/go.mod
619609
check-latest: true
620-
id: go
621610

622611
- name: Export Go full version
623612
run: echo "GO_FULL_VER=$(go version | awk '{print $3}')" >> "$GITHUB_ENV"
@@ -636,10 +625,9 @@ jobs:
636625
run: make e2e-compile
637626

638627
- name: Install kind
639-
run: |
640-
curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64
641-
chmod +x ./kind
642-
sudo mv kind /usr/local/bin
628+
uses: helm/kind-action@v1
629+
with:
630+
install_only: true
643631

644632
- name: Download image
645633
uses: actions/download-artifact@v3
@@ -679,6 +667,7 @@ jobs:
679667
- no-np-test
680668
- cilium-chaining-e2e
681669
name: push
670+
if: always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
682671
runs-on: ubuntu-22.04
683672
steps:
684673
- uses: actions/checkout@v3
@@ -708,7 +697,7 @@ jobs:
708697
make scan
709698
710699
- name: Push
711-
if: ${{ github.ref == 'refs/heads/master' || contains(github.ref, 'release') }}
700+
if: github.ref_name == github.event.repository.default_branch || startsWith(github.ref_name, 'release-')
712701
env:
713702
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
714703
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}

.github/workflows/lint.yaml

+1-5
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ concurrency:
1212
group: "${{ github.workflow }}-${{ github.ref }}"
1313
cancel-in-progress: true
1414

15-
env:
16-
GO_VERSION: '1.19'
17-
1815
jobs:
1916
golangci:
2017
name: lint
@@ -23,9 +20,8 @@ jobs:
2320
- uses: actions/checkout@v3
2421
- uses: actions/setup-go@v3
2522
with:
26-
go-version: '${{ env.GO_VERSION }}'
23+
go-version-file: go.mod
2724
check-latest: true
28-
id: go
2925

3026
- name: golangci-lint
3127
uses: golangci/golangci-lint-action@v3

0 commit comments

Comments
 (0)