From 3e42b84e949289938801316f6a53d9a09809d1bc Mon Sep 17 00:00:00 2001 From: Ali Afsharzadeh Date: Fri, 30 Jan 2026 17:57:44 +0330 Subject: [PATCH] Upgrade Dockerfile base image from Ubuntu 22.04 to 24.04 (#12935) * Upgrade Dockerfile base image from Ubuntu 22.04 to 24.04 * Add --break-system-packages flag to testcases_run.sh file --- Dockerfile | 6 +++--- pipeline.Dockerfile | 11 +++++------ scripts/Dockerfile.j2 | 6 +++--- scripts/pipeline.Dockerfile.j2 | 11 +++++------ tests/scripts/testcases_run.sh | 4 ++-- 5 files changed, 18 insertions(+), 20 deletions(-) diff --git a/Dockerfile b/Dockerfile index c36a5ea2c..776026e18 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # syntax=docker/dockerfile:1 -# Use immutable image tags rather than mutable tags (like ubuntu:22.04) -FROM ubuntu:22.04@sha256:149d67e29f765f4db62aa52161009e99e389544e25a8f43c8c89d4a445a7ca37 +# Use immutable image tags rather than mutable tags (like ubuntu:24.04) +FROM ubuntu:noble-20260113@sha256:cd1dba651b3080c3686ecf4e3c4220f026b521fb76978881737d24f200828b2b # Some tools like yamllint need this # Pip needs this as well at the moment to install ansible @@ -29,7 +29,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ RUN --mount=type=bind,source=requirements.txt,target=requirements.txt \ --mount=type=cache,sharing=locked,id=pipcache,mode=0777,target=/root/.cache/pip \ - pip install --no-compile --no-cache-dir -r requirements.txt \ + pip install --break-system-packages --no-compile --no-cache-dir -r requirements.txt \ && find /usr -type d -name '*__pycache__' -prune -exec rm -rf {} \; SHELL ["/bin/bash", "-o", "pipefail", "-c"] diff --git a/pipeline.Dockerfile b/pipeline.Dockerfile index 680d75a77..b025fd100 100644 --- a/pipeline.Dockerfile +++ b/pipeline.Dockerfile @@ -1,5 +1,5 @@ -# Use immutable image tags rather than mutable tags (like ubuntu:22.04) -FROM ubuntu:jammy-20230308 +# Use immutable image tags rather than mutable tags (like ubuntu:24.04) +FROM ubuntu:noble-20260113@sha256:cd1dba651b3080c3686ecf4e3c4220f026b521fb76978881737d24f200828b2b # Some tools like yamllint need this # Pip needs this as well at the moment to install ansible # (and potentially other packages) @@ -44,9 +44,8 @@ ADD ./requirements.txt /kubespray/requirements.txt ADD ./tests/requirements.txt /kubespray/tests/requirements.txt RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 1 \ - && pip install --no-compile --no-cache-dir pip -U \ - && pip install --no-compile --no-cache-dir -r tests/requirements.txt \ - && pip install --no-compile --no-cache-dir -r requirements.txt \ + && pip install --break-system-packages --ignore-installed --no-compile --no-cache-dir pip -U \ + && pip install --break-system-packages --no-compile --no-cache-dir -r tests/requirements.txt \ && curl -L https://dl.k8s.io/release/v1.34.3/bin/linux/$(dpkg --print-architecture)/kubectl -o /usr/local/bin/kubectl \ && echo $(curl -L https://dl.k8s.io/release/v1.34.3/bin/linux/$(dpkg --print-architecture)/kubectl.sha256) /usr/local/bin/kubectl | sha256sum --check \ && chmod a+x /usr/local/bin/kubectl \ @@ -56,5 +55,5 @@ RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 1 \ && rm vagrant_${VAGRANT_VERSION}-1_$(dpkg --print-architecture).deb \ && vagrant plugin install vagrant-libvirt \ # Install Kubernetes collections - && pip install --no-compile --no-cache-dir kubernetes \ + && pip install --break-system-packages --no-compile --no-cache-dir kubernetes \ && ansible-galaxy collection install kubernetes.core diff --git a/scripts/Dockerfile.j2 b/scripts/Dockerfile.j2 index 524b55227..03a107cb3 100644 --- a/scripts/Dockerfile.j2 +++ b/scripts/Dockerfile.j2 @@ -1,7 +1,7 @@ # syntax=docker/dockerfile:1 -# Use immutable image tags rather than mutable tags (like ubuntu:22.04) -FROM ubuntu:22.04@sha256:149d67e29f765f4db62aa52161009e99e389544e25a8f43c8c89d4a445a7ca37 +# Use immutable image tags rather than mutable tags (like ubuntu:24.04) +FROM ubuntu:noble-20260113@sha256:cd1dba651b3080c3686ecf4e3c4220f026b521fb76978881737d24f200828b2b # Some tools like yamllint need this # Pip needs this as well at the moment to install ansible @@ -29,7 +29,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ RUN --mount=type=bind,source=requirements.txt,target=requirements.txt \ --mount=type=cache,sharing=locked,id=pipcache,mode=0777,target=/root/.cache/pip \ - pip install --no-compile --no-cache-dir -r requirements.txt \ + pip install --break-system-packages --no-compile --no-cache-dir -r requirements.txt \ && find /usr -type d -name '*__pycache__' -prune -exec rm -rf {} \; SHELL ["/bin/bash", "-o", "pipefail", "-c"] diff --git a/scripts/pipeline.Dockerfile.j2 b/scripts/pipeline.Dockerfile.j2 index 21263d7a5..0af1f92c6 100644 --- a/scripts/pipeline.Dockerfile.j2 +++ b/scripts/pipeline.Dockerfile.j2 @@ -1,5 +1,5 @@ -# Use immutable image tags rather than mutable tags (like ubuntu:22.04) -FROM ubuntu:jammy-20230308 +# Use immutable image tags rather than mutable tags (like ubuntu:24.04) +FROM ubuntu:noble-20260113@sha256:cd1dba651b3080c3686ecf4e3c4220f026b521fb76978881737d24f200828b2b # Some tools like yamllint need this # Pip needs this as well at the moment to install ansible # (and potentially other packages) @@ -44,9 +44,8 @@ ADD ./requirements.txt /kubespray/requirements.txt ADD ./tests/requirements.txt /kubespray/tests/requirements.txt RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 1 \ - && pip install --no-compile --no-cache-dir pip -U \ - && pip install --no-compile --no-cache-dir -r tests/requirements.txt \ - && pip install --no-compile --no-cache-dir -r requirements.txt \ + && pip install --break-system-packages --ignore-installed --no-compile --no-cache-dir pip -U \ + && pip install --break-system-packages --no-compile --no-cache-dir -r tests/requirements.txt \ && curl -L https://dl.k8s.io/release/v{{ kube_version }}/bin/linux/$(dpkg --print-architecture)/kubectl -o /usr/local/bin/kubectl \ && echo $(curl -L https://dl.k8s.io/release/v{{ kube_version }}/bin/linux/$(dpkg --print-architecture)/kubectl.sha256) /usr/local/bin/kubectl | sha256sum --check \ && chmod a+x /usr/local/bin/kubectl \ @@ -56,5 +55,5 @@ RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 1 \ && rm vagrant_${VAGRANT_VERSION}-1_$(dpkg --print-architecture).deb \ && vagrant plugin install vagrant-libvirt \ # Install Kubernetes collections - && pip install --no-compile --no-cache-dir kubernetes \ + && pip install --break-system-packages --no-compile --no-cache-dir kubernetes \ && ansible-galaxy collection install kubernetes.core diff --git a/tests/scripts/testcases_run.sh b/tests/scripts/testcases_run.sh index 8e2ac5dd9..dba7c1dc3 100755 --- a/tests/scripts/testcases_run.sh +++ b/tests/scripts/testcases_run.sh @@ -18,7 +18,7 @@ if [ "${UPGRADE_TEST}" != "false" ]; then # Checkout the current tests/ directory ; even when testing old version, # we want the up-to-date test setup/provisionning git checkout "${CI_COMMIT_SHA}" -- tests/ - pip install --no-compile --no-cache-dir -r requirements.txt + pip install --break-system-packages --no-compile --no-cache-dir -r requirements.txt fi export ANSIBLE_BECOME=true @@ -58,7 +58,7 @@ fi if [ "${UPGRADE_TEST}" != "false" ]; then git checkout "${CI_COMMIT_SHA}" - pip install --no-compile --no-cache-dir -r requirements.txt + pip install --break-system-packages --no-compile --no-cache-dir -r requirements.txt case "${UPGRADE_TEST}" in "basic")