From 538df0ed6c66fbdad8d97d7e739489bdd0662f2f Mon Sep 17 00:00:00 2001 From: Antonin Bas Date: Mon, 24 Jun 2024 10:07:12 -0700 Subject: [PATCH] Fix build warnings from BuildKit (#6476) Recent versions of BuildKit supports build checks: https://docs.docker.com/reference/build-checks/ Because our Github CI uses a very recent version of buildx (through docker/setup-buildx-action), CI builds have been reporting warnings because we do not use the same casing for the "FROM" and "as" keywords in our Dockerfiles: https://docs.docker.com/reference/build-checks/from-as-casing/ To avoid these warnings, we fix the casing in all Dockerfiles. Signed-off-by: Antonin Bas --- build/images/Dockerfile.build.agent.coverage | 2 +- build/images/Dockerfile.build.agent.ubi | 2 +- build/images/Dockerfile.build.agent.ubuntu | 2 +- build/images/Dockerfile.build.controller.coverage | 2 +- build/images/Dockerfile.build.controller.ubi | 2 +- build/images/Dockerfile.build.controller.ubuntu | 2 +- build/images/Dockerfile.build.windows | 4 ++-- build/images/Dockerfile.simulator.build.ubuntu | 2 +- build/images/base/Dockerfile | 2 +- build/images/base/Dockerfile.ubi | 2 +- build/images/codegen/Dockerfile | 2 +- build/images/flow-aggregator/Dockerfile | 2 +- build/images/flow-aggregator/Dockerfile.coverage | 2 +- build/images/ovs/Dockerfile | 2 +- build/images/ovs/Dockerfile.ubi | 2 +- build/images/ovs/Dockerfile.windows | 2 +- docs/cookbooks/multus/build/cni-dhcp-daemon/Dockerfile | 2 +- multicluster/build/images/Dockerfile.build | 2 +- multicluster/build/images/Dockerfile.build.coverage | 2 +- 19 files changed, 20 insertions(+), 20 deletions(-) diff --git a/build/images/Dockerfile.build.agent.coverage b/build/images/Dockerfile.build.agent.coverage index 2777b4659c2..9a1d3735035 100644 --- a/build/images/Dockerfile.build.agent.coverage +++ b/build/images/Dockerfile.build.agent.coverage @@ -14,7 +14,7 @@ ARG GO_VERSION ARG BUILD_TAG -FROM golang:${GO_VERSION} as antrea-build +FROM golang:${GO_VERSION} AS antrea-build WORKDIR /antrea diff --git a/build/images/Dockerfile.build.agent.ubi b/build/images/Dockerfile.build.agent.ubi index 3462ed1cd1e..85360c94e43 100644 --- a/build/images/Dockerfile.build.agent.ubi +++ b/build/images/Dockerfile.build.agent.ubi @@ -14,7 +14,7 @@ ARG GO_VERSION ARG BUILD_TAG -FROM golang:${GO_VERSION} as antrea-build +FROM golang:${GO_VERSION} AS antrea-build WORKDIR /antrea diff --git a/build/images/Dockerfile.build.agent.ubuntu b/build/images/Dockerfile.build.agent.ubuntu index 4d1168aff46..bebe826f818 100644 --- a/build/images/Dockerfile.build.agent.ubuntu +++ b/build/images/Dockerfile.build.agent.ubuntu @@ -14,7 +14,7 @@ ARG GO_VERSION ARG BUILD_TAG -FROM golang:${GO_VERSION} as antrea-build +FROM golang:${GO_VERSION} AS antrea-build WORKDIR /antrea diff --git a/build/images/Dockerfile.build.controller.coverage b/build/images/Dockerfile.build.controller.coverage index 6fe2919234b..346acb672bf 100644 --- a/build/images/Dockerfile.build.controller.coverage +++ b/build/images/Dockerfile.build.controller.coverage @@ -14,7 +14,7 @@ ARG GO_VERSION ARG BUILD_TAG -FROM golang:${GO_VERSION} as antrea-build +FROM golang:${GO_VERSION} AS antrea-build WORKDIR /antrea diff --git a/build/images/Dockerfile.build.controller.ubi b/build/images/Dockerfile.build.controller.ubi index d13b1105db8..73694bbc570 100644 --- a/build/images/Dockerfile.build.controller.ubi +++ b/build/images/Dockerfile.build.controller.ubi @@ -14,7 +14,7 @@ ARG GO_VERSION ARG BUILD_TAG -FROM golang:${GO_VERSION} as antrea-build +FROM golang:${GO_VERSION} AS antrea-build WORKDIR /antrea diff --git a/build/images/Dockerfile.build.controller.ubuntu b/build/images/Dockerfile.build.controller.ubuntu index 9a2e03bfb21..8b3ed63eac1 100644 --- a/build/images/Dockerfile.build.controller.ubuntu +++ b/build/images/Dockerfile.build.controller.ubuntu @@ -14,7 +14,7 @@ ARG GO_VERSION ARG BUILD_TAG -FROM golang:${GO_VERSION} as antrea-build +FROM golang:${GO_VERSION} AS antrea-build WORKDIR /antrea diff --git a/build/images/Dockerfile.build.windows b/build/images/Dockerfile.build.windows index 24cab356715..41c56939969 100644 --- a/build/images/Dockerfile.build.windows +++ b/build/images/Dockerfile.build.windows @@ -15,7 +15,7 @@ ARG GO_VERSION ARG OVS_VERSION -FROM --platform=linux/amd64 golang:${GO_VERSION} as antrea-build-windows +FROM --platform=linux/amd64 golang:${GO_VERSION} AS antrea-build-windows ARG CNI_BINARIES_VERSION ENV CNI_PLUGINS="./host-local.exe" @@ -42,7 +42,7 @@ RUN mkdir -p /go/k/antrea/bin && \ cp /antrea/bin/antctl.exe /go/k/antrea/bin/ && \ cp /antrea/bin/antrea-cni.exe /go/k/antrea/cni/antrea.exe -FROM antrea/windows-ovs:${OVS_VERSION} as antrea-ovs +FROM antrea/windows-ovs:${OVS_VERSION} AS antrea-ovs FROM mcr.microsoft.com/oss/kubernetes/windows-host-process-containers-base-image:v1.0.0 COPY --from=antrea-build-windows /go/k /k diff --git a/build/images/Dockerfile.simulator.build.ubuntu b/build/images/Dockerfile.simulator.build.ubuntu index 8fb8f487638..21bba8fe842 100644 --- a/build/images/Dockerfile.simulator.build.ubuntu +++ b/build/images/Dockerfile.simulator.build.ubuntu @@ -13,7 +13,7 @@ # limitations under the License. ARG GO_VERSION -FROM golang:${GO_VERSION} as antrea-build +FROM golang:${GO_VERSION} AS antrea-build WORKDIR /antrea diff --git a/build/images/base/Dockerfile b/build/images/base/Dockerfile index dab73d8a4a3..9f10ebddc0c 100644 --- a/build/images/base/Dockerfile +++ b/build/images/base/Dockerfile @@ -13,7 +13,7 @@ # limitations under the License. ARG BUILD_TAG -FROM ubuntu:22.04 as cni-binaries +FROM ubuntu:22.04 AS cni-binaries ARG CNI_BINARIES_VERSION diff --git a/build/images/base/Dockerfile.ubi b/build/images/base/Dockerfile.ubi index 2cb16dc54bc..0c101c89bbd 100644 --- a/build/images/base/Dockerfile.ubi +++ b/build/images/base/Dockerfile.ubi @@ -13,7 +13,7 @@ # limitations under the License. ARG BUILD_TAG -FROM ubuntu:22.04 as cni-binaries +FROM ubuntu:22.04 AS cni-binaries ARG CNI_BINARIES_VERSION diff --git a/build/images/codegen/Dockerfile b/build/images/codegen/Dockerfile index d5676ed378f..c04af21bc51 100644 --- a/build/images/codegen/Dockerfile +++ b/build/images/codegen/Dockerfile @@ -13,7 +13,7 @@ # limitations under the License. ARG GO_VERSION -FROM ubuntu:22.04 as protoc +FROM ubuntu:22.04 AS protoc RUN apt-get update && \ apt-get install -y --no-install-recommends wget ca-certificates unzip diff --git a/build/images/flow-aggregator/Dockerfile b/build/images/flow-aggregator/Dockerfile index 5b3e5841691..a7451fb00b0 100644 --- a/build/images/flow-aggregator/Dockerfile +++ b/build/images/flow-aggregator/Dockerfile @@ -13,7 +13,7 @@ # limitations under the License. ARG GO_VERSION -FROM golang:${GO_VERSION} as flow-aggregator-build +FROM golang:${GO_VERSION} AS flow-aggregator-build WORKDIR /antrea diff --git a/build/images/flow-aggregator/Dockerfile.coverage b/build/images/flow-aggregator/Dockerfile.coverage index 2b060898695..250b42bdf89 100644 --- a/build/images/flow-aggregator/Dockerfile.coverage +++ b/build/images/flow-aggregator/Dockerfile.coverage @@ -13,7 +13,7 @@ # limitations under the License. ARG GO_VERSION -FROM golang:${GO_VERSION} as flow-aggregator-build +FROM golang:${GO_VERSION} AS flow-aggregator-build WORKDIR /antrea diff --git a/build/images/ovs/Dockerfile b/build/images/ovs/Dockerfile index 4e6e7aaadd3..aad6aa0d9fb 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:22.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. diff --git a/build/images/ovs/Dockerfile.ubi b/build/images/ovs/Dockerfile.ubi index 7a39dff5782..9939c0d9494 100644 --- a/build/images/ovs/Dockerfile.ubi +++ b/build/images/ovs/Dockerfile.ubi @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM quay.io/centos/centos:stream9 as ovs-rpms +FROM quay.io/centos/centos:stream9 AS ovs-rpms # Some patches may not apply cleanly if a non-default version is provided. # See build/images/deps/ovs-version for the default version. ARG OVS_VERSION diff --git a/build/images/ovs/Dockerfile.windows b/build/images/ovs/Dockerfile.windows index b24ef486324..e713c1c1daf 100644 --- a/build/images/ovs/Dockerfile.windows +++ b/build/images/ovs/Dockerfile.windows @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM --platform=linux/amd64 ubuntu:22.04 as antrea-windows-builder +FROM --platform=linux/amd64 ubuntu:22.04 AS antrea-windows-builder ARG OVS_VERSION RUN apt-get update && \ diff --git a/docs/cookbooks/multus/build/cni-dhcp-daemon/Dockerfile b/docs/cookbooks/multus/build/cni-dhcp-daemon/Dockerfile index beea7b02aec..c5823977c45 100644 --- a/docs/cookbooks/multus/build/cni-dhcp-daemon/Dockerfile +++ b/docs/cookbooks/multus/build/cni-dhcp-daemon/Dockerfile @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM ubuntu:22.04 as cni-binary +FROM ubuntu:22.04 AS cni-binary LABEL maintainer="Antrea " LABEL description="A Docker which runs the dhcp daemon from the containernetworking project." diff --git a/multicluster/build/images/Dockerfile.build b/multicluster/build/images/Dockerfile.build index f4225c1a726..c1244d87e54 100644 --- a/multicluster/build/images/Dockerfile.build +++ b/multicluster/build/images/Dockerfile.build @@ -13,7 +13,7 @@ # limitations under the License. ARG GO_VERSION -FROM golang:${GO_VERSION} as antrea-build +FROM golang:${GO_VERSION} AS antrea-build WORKDIR /antrea diff --git a/multicluster/build/images/Dockerfile.build.coverage b/multicluster/build/images/Dockerfile.build.coverage index 9ab152159b1..1b72a756b24 100644 --- a/multicluster/build/images/Dockerfile.build.coverage +++ b/multicluster/build/images/Dockerfile.build.coverage @@ -13,7 +13,7 @@ # limitations under the License. ARG GO_VERSION -FROM golang:${GO_VERSION} as antrea-build +FROM golang:${GO_VERSION} AS antrea-build WORKDIR /antrea