diff --git a/Makefile b/Makefile index 2a5467477b5..d767679681e 100644 --- a/Makefile +++ b/Makefile @@ -17,9 +17,11 @@ GIT_HOOKS := $(shell find hack/git_client_side_hooks -type f -print) DOCKER_NETWORK ?= default TRIVY_TARGET_IMAGE ?= -DOCKER_BUILD_ARGS = --build-arg OVS_VERSION=$(OVS_VERSION) +DOCKER_BUILD_ARGS := --build-arg OVS_VERSION=$(OVS_VERSION) DOCKER_BUILD_ARGS += --build-arg GO_VERSION=$(GO_VERSION) -WIN_BUILD_ARGS = --build-arg GO_VERSION=$(GO_VERSION) +UBUNTU_BUILD_ARGS := $(DOCKER_BUILD_ARGS) --build-arg BUILD_TAG=22.04-ovs$(OVS_VERSION) +UBI_BUILD_ARGS := $(DOCKER_BUILD_ARGS) --build-arg BUILD_TAG=ovs$(OVS_VERSION) +WIN_BUILD_ARGS := --build-arg GO_VERSION=$(GO_VERSION) WIN_BUILD_ARGS += --build-arg CNI_BINARIES_VERSION=$(CNI_BINARIES_VERSION) WIN_BUILD_ARGS += --build-arg NANOSERVER_VERSION=$(NANOSERVER_VERSION) WIN_BUILD_ARGS += --build-arg WIN_BUILD_TAG=$(WIN_BUILD_TAG) @@ -330,9 +332,9 @@ mockgen: ubuntu: @echo "===> Building antrea/antrea-ubuntu Docker image <===" ifneq ($(NO_PULL),) - docker build -t antrea/antrea-ubuntu:$(DOCKER_IMG_VERSION) -f build/images/Dockerfile.ubuntu $(DOCKER_BUILD_ARGS) . + docker build -t antrea/antrea-ubuntu:$(DOCKER_IMG_VERSION) -f build/images/Dockerfile.ubuntu $(UBUNTU_BUILD_ARGS) . else - docker build --pull -t antrea/antrea-ubuntu:$(DOCKER_IMG_VERSION) -f build/images/Dockerfile.ubuntu $(DOCKER_BUILD_ARGS) . + docker build --pull -t antrea/antrea-ubuntu:$(DOCKER_IMG_VERSION) -f build/images/Dockerfile.ubuntu $(UBUNTU_BUILD_ARGS) . endif docker tag antrea/antrea-ubuntu:$(DOCKER_IMG_VERSION) antrea/antrea-ubuntu @@ -341,9 +343,9 @@ endif build-ubuntu: @echo "===> Building Antrea bins and antrea/antrea-ubuntu Docker image <===" ifneq ($(NO_PULL),) - docker build -t antrea/antrea-ubuntu:$(DOCKER_IMG_VERSION) -f build/images/Dockerfile.build.ubuntu $(DOCKER_BUILD_ARGS) . + docker build -t antrea/antrea-ubuntu:$(DOCKER_IMG_VERSION) -f build/images/Dockerfile.build.ubuntu $(UBUNTU_BUILD_ARGS) . else - docker build --pull -t antrea/antrea-ubuntu:$(DOCKER_IMG_VERSION) -f build/images/Dockerfile.build.ubuntu $(DOCKER_BUILD_ARGS) . + docker build --pull -t antrea/antrea-ubuntu:$(DOCKER_IMG_VERSION) -f build/images/Dockerfile.build.ubuntu $(UBUNTU_BUILD_ARGS) . endif docker tag antrea/antrea-ubuntu:$(DOCKER_IMG_VERSION) antrea/antrea-ubuntu @@ -352,9 +354,9 @@ endif build-ubi: @echo "===> Building Antrea bins and antrea/antrea-ubi Docker image <===" ifneq ($(NO_PULL),"") - docker build -t antrea/antrea-ubi:$(DOCKER_IMG_VERSION) -f build/images/Dockerfile.build.ubi $(DOCKER_BUILD_ARGS) . + docker build -t antrea/antrea-ubi:$(DOCKER_IMG_VERSION) -f build/images/Dockerfile.build.ubi $(UBI_BUILD_ARGS) . else - docker build --pull -t antrea/antrea-ubi:$(DOCKER_IMG_VERSION) -f build/images/Dockerfile.build.ubi $(DOCKER_BUILD_ARGS) . + docker build --pull -t antrea/antrea-ubi:$(DOCKER_IMG_VERSION) -f build/images/Dockerfile.build.ubi $(UBI_BUILD_ARGS) . endif docker tag antrea/antrea-ubi:$(DOCKER_IMG_VERSION) antrea/antrea-ubi @@ -372,9 +374,9 @@ endif build-ubuntu-coverage: @echo "===> Building Antrea bins and antrea/antrea-ubuntu-coverage Docker image <===" ifneq ($(NO_PULL),) - docker build -t antrea/antrea-ubuntu-coverage:$(DOCKER_IMG_VERSION) -f build/images/Dockerfile.build.coverage $(DOCKER_BUILD_ARGS) . + docker build -t antrea/antrea-ubuntu-coverage:$(DOCKER_IMG_VERSION) -f build/images/Dockerfile.build.coverage $(UBUNTU_BUILD_ARGS) . else - docker build --pull -t antrea/antrea-ubuntu-coverage:$(DOCKER_IMG_VERSION) -f build/images/Dockerfile.build.coverage $(DOCKER_BUILD_ARGS) . + docker build --pull -t antrea/antrea-ubuntu-coverage:$(DOCKER_IMG_VERSION) -f build/images/Dockerfile.build.coverage $(UBUNTU_BUILD_ARGS) . endif docker tag antrea/antrea-ubuntu-coverage:$(DOCKER_IMG_VERSION) antrea/antrea-ubuntu-coverage diff --git a/build/images/Dockerfile.build.coverage b/build/images/Dockerfile.build.coverage index 7b1aebd3ab3..f52f38e5ce9 100644 --- a/build/images/Dockerfile.build.coverage +++ b/build/images/Dockerfile.build.coverage @@ -13,7 +13,7 @@ # limitations under the License. ARG GO_VERSION -ARG OVS_VERSION +ARG BUILD_TAG FROM golang:${GO_VERSION} as antrea-build WORKDIR /antrea @@ -27,7 +27,7 @@ COPY . /antrea RUN make antrea-agent antrea-controller antrea-cni antctl-linux antrea-controller-instr-binary antrea-agent-instr-binary antctl-instr-binary RUN mv bin/antctl-linux bin/antctl -FROM antrea/base-ubuntu:${OVS_VERSION} +FROM antrea/base-ubuntu:${BUILD_TAG} LABEL maintainer="Antrea " LABEL description="The Docker image to deploy the Antrea CNI with code coverage measurement enabled (used for testing)." diff --git a/build/images/Dockerfile.build.ubi b/build/images/Dockerfile.build.ubi index 33099751fba..20e0554976d 100644 --- a/build/images/Dockerfile.build.ubi +++ b/build/images/Dockerfile.build.ubi @@ -13,7 +13,7 @@ # limitations under the License. ARG GO_VERSION -ARG OVS_VERSION +ARG BUILD_TAG FROM golang:${GO_VERSION} as antrea-build WORKDIR /antrea @@ -27,7 +27,7 @@ COPY . /antrea RUN make antrea-agent antrea-controller antrea-cni antctl-linux RUN mv bin/antctl-linux bin/antctl -FROM antrea/base-ubi:${OVS_VERSION} +FROM antrea/base-ubi:${BUILD_TAG} LABEL maintainer="Antrea " LABEL description="The Docker image to deploy the Antrea CNI. " diff --git a/build/images/Dockerfile.build.ubuntu b/build/images/Dockerfile.build.ubuntu index 1fec8336eff..c95410db54e 100644 --- a/build/images/Dockerfile.build.ubuntu +++ b/build/images/Dockerfile.build.ubuntu @@ -13,7 +13,7 @@ # limitations under the License. ARG GO_VERSION -ARG OVS_VERSION +ARG BUILD_TAG FROM golang:${GO_VERSION} as antrea-build WORKDIR /antrea @@ -27,7 +27,7 @@ COPY . /antrea RUN make antrea-agent antrea-controller antrea-cni antctl-linux RUN mv bin/antctl-linux bin/antctl -FROM antrea/base-ubuntu:${OVS_VERSION} +FROM antrea/base-ubuntu:${BUILD_TAG} LABEL maintainer="Antrea " LABEL description="The Docker image to deploy the Antrea CNI." diff --git a/build/images/Dockerfile.ubuntu b/build/images/Dockerfile.ubuntu index 11fd1cf0697..05db9e4ab77 100644 --- a/build/images/Dockerfile.ubuntu +++ b/build/images/Dockerfile.ubuntu @@ -12,8 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -ARG OVS_VERSION -FROM antrea/base-ubuntu:${OVS_VERSION} +ARG BUILD_TAG +FROM antrea/base-ubuntu:${BUILD_TAG} LABEL maintainer="Antrea " LABEL description="The Docker image to deploy the Antrea CNI." diff --git a/build/images/base/Dockerfile b/build/images/base/Dockerfile index daa5e4e665b..ce380849f13 100644 --- a/build/images/base/Dockerfile +++ b/build/images/base/Dockerfile @@ -12,8 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -ARG OVS_VERSION -FROM ubuntu:20.04 as cni-binaries +ARG BUILD_TAG +FROM ubuntu:22.04 as cni-binaries ARG CNI_BINARIES_VERSION ARG WHEREABOUTS_VERSION=v0.5.4 @@ -37,7 +37,7 @@ RUN set -eux; \ wget -q -O - https://github.com/containernetworking/plugins/releases/download/$CNI_BINARIES_VERSION/cni-plugins-linux-${pluginsArch}-$CNI_BINARIES_VERSION.tgz | tar xz -C /opt/cni/bin $CNI_PLUGINS; \ wget -q -O /opt/cni/bin/whereabouts https://github.com/k8snetworkplumbingwg/whereabouts/releases/download/$WHEREABOUTS_VERSION/whereabouts-${pluginsArch} && chmod +x /opt/cni/bin/whereabouts -FROM antrea/openvswitch:${OVS_VERSION} +FROM antrea/openvswitch:${BUILD_TAG} LABEL maintainer="Antrea " LABEL description="An Ubuntu based Docker base image for Antrea." diff --git a/build/images/base/Dockerfile.ubi b/build/images/base/Dockerfile.ubi index 7352071f829..ee03fa1a498 100644 --- a/build/images/base/Dockerfile.ubi +++ b/build/images/base/Dockerfile.ubi @@ -12,8 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -ARG OVS_VERSION -FROM ubuntu:20.04 as cni-binaries +ARG BUILD_TAG +FROM ubuntu:22.04 as cni-binaries ARG CNI_BINARIES_VERSION ARG WHEREABOUTS_VERSION=v0.5.1 @@ -37,7 +37,7 @@ RUN set -eux; \ wget -q -O - https://github.com/containernetworking/plugins/releases/download/$CNI_BINARIES_VERSION/cni-plugins-linux-${pluginsArch}-$CNI_BINARIES_VERSION.tgz | tar xz -C /opt/cni/bin $CNI_PLUGINS; \ wget -q -O /opt/cni/bin/whereabouts https://github.com/k8snetworkplumbingwg/whereabouts/releases/download/$WHEREABOUTS_VERSION/whereabouts-${pluginsArch} && chmod +x /opt/cni/bin/whereabouts -FROM antrea/openvswitch-ubi:${OVS_VERSION} +FROM antrea/openvswitch-ubi:${BUILD_TAG} LABEL maintainer="Antrea " LABEL description="An UBI8 based Docker base image for Antrea." diff --git a/build/images/base/build.sh b/build/images/base/build.sh index 1348242b169..163bfaae393 100755 --- a/build/images/base/build.sh +++ b/build/images/base/build.sh @@ -24,7 +24,7 @@ function echoerr { } _usage="Usage: $0 [--pull] [--push] [--platform ] [--distro [ubuntu|ubi]] -Build the antrea/base-ubuntu: image. +Build the antrea base image. --pull Always attempt to pull a newer version of the base images --push Push the built image to the registry --platform Target platform for the image if server is multi-platform capable @@ -93,25 +93,36 @@ pushd $THIS_DIR > /dev/null OVS_VERSION=$(head -n 1 ../deps/ovs-version) CNI_BINARIES_VERSION=$(head -n 1 ../deps/cni-binaries-version) +BUILD_TAG="" +case "$DISTRO" in + "ubuntu") + BUILD_TAG="22.04-ovs$OVS_VERSION" + ;; + "ubi") + BUILD_TAG="ovs$OVS_VERSION" + ;; +esac +echo "BUILD_TAG: $BUILD_TAG" + if $PULL; then if [[ ${DOCKER_REGISTRY} == "" ]]; then - docker pull $PLATFORM_ARG ubuntu:20.04 + docker pull $PLATFORM_ARG ubuntu:22.04 else - docker pull ${DOCKER_REGISTRY}/antrea/ubuntu:20.04 - docker tag ${DOCKER_REGISTRY}/antrea/ubuntu:20.04 ubuntu:20.04 + docker pull ${DOCKER_REGISTRY}/antrea/ubuntu:22.04 + docker tag ${DOCKER_REGISTRY}/antrea/ubuntu:22.04 ubuntu:22.04 fi if [ "$DISTRO" == "ubuntu" ]; then IMAGES_LIST=( - "antrea/openvswitch:$OVS_VERSION" + "antrea/openvswitch:$BUILD_TAG" "antrea/cni-binaries:$CNI_BINARIES_VERSION" - "antrea/base-ubuntu:$OVS_VERSION" + "antrea/base-ubuntu:$BUILD_TAG" ) elif [ "$DISTRO" == "ubi" ]; then IMAGES_LIST=( - "antrea/openvswitch-ubi:$OVS_VERSION" + "antrea/openvswitch-ubi:$BUILD_TAG" "antrea/cni-binaries:$CNI_BINARIES_VERSION" - "antrea/base-ubi:$OVS_VERSION" + "antrea/base-ubi:$BUILD_TAG" ) fi for image in "${IMAGES_LIST[@]}"; do @@ -131,28 +142,28 @@ docker build $PLATFORM_ARG --target cni-binaries \ --cache-from antrea/cni-binaries:$CNI_BINARIES_VERSION \ -t antrea/cni-binaries:$CNI_BINARIES_VERSION \ --build-arg CNI_BINARIES_VERSION=$CNI_BINARIES_VERSION \ - --build-arg OVS_VERSION=$OVS_VERSION . + --build-arg BUILD_TAG=$BUILD_TAG . if [ "$DISTRO" == "ubuntu" ]; then docker build $PLATFORM_ARG \ --cache-from antrea/cni-binaries:$CNI_BINARIES_VERSION \ - --cache-from antrea/base-ubuntu:$OVS_VERSION \ - -t antrea/base-ubuntu:$OVS_VERSION \ + --cache-from antrea/base-ubuntu:$BUILD_TAG \ + -t antrea/base-ubuntu:$BUILD_TAG \ --build-arg CNI_BINARIES_VERSION=$CNI_BINARIES_VERSION \ - --build-arg OVS_VERSION=$OVS_VERSION . + --build-arg BUILD_TAG=$BUILD_TAG . elif [ "$DISTRO" == "ubi" ]; then docker build $PLATFORM_ARG \ --cache-from antrea/cni-binaries:$CNI_BINARIES_VERSION \ - --cache-from antrea/base-ubuntu:$OVS_VERSION \ - -t antrea/base-ubi:$OVS_VERSION \ + --cache-from antrea/base-ubi:$BUILD_TAG \ + -t antrea/base-ubi:$BUILD_TAG \ -f Dockerfile.ubi \ --build-arg CNI_BINARIES_VERSION=$CNI_BINARIES_VERSION \ - --build-arg OVS_VERSION=$OVS_VERSION . + --build-arg BUILD_TAG=$BUILD_TAG . fi if $PUSH; then docker push antrea/cni-binaries:$CNI_BINARIES_VERSION - docker push antrea/base-$DISTRO:$OVS_VERSION + docker push antrea/base-$DISTRO:$BUILD_TAG fi popd > /dev/null diff --git a/build/images/ovs/Dockerfile b/build/images/ovs/Dockerfile index b229f9fe35c..8dc33e1828e 100644 --- a/build/images/ovs/Dockerfile +++ b/build/images/ovs/Dockerfile @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM ubuntu:20.04 as ovs-debs +FROM ubuntu:22.04 as ovs-debs # Some patches may not apply cleanly if a non-default version is provided. # See build/images/deps/ovs-version for the default version. @@ -39,10 +39,10 @@ RUN wget -q -O - https://www.openvswitch.org/releases/openvswitch-$OVS_VERSION.t cd / && rm -rf /tmp/openvswitch* -FROM ubuntu:20.04 +FROM ubuntu:22.04 LABEL maintainer="Antrea " -LABEL description="A Docker image based on Ubuntu 20.04 which includes Open vSwitch built from source." +LABEL description="A Docker image based on Ubuntu 22.04 which includes Open vSwitch built from source." COPY --from=ovs-debs /tmp/ovs-debs/* /tmp/ovs-debs/ COPY charon-logging.conf /tmp diff --git a/build/images/ovs/README.md b/build/images/ovs/README.md index 455e4b8b16b..152ee146198 100644 --- a/build/images/ovs/README.md +++ b/build/images/ovs/README.md @@ -2,9 +2,9 @@ This directory contains utilities to build a Docker image which includes Open vSwitch (OVS) built from source. We build OVS from source because some features -of Antrea (such as IPsec) require a recent version of OVS, more recent than the -version included in Ubuntu 20.04. The built image is then used as the base image -for the Antrea main Docker image. +of Antrea (such as IPsec) may require a recent version of OVS, more recent than +the version included in the base distribution. The built image is then used as +the base image for the Antrea main Docker image. The image is re-built and pushed to Dockerhub periodically (every 12 hours) by a [Github workflow](/.github/workflows/update_ovs_image.yml). Therefore, there @@ -18,9 +18,5 @@ cd build/images/ovs ./build.sh --pull --push ``` -The image will be pushed to Dockerhub as `antrea/openvswitch:`. The -OVS version used is determined by the contents of the -`build/images/deps/ovs-version` file. - The script will fail if you do not have permission to push to the `antrea` Dockerhub repository. diff --git a/build/images/ovs/apply-patches.sh b/build/images/ovs/apply-patches.sh index 97edf183324..aa62b5a53ed 100755 --- a/build/images/ovs/apply-patches.sh +++ b/build/images/ovs/apply-patches.sh @@ -100,7 +100,7 @@ if version_lt "$OVS_VERSION" "2.18.0" ; then fi # OVS hardcodes the installation path to /usr/lib/python3.7/dist-packages/ but this location -# does not seem to be in the Python path in Ubuntu 20.04. There may be a better way to do this, +# does not seem to be in the Python path in Ubuntu 22.04. There may be a better way to do this, # but this seems like an acceptable workaround. -sed -i 's/python3\.7/python3\.8/' debian/openvswitch-test.install -sed -i 's/python3\.7/python3\.8/' debian/python3-openvswitch.install +sed -i 's/python3\.7/python3\.10/' debian/openvswitch-test.install +sed -i 's/python3\.7/python3\.10/' debian/python3-openvswitch.install diff --git a/build/images/ovs/build.sh b/build/images/ovs/build.sh index 3e09006db13..84f0a20a76d 100755 --- a/build/images/ovs/build.sh +++ b/build/images/ovs/build.sh @@ -24,7 +24,7 @@ function echoerr { } _usage="Usage: $0 [--pull] [--push] [--platform ] [--distro [ubuntu|ubi]] -Build the antrea/base-ubuntu: image. +Build the antrea openvswitch image. --pull Always attempt to pull a newer version of the base images --push Push the built image to the registry --platform Target platform for the image if server is multi-platform capable @@ -92,6 +92,17 @@ pushd $THIS_DIR > /dev/null OVS_VERSION=$(head -n 1 ../deps/ovs-version) +BUILD_TAG="" +case "$DISTRO" in + "ubuntu") + BUILD_TAG="22.04-ovs$OVS_VERSION" + ;; + "ubi") + BUILD_TAG="ovs$OVS_VERSION" + ;; +esac +echo "BUILD_TAG: $BUILD_TAG" + # This is a bit complicated but we make sure that we only build OVS if # necessary, and at the moment --cache-from does not play nicely with multistage # builds: we need to push the intermediate image to the registry. Note that the @@ -101,20 +112,20 @@ OVS_VERSION=$(head -n 1 ../deps/ovs-version) if $PULL; then if [[ ${DOCKER_REGISTRY} == "" ]]; then - docker pull $PLATFORM_ARG ubuntu:20.04 + docker pull $PLATFORM_ARG ubuntu:22.04 else - docker pull ${DOCKER_REGISTRY}/antrea/ubuntu:20.04 - docker tag ${DOCKER_REGISTRY}/antrea/ubuntu:20.04 ubuntu:20.04 + docker pull ${DOCKER_REGISTRY}/antrea/ubuntu:22.04 + docker tag ${DOCKER_REGISTRY}/antrea/ubuntu:22.04 ubuntu:22.04 fi if [ "$DISTRO" == "ubuntu" ]; then IMAGES_LIST=( - "antrea/openvswitch-debs:$OVS_VERSION" - "antrea/openvswitch:$OVS_VERSION" + "antrea/openvswitch-debs:$BUILD_TAG" + "antrea/openvswitch:$BUILD_TAG" ) elif [ "$DISTRO" == "ubi" ]; then IMAGES_LIST=( - "antrea/openvswitch-rpms:$OVS_VERSION" - "antrea/openvswitch-ubi:$OVS_VERSION" + "antrea/openvswitch-rpms:$BUILD_TAG" + "antrea/openvswitch-ubi:$BUILD_TAG" ) fi for image in "${IMAGES_LIST[@]}"; do @@ -132,37 +143,37 @@ fi if [ "$DISTRO" == "ubuntu" ]; then docker build $PLATFORM_ARG --target ovs-debs \ - --cache-from antrea/openvswitch-debs:$OVS_VERSION \ - -t antrea/openvswitch-debs:$OVS_VERSION \ + --cache-from antrea/openvswitch-debs:$BUILD_TAG \ + -t antrea/openvswitch-debs:$BUILD_TAG \ --build-arg OVS_VERSION=$OVS_VERSION . docker build $PLATFORM_ARG \ - --cache-from antrea/openvswitch-debs:$OVS_VERSION \ - --cache-from antrea/openvswitch:$OVS_VERSION \ - -t antrea/openvswitch:$OVS_VERSION \ + --cache-from antrea/openvswitch-debs:$BUILD_TAG \ + --cache-from antrea/openvswitch:$BUILD_TAG \ + -t antrea/openvswitch:$BUILD_TAG \ --build-arg OVS_VERSION=$OVS_VERSION . elif [ "$DISTRO" == "ubi" ]; then docker build $PLATFORM_ARG --target ovs-rpms \ - --cache-from antrea/openvswitch-rpms:$OVS_VERSION \ - -t antrea/openvswitch-rpms:$OVS_VERSION \ + --cache-from antrea/openvswitch-rpms:$BUILD_TAG \ + -t antrea/openvswitch-rpms:$BUILD_TAG \ --build-arg OVS_VERSION=$OVS_VERSION \ -f Dockerfile.ubi . docker build \ - --cache-from antrea/openvswitch-rpms:$OVS_VERSION \ - --cache-from antrea/openvswitch-ubi:$OVS_VERSION \ - -t antrea/openvswitch-ubi:$OVS_VERSION \ + --cache-from antrea/openvswitch-rpms:$BUILD_TAG \ + --cache-from antrea/openvswitch-ubi:$BUILD_TAG \ + -t antrea/openvswitch-ubi:$BUILD_TAG \ --build-arg OVS_VERSION=$OVS_VERSION \ -f Dockerfile.ubi . fi if $PUSH; then if [ "$DISTRO" == "ubuntu" ]; then - docker push antrea/openvswitch-debs:$OVS_VERSION - docker push antrea/openvswitch:$OVS_VERSION + docker push antrea/openvswitch-debs:$BUILD_TAG + docker push antrea/openvswitch:$BUILD_TAG elif [ "$DISTRO" == "ubi" ]; then - docker push antrea/openvswitch-rpms:$OVS_VERSION - docker push antrea/openvswitch-ubi:$OVS_VERSION + docker push antrea/openvswitch-rpms:$BUILD_TAG + docker push antrea/openvswitch-ubi:$BUILD_TAG fi fi diff --git a/build/images/test/Dockerfile b/build/images/test/Dockerfile index 63b3a1aa082..d75241b7fc3 100644 --- a/build/images/test/Dockerfile +++ b/build/images/test/Dockerfile @@ -13,7 +13,7 @@ # limitations under the License. ARG OVS_VERSION -FROM antrea/openvswitch:${OVS_VERSION} +FROM antrea/openvswitch:22.04-ovs${OVS_VERSION} LABEL maintainer="Antrea " LABEL description="A Docker image for Antrea integration tests." diff --git a/hack/build-antrea-linux-all.sh b/hack/build-antrea-linux-all.sh index bd931040d56..76bab25529b 100755 --- a/hack/build-antrea-linux-all.sh +++ b/hack/build-antrea-linux-all.sh @@ -21,9 +21,9 @@ function echoerr { } _usage="Usage: $0 [--pull] [--push-base-images] [--coverage] [--platform ] [--distro [ubuntu|ubi]] -Build the antrea/antrea-ubuntu image, as well as all the base images in the build chain. This is -typically used in CI to build the image with the latest version of all dependencies, taking into -account changes to all Dockerfiles. +Build the antrea image, as well as all the base images in the build chain. This is typically used in +CI to build the image with the latest version of all dependencies, taking into account changes to +all Dockerfiles. --pull Always attempt to pull a newer version of the base images. --push-base-images Push built images to the registry. Only base images will be pushed. --coverage Build the image with support for code coverage. @@ -105,6 +105,17 @@ OVS_VERSION=$(head -n 1 build/images/deps/ovs-version) CNI_BINARIES_VERSION=$(head -n 1 build/images/deps/cni-binaries-version) GO_VERSION=$(head -n 1 build/images/deps/go-version) +BUILD_TAG="" +case "$DISTRO" in + "ubuntu") + BUILD_TAG="22.04-ovs$OVS_VERSION" + ;; + "ubi") + BUILD_TAG="ovs$OVS_VERSION" + ;; +esac +echo "BUILD_TAG: $BUILD_TAG" + # We pull all images ahead of time, instead of calling the independent build.sh # scripts with "--pull". We do not want to overwrite the antrea/openvswitch # image we just built when calling build.sh to build the antrea/base-ubuntu @@ -112,27 +123,27 @@ GO_VERSION=$(head -n 1 build/images/deps/go-version) # new base images in the build chain. if $PULL; then if [[ ${DOCKER_REGISTRY} == "" ]]; then - docker pull $PLATFORM_ARG ubuntu:20.04 + docker pull $PLATFORM_ARG ubuntu:22.04 docker pull $PLATFORM_ARG golang:$GO_VERSION else - docker pull ${DOCKER_REGISTRY}/antrea/ubuntu:20.04 - docker tag ${DOCKER_REGISTRY}/antrea/ubuntu:20.04 ubuntu:20.04 + docker pull ${DOCKER_REGISTRY}/antrea/ubuntu:22.04 + docker tag ${DOCKER_REGISTRY}/antrea/ubuntu:22.04 ubuntu:22.04 docker pull ${DOCKER_REGISTRY}/antrea/golang:$GO_VERSION docker tag ${DOCKER_REGISTRY}/antrea/golang:$GO_VERSION golang:$GO_VERSION fi if [ "$DISTRO" == "ubuntu" ]; then IMAGES_LIST=( - "antrea/openvswitch-debs:$OVS_VERSION" - "antrea/openvswitch:$OVS_VERSION" + "antrea/openvswitch-debs:$BUILD_TAG" + "antrea/openvswitch:$BUILD_TAG" "antrea/cni-binaries:$CNI_BINARIES_VERSION" - "antrea/base-ubuntu:$OVS_VERSION" + "antrea/base-ubuntu:$BUILD_TAG" ) elif [ "$DISTRO" == "ubi" ]; then IMAGES_LIST=( - "antrea/openvswitch-rpms:$OVS_VERSION" - "antrea/openvswitch-ubi:$OVS_VERSION" + "antrea/openvswitch-rpms:$BUILD_TAG" + "antrea/openvswitch-ubi:$BUILD_TAG" "antrea/cni-binaries:$CNI_BINARIES_VERSION" - "antrea/base-ubi:$OVS_VERSION" + "antrea/base-ubi:$BUILD_TAG" ) fi for image in "${IMAGES_LIST[@]}"; do