From 4911d78944bee5e1d47105040989e03e63ad00be Mon Sep 17 00:00:00 2001 From: Eoghan Russell Date: Fri, 8 Dec 2023 16:10:02 +0000 Subject: [PATCH 1/2] Fix Hadolint errors Signed-off-by: Eoghan Russell --- .github/workflows/static-scan.yml | 6 ++++-- ci/ci.sh | 4 +++- ci/ovs_test_setup/Dockerfile | 12 ++++++++---- ci/ovs_test_setup/testpmd_image/Dockerfile | 21 ++++++++++++++++++--- docker/testpmd/Dockerfile | 21 ++++++++++++++++++--- docker/userspacecni/Dockerfile | 18 +++++++++--------- 6 files changed, 60 insertions(+), 22 deletions(-) diff --git a/.github/workflows/static-scan.yml b/.github/workflows/static-scan.yml index af55ccd4..db130314 100644 --- a/.github/workflows/static-scan.yml +++ b/.github/workflows/static-scan.yml @@ -43,13 +43,15 @@ jobs: hadolint: runs-on: ubuntu-latest name: Hadolint + env: + HADOLINT_RECURSIVE: "true" steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - uses: hadolint/hadolint-action@54c9adbab1582c2ef04b2016b760714a4bfde3cf # v3.1.0 name: Run Hadolint with: - dockerfile: ./docker/userspacecni/Dockerfile - ignore: DL3008,DL3059 + recursive: true + ignore: DL3008,DL3059,DL3015 go-check: runs-on: ubuntu-latest diff --git a/ci/ci.sh b/ci/ci.sh index 64ca8483..130d7d84 100755 --- a/ci/ci.sh +++ b/ci/ci.sh @@ -127,9 +127,11 @@ kind load docker-image testpmd ovs_e2e_test(){ cd $CI_DIR/ovs_test_setup ./ovs_host.sh -sleep 20 +sleep 30 # workaround, cant create in dockerfile +kubectl get all -A +kubectl logs -n ovs pod/ovs-kind-control-plane kubectl exec -n ovs pod/ovs-kind-control-plane -- bash -c "mkdir -p /dev/net/" kubectl exec -n ovs pod/ovs-kind-control-plane -- bash -c "mknod /dev/net/tun c 10 200" kubectl exec -n ovs pod/ovs-kind-control-plane -- bash -c 'ovs-vsctl set Open_vSwitch . "other_config:dpdk-init=true"' diff --git a/ci/ovs_test_setup/Dockerfile b/ci/ovs_test_setup/Dockerfile index 0d60299f..5f239734 100644 --- a/ci/ovs_test_setup/Dockerfile +++ b/ci/ovs_test_setup/Dockerfile @@ -1,6 +1,10 @@ FROM ubuntu:22.04@sha256:2b7412e6465c3c7fc5bb21d3e6f1917c167358449fecac8176c6e496e5c1f05f -RUN apt-get -q update && apt-get install -y openvswitch-switch-dpdk +SHELL ["/bin/bash", "-o", "pipefail", "-c"] +RUN apt-get update -y \ + && apt-get install -y linux-headers-generic openvswitch-switch-dpdk \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* RUN update-alternatives --set ovs-vswitchd /usr/lib/openvswitch-switch-dpdk/ovs-vswitchd-dpdk -##RUN sed -i "/rmmod bridge/d" /usr/share/openvswitch/scripts/ovs-kmod-ctl -RUN apt install -y linux-headers-$(uname -r) -CMD /usr/share/openvswitch/scripts/ovs-ctl start && sleep inf +# RUN sed -i "/rmmod bridge/d" /usr/share/openvswitch/scripts/ovs-kmod-ctl +RUN apt-get install -y --no-install-recommends linux-headers-"$(uname -r | cut -d'-' -f1)" +CMD ["sh", "-c","/usr/share/openvswitch/scripts/ovs-ctl start && sleep inf"] diff --git a/ci/ovs_test_setup/testpmd_image/Dockerfile b/ci/ovs_test_setup/testpmd_image/Dockerfile index 38ae76ee..9f4ee061 100644 --- a/ci/ovs_test_setup/testpmd_image/Dockerfile +++ b/ci/ovs_test_setup/testpmd_image/Dockerfile @@ -1,9 +1,24 @@ FROM ubuntu:22.04@sha256:2b7412e6465c3c7fc5bb21d3e6f1917c167358449fecac8176c6e496e5c1f05f -RUN apt-get -q update && apt-get install -y git vim meson python3-pyelftools libnuma-dev +RUN apt-get -q update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + git \ + vim \ + meson \ + python3-pyelftools \ + libnuma-dev \ + python3-pip \ + ninja-build \ + build-essential \ + && pip3 install --no-cache-dir --upgrade meson==1.3.0 \ + && rm -rf /var/lib/apt/lists/* +RUN apt-get update -y \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ca-certificates \ + && rm -rf /var/lib/apt/lists/* RUN git clone https://github.com/DPDK/dpdk.git WORKDIR /dpdk/ RUN meson build -RUN cd build && ninja +WORKDIR /dpdk/build/ +RUN ninja WORKDIR /dpdk/build/app COPY ./testpmd.sh testpmd.sh -CMD ./testpmd.sh +CMD ["sh", "-c","./testpmd.sh"] diff --git a/docker/testpmd/Dockerfile b/docker/testpmd/Dockerfile index 38ae76ee..9f4ee061 100644 --- a/docker/testpmd/Dockerfile +++ b/docker/testpmd/Dockerfile @@ -1,9 +1,24 @@ FROM ubuntu:22.04@sha256:2b7412e6465c3c7fc5bb21d3e6f1917c167358449fecac8176c6e496e5c1f05f -RUN apt-get -q update && apt-get install -y git vim meson python3-pyelftools libnuma-dev +RUN apt-get -q update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + git \ + vim \ + meson \ + python3-pyelftools \ + libnuma-dev \ + python3-pip \ + ninja-build \ + build-essential \ + && pip3 install --no-cache-dir --upgrade meson==1.3.0 \ + && rm -rf /var/lib/apt/lists/* +RUN apt-get update -y \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ca-certificates \ + && rm -rf /var/lib/apt/lists/* RUN git clone https://github.com/DPDK/dpdk.git WORKDIR /dpdk/ RUN meson build -RUN cd build && ninja +WORKDIR /dpdk/build/ +RUN ninja WORKDIR /dpdk/build/app COPY ./testpmd.sh testpmd.sh -CMD ./testpmd.sh +CMD ["sh", "-c","./testpmd.sh"] diff --git a/docker/userspacecni/Dockerfile b/docker/userspacecni/Dockerfile index 05453beb..904ee96b 100644 --- a/docker/userspacecni/Dockerfile +++ b/docker/userspacecni/Dockerfile @@ -2,17 +2,17 @@ FROM ligato/vpp-base:23.06@sha256:f68272b0aebe106673c7fffe94b6e6ccd06ecc9afd123e SHELL ["/bin/bash", "-o", "pipefail", "-c"] COPY . /root/userspace-cni-network-plugin WORKDIR /root/userspace-cni-network-plugin -RUN apt-get update -y -RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y binutils wget make git -RUN wget -qO- https://golang.org/dl/go1.20.1.linux-amd64.tar.gz | tar -C /usr/local -xz +RUN apt-get update -y \ + && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y binutils bash wget make git \ + && wget -qO- https://golang.org/dl/go1.20.1.linux-amd64.tar.gz | tar -C /usr/local -xz \ + && rm -rf /var/lib/apt/lists/* ENV PATH="${PATH}:/usr/local/go/bin" -RUN go mod download -RUN go get go.fd.io/govpp/binapigen/vppapi@v0.7.0 -RUN make generate -RUN go mod tidy -RUN make generate-bin +RUN go mod download \ + && go get go.fd.io/govpp/binapigen/vppapi@v0.7.0 \ + && make generate \ + && go mod tidy \ + && make generate-bin #End of builder container - # Copy build userspace cni bin to a small deployer container FROM alpine:3.18@sha256:eece025e432126ce23f223450a0326fbebde39cdf496a85d8c016293fc851978 RUN mkdir -p /root/userspace-cni-network-plugin/userspace From 43817bc4cbb98cb95a3a141e9b81c2cfe5082c1c Mon Sep 17 00:00:00 2001 From: Eoghan Russell Date: Wed, 13 Dec 2023 15:36:48 +0000 Subject: [PATCH 2/2] Removing redundancy code Signed-off-by: Eoghan Russell --- ci/ci.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ci/ci.sh b/ci/ci.sh index 130d7d84..fda2ebe9 100755 --- a/ci/ci.sh +++ b/ci/ci.sh @@ -127,18 +127,16 @@ kind load docker-image testpmd ovs_e2e_test(){ cd $CI_DIR/ovs_test_setup ./ovs_host.sh -sleep 30 +sleep 20 # workaround, cant create in dockerfile -kubectl get all -A -kubectl logs -n ovs pod/ovs-kind-control-plane kubectl exec -n ovs pod/ovs-kind-control-plane -- bash -c "mkdir -p /dev/net/" kubectl exec -n ovs pod/ovs-kind-control-plane -- bash -c "mknod /dev/net/tun c 10 200" kubectl exec -n ovs pod/ovs-kind-control-plane -- bash -c 'ovs-vsctl set Open_vSwitch . "other_config:dpdk-init=true"' ./testpmd_pod.sh -sleep 30 +sleep 20 kubectl get all -A kubectl logs -n ovs pod/ovs-kind-control-plane kubectl describe -n ovs pod/ovs-app1-kind-control-plane