@@ -32,29 +32,31 @@ jobs:
32
32
- uses : actions/checkout@v3
33
33
with :
34
34
fetch-depth : 2
35
+
36
+ - id : check
37
+ run : |
38
+ if [ ${{ github.event_name }} != 'pull_request' ]; then
39
+ exit
40
+ fi
41
+ if git diff --name-only HEAD^ HEAD | grep -q ^dist/images/Dockerfile.base; then
42
+ echo buildx=1 >> "$GITHUB_OUTPUT"
43
+ fi
44
+
35
45
- uses : docker/setup-buildx-action@v2
36
- if : github.base_ref != null
46
+ if : steps.check.outputs.buildx == 1
47
+
37
48
- name : Build
49
+ id : build
50
+ if : steps.check.outputs.buildx == 1
38
51
run : |
39
- touch .CI_PASSED_VAR
40
52
if git diff --name-only HEAD^ HEAD | grep -q ^dist/images/Dockerfile.base$; then
41
- echo "BUILD_BASE=1" > .CI_PASSED_VAR
42
- echo "BUILD_BASE=1" >> "$GITHUB_ENV"
43
53
make base-amd64
44
54
make base-tar-amd64
45
- fi
46
- if git diff --name-only HEAD^ HEAD | grep -q ^dist/images/Dockerfile.base-dpdk$; then
47
- make base-amd64-dpdk
55
+ echo build-base=1 >> "$GITHUB_OUTPUT"
48
56
fi
49
57
50
- - name : Upload variable file to artifact
51
- uses : actions/upload-artifact@v3
52
- with :
53
- name : variables
54
- path : .CI_PASSED_VAR
55
-
56
58
- name : Upload base images to artifact
57
- if : env.BUILD_BASE == 1
59
+ if : steps.build.outputs.build-base == 1
58
60
uses : actions/upload-artifact@v3
59
61
with :
60
62
name : kube-ovn-base
@@ -99,22 +101,14 @@ jobs:
99
101
install "$tmp/gosec" /usr/local/bin
100
102
rm -rf $tmp
101
103
102
- - name : Download variable file
103
- uses : actions/download-artifact@v3
104
- with :
105
- name : variables
106
-
107
- - name : Export passed variables
108
- run : cat .CI_PASSED_VAR >> "$GITHUB_ENV"
109
-
110
104
- name : Download base images
111
- if : env.BUILD_BASE == 1
105
+ if : needs.build-kube-ovn-base.outputs.build-base == 1
112
106
uses : actions/download-artifact@v3
113
107
with :
114
108
name : kube-ovn-base
115
109
116
110
- name : Load base images
117
- if : env.BUILD_BASE == 1
111
+ if : needs.build-kube-ovn-base.outputs.build-base == 1
118
112
run : docker load --input image-amd64.tar
119
113
120
114
- name : Build
0 commit comments