Skip to content

Commit f4033e7

Browse files
committed
ci: fix kube-ovn-base build
1 parent ea95477 commit f4033e7

File tree

1 file changed

+18
-24
lines changed

1 file changed

+18
-24
lines changed

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

+18-24
Original file line numberDiff line numberDiff line change
@@ -32,29 +32,31 @@ jobs:
3232
- uses: actions/checkout@v3
3333
with:
3434
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+
3545
- uses: docker/setup-buildx-action@v2
36-
if: github.base_ref != null
46+
if: steps.check.outputs.buildx == 1
47+
3748
- name: Build
49+
id: build
50+
if: steps.check.outputs.buildx == 1
3851
run: |
39-
touch .CI_PASSED_VAR
4052
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"
4353
make base-amd64
4454
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"
4856
fi
4957
50-
- name: Upload variable file to artifact
51-
uses: actions/upload-artifact@v3
52-
with:
53-
name: variables
54-
path: .CI_PASSED_VAR
55-
5658
- name: Upload base images to artifact
57-
if: env.BUILD_BASE == 1
59+
if: steps.build.outputs.build-base == 1
5860
uses: actions/upload-artifact@v3
5961
with:
6062
name: kube-ovn-base
@@ -99,22 +101,14 @@ jobs:
99101
install "$tmp/gosec" /usr/local/bin
100102
rm -rf $tmp
101103
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-
110104
- name: Download base images
111-
if: env.BUILD_BASE == 1
105+
if: needs.build-kube-ovn-base.outputs.build-base == 1
112106
uses: actions/download-artifact@v3
113107
with:
114108
name: kube-ovn-base
115109

116110
- name: Load base images
117-
if: env.BUILD_BASE == 1
111+
if: needs.build-kube-ovn-base.outputs.build-base == 1
118112
run: docker load --input image-amd64.tar
119113

120114
- name: Build

0 commit comments

Comments
 (0)