Skip to content

Commit

Permalink
ci: fix dpdk jobs (kubeovn#3405)
Browse files Browse the repository at this point in the history
Signed-off-by: zhangzujian <[email protected]>
  • Loading branch information
zhangzujian committed Nov 15, 2023
1 parent 459e2d6 commit 3903506
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 47 deletions.
93 changes: 74 additions & 19 deletions .github/workflows/build-x86-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
name: Build kube-ovn-base
runs-on: ubuntu-22.04
outputs:
build-base: ${{ steps.build.outputs.build-base }}
build-base: ${{ steps.check.outputs.build-base }}
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -42,41 +42,68 @@ jobs:
if [ ${{ github.event_name }} != 'pull_request' ]; then
exit
fi
if git diff --name-only HEAD^ HEAD | grep -q ^dist/images/Dockerfile.base; then
echo buildx=1 >> "$GITHUB_OUTPUT"
if git diff --name-only HEAD^ HEAD | grep -q ^dist/images/Dockerfile.base$; then
echo build-base=1 >> "$GITHUB_OUTPUT"
fi
- uses: docker/setup-buildx-action@v2
if: steps.check.outputs.buildx == 1
- uses: docker/setup-buildx-action@v3
if: steps.check.outputs.build-base == 1

- name: Build kube-ovn-base image
id: build
if: steps.check.outputs.buildx == 1
if: steps.check.outputs.build-base == 1
run: |
if git diff --name-only HEAD^ HEAD | grep -q ^dist/images/Dockerfile.base$; then
make base-amd64
make base-tar-amd64
echo build-base=1 >> "$GITHUB_OUTPUT"
fi
- name: Upload base images to artifact
if: steps.build.outputs.build-base == 1
if: steps.check.outputs.build-base == 1
uses: actions/upload-artifact@v3
with:
name: kube-ovn-base
path: image-amd64.tar

- name: Build kube-ovn-base-dpdk image
id: build
if: steps.check.outputs.buildx == 1
build-kube-ovn-dpdk-base:
name: Build kube-ovn-dpdk-base
runs-on: ubuntu-22.04
outputs:
build-dpdk-base: ${{ steps.check.outputs.build-dpdk-base }}
steps:
- uses: jlumbroso/[email protected]
with:
android: true
dotnet: true
haskell: true
docker-images: false
large-packages: false
tool-cache: false
swap-storage: false

- uses: actions/checkout@v4
with:
fetch-depth: 2

- id: check
run: |
if [ ${{ github.event_name }} != 'pull_request' ]; then
exit
fi
if git diff --name-only HEAD^ HEAD | grep -q ^dist/images/Dockerfile.base-dpdk$; then
make base-amd64-dpdk
echo build-base-dpdk=1 >> "$GITHUB_OUTPUT"
echo build-dpdk-base=1 >> "$GITHUB_OUTPUT"
fi
- name: Upload base-dpdk images to artifact
if: steps.build.outputs.build-base-dpdk == 1
- uses: docker/setup-buildx-action@v3
if: steps.check.outputs.build-dpdk-base == 1

- name: Build kube-ovn-dpdk-base image
id: build
if: steps.check.outputs.build-dpdk-base == 1
run: |
make base-amd64-dpdk
make base-tar-amd64-dpdk
- name: Upload dpdk base images to artifact
if: steps.check.outputs.build-dpdk-base == 1
uses: actions/upload-artifact@v3
with:
name: kube-ovn-base-dpdk
Expand All @@ -86,7 +113,9 @@ jobs:
build-kube-ovn:
name: Build kube-ovn
runs-on: ubuntu-22.04
needs: build-kube-ovn-base
needs:
- build-kube-ovn-base
- build-kube-ovn-dpdk-base
steps:
- uses: actions/checkout@v3
- uses: docker/setup-buildx-action@v2
Expand Down Expand Up @@ -152,19 +181,36 @@ jobs:
TAG=$(cat VERSION)
docker tag kubeovn/kube-ovn-base:$TAG-amd64 kubeovn/kube-ovn-base:$TAG
docker tag kubeovn/kube-ovn-base:$TAG-debug-amd64 kubeovn/kube-ovn-base:$TAG-debug
docker tag kubeovn/kube-ovn-base:$TAG-amd64-dpdk kubeovn/kube-ovn-base:$TAG-dpdk
make build-kube-ovn
else
make image-kube-ovn
fi
make tar-kube-ovn
- name: Build dpdk
run: |
if [ ${{ needs.build-kube-ovn-dpdk-base.outputs.build-dpdk-base || 0 }} = 1 ]; then
TAG=$(cat VERSION)
docker tag kubeovn/kube-ovn-base:$TAG-amd64-dpdk kubeovn/kube-ovn-base:$TAG-dpdk
make build-kube-ovn-dpdk
else
make image-kube-ovn-dpdk
fi
make tar-kube-ovn-dpdk
- name: Upload images to artifact
uses: actions/upload-artifact@v3
with:
name: kube-ovn
path: kube-ovn.tar

- name: Upload dpdk images to artifact
uses: actions/upload-artifact@v3
if: github.event_name != 'pull_request'
with:
name: kube-ovn-dpdk
path: kube-ovn-dpdk.tar

build-vpc-nat-gateway:
name: Build vpc-nat-gateway
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -2099,6 +2145,12 @@ jobs:
with:
name: kube-ovn

- name: Download kube-ovn-dpdk image
uses: actions/download-artifact@v3
if: github.event_name != 'pull_request'
with:
name: kube-ovn-dpdk

- name: Download vpc-nat-gateway image
uses: actions/download-artifact@v3
with:
Expand All @@ -2120,6 +2172,9 @@ jobs:
docker load --input vpc-nat-gateway.tar
docker load --input centos7-compile.tar
# docker load --input centos8-compile.tar
if [ '${{ github.event_name }}' != 'pull_request' ]; then
docker load --input kube-ovn-dpdk.tar
fi
- name: Security Scan
run: |
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ broker-info.subm
broker-info.subm.*
broker-info-internal.subm
kube-ovn.tar
kube-ovn-dpdk.tar
vpc-nat-gateway.tar
image-amd64.tar
image-amd64-dpdk.tar
image-arm64.tar
test/**/*.test
kube-ovn-app-sa.yaml
Expand Down
18 changes: 14 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ build-go-arm:
build-kube-ovn: build-go
docker build -t $(REGISTRY)/kube-ovn:$(RELEASE_TAG) --build-arg VERSION=$(RELEASE_TAG) -f dist/images/Dockerfile dist/images/
docker build -t $(REGISTRY)/kube-ovn:$(DEBUG_TAG) --build-arg BASE_TAG=$(DEBUG_TAG) -f dist/images/Dockerfile dist/images/
docker build -t $(REGISTRY)/kube-ovn:$(RELEASE_TAG)-dpdk -f dist/images/Dockerfile.dpdk dist/images/

.PHONY: build-kube-ovn-dpdk
build-kube-ovn-dpdk: build-go
docker build -t $(REGISTRY)/kube-ovn:$(RELEASE_TAG)-dpdk --build-arg BASE_TAG=$(RELEASE_TAG)-dpdk -f dist/images/Dockerfile dist/images/

.PHONY: build-dev
build-dev: build-go
Expand Down Expand Up @@ -126,7 +129,10 @@ base-arm64:
image-kube-ovn: build-go
docker buildx build --platform linux/amd64 -t $(REGISTRY)/kube-ovn:$(RELEASE_TAG) --build-arg VERSION=$(RELEASE_TAG) -o type=docker -f dist/images/Dockerfile dist/images/
docker buildx build --platform linux/amd64 -t $(REGISTRY)/kube-ovn:$(DEBUG_TAG) --build-arg BASE_TAG=$(DEBUG_TAG) -o type=docker -f dist/images/Dockerfile dist/images/
docker buildx build --platform linux/amd64 -t $(REGISTRY)/kube-ovn:$(RELEASE_TAG)-dpdk --build-arg VERSION=$(RELEASE_TAG) -o type=docker -f dist/images/Dockerfile.dpdk dist/images/

.PHONY: image-kube-ovn-dpdk
image-kube-ovn-dpdk: build-go
docker buildx build --platform linux/amd64 -t $(REGISTRY)/kube-ovn:$(RELEASE_TAG)-dpdk --build-arg VERSION=$(RELEASE_TAG) --build-arg BASE_TAG=$(RELEASE_TAG)-dpdk -o type=docker -f dist/images/Dockerfile dist/images/

.PHONY: image-vpc-nat-gateway
image-vpc-nat-gateway:
Expand Down Expand Up @@ -160,7 +166,11 @@ push-release: release

.PHONY: tar-kube-ovn
tar-kube-ovn:
docker save $(REGISTRY)/kube-ovn:$(RELEASE_TAG) $(REGISTRY)/kube-ovn:$(DEBUG_TAG) $(REGISTRY)/kube-ovn:$(RELEASE_TAG)-dpdk -o kube-ovn.tar
docker save $(REGISTRY)/kube-ovn:$(RELEASE_TAG) $(REGISTRY)/kube-ovn:$(DEBUG_TAG) -o kube-ovn.tar

.PHONY: tar-kube-ovn-dpdk
tar-kube-ovn-dpdk:
docker save $(REGISTRY)/kube-ovn:$(RELEASE_TAG)-dpdk -o kube-ovn-dpdk.tar

.PHONY: tar-vpc-nat-gateway
tar-vpc-nat-gateway:
Expand Down Expand Up @@ -868,7 +878,7 @@ clean:
$(RM) ovn.yaml kube-ovn.yaml kube-ovn-crd.yaml
$(RM) ovn-ic-0.yaml ovn-ic-1.yaml
$(RM) kustomization.yaml kwok.yaml kwok-node.yaml
$(RM) kube-ovn.tar vpc-nat-gateway.tar image-amd64.tar image-arm64.tar
$(RM) kube-ovn.tar kube-ovn-dpdk.tar vpc-nat-gateway.tar image-amd64.tar image-amd64-dpdk.tar image-arm64.tar

.PHONY: changelog
changelog:
Expand Down
2 changes: 1 addition & 1 deletion dist/images/Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ ARG ARCH
ENV CNI_VERSION=v1.3.0
RUN curl -sSf -L --retry 5 https://github.com/containernetworking/plugins/releases/download/${CNI_VERSION}/cni-plugins-linux-${ARCH}-${CNI_VERSION}.tgz | tar -xz -C . ./loopback ./portmap ./macvlan

ENV KUBE_VERSION="v1.28.2"
ENV KUBE_VERSION="v1.28.3"

RUN curl -L https://dl.k8s.io/${KUBE_VERSION}/kubernetes-client-linux-${ARCH}.tar.gz | tar -xz -C . && cp ./kubernetes/client/bin/kubectl /usr/bin/kubectl \
&& chmod +x /usr/bin/kubectl && rm -rf ./kubernetes
Expand Down
23 changes: 0 additions & 23 deletions dist/images/Dockerfile.dpdk

This file was deleted.

0 comments on commit 3903506

Please sign in to comment.