From 5eb8f47b67c156c46d760e648e5f706d80925fa7 Mon Sep 17 00:00:00 2001 From: Alex Turbov Date: Wed, 29 Jan 2025 17:56:35 +0400 Subject: [PATCH] ci(fedora41): use `dnf.conf` for options and simplify `dnf install` CLI --- .gitlab/ci/docker/fedora41/Dockerfile | 23 ++++++++-------- .gitlab/ci/docker/fedora41/dnf.conf | 32 ++++++++++++++++++++++ .gitlab/ci/docker/fedora41/install_deps.sh | 7 +---- .gitlab/ci/docker/fedora41/install_iwyu.sh | 7 +---- .gitlab/ci/docker/fedora41/install_rust.sh | 7 +---- .gitlab/ci/docker/fedora41/install_rvm.sh | 7 +---- 6 files changed, 47 insertions(+), 36 deletions(-) create mode 100644 .gitlab/ci/docker/fedora41/dnf.conf diff --git a/.gitlab/ci/docker/fedora41/Dockerfile b/.gitlab/ci/docker/fedora41/Dockerfile index 8ae4de7ef2..dd2aea6745 100644 --- a/.gitlab/ci/docker/fedora41/Dockerfile +++ b/.gitlab/ci/docker/fedora41/Dockerfile @@ -4,25 +4,21 @@ ARG BASE_IMAGE=fedora:41 FROM ${BASE_IMAGE} AS dnf-cache # Populate DNF cache w/ the fresh metadata and prefetch packages. -RUN --mount=type=bind,source=deps_packages.lst,target=/root/deps_packages.lst \ +RUN --mount=type=bind,source=dnf.conf,target=/etc/dnf/dnf.conf \ + --mount=type=bind,source=deps_packages.lst,target=/root/deps_packages.lst \ --mount=type=bind,source=iwyu_packages.lst,target=/root/iwyu_packages.lst \ --mount=type=bind,source=rust_packages.lst,target=/root/rust_packages.lst \ --mount=type=bind,source=rvm_packages.lst,target=/root/rvm_packages.lst \ --mount=type=tmpfs,target=/var/log \ --mount=type=tmpfs,target=/tmp \ - dnf install \ - --setopt=install_weak_deps=False \ - --setopt=fastestmirror=True \ - --setopt=max_parallel_downloads=10 \ - --downloadonly \ - -y \ - $(grep -h '^[^#]\+$' /root/*.lst) + dnf install --downloadonly -y $(grep -h '^[^#]\+$' /root/*.lst) FROM ${BASE_IMAGE} AS rust-build LABEL maintainer="Ben Boeckel " -RUN --mount=type=bind,source=install_rust.sh,target=/root/install_rust.sh \ +RUN --mount=type=bind,source=dnf.conf,target=/etc/dnf/dnf.conf \ + --mount=type=bind,source=install_rust.sh,target=/root/install_rust.sh \ --mount=type=bind,source=rust_packages.lst,target=/root/rust_packages.lst \ --mount=type=cache,from=dnf-cache,source=/var/lib/dnf,target=/var/lib/dnf,sharing=private \ --mount=type=tmpfs,target=/var/log \ @@ -32,7 +28,8 @@ RUN --mount=type=bind,source=install_rust.sh,target=/root/install_rust.sh \ FROM ${BASE_IMAGE} AS rvm-build LABEL maintainer="Ben Boeckel " -RUN --mount=type=bind,source=install_rvm.sh,target=/root/install_rvm.sh \ +RUN --mount=type=bind,source=dnf.conf,target=/etc/dnf/dnf.conf \ + --mount=type=bind,source=install_rvm.sh,target=/root/install_rvm.sh \ --mount=type=bind,source=rvm_packages.lst,target=/root/rvm_packages.lst \ --mount=type=cache,from=dnf-cache,source=/var/lib/dnf,target=/var/lib/dnf,sharing=private \ --mount=type=tmpfs,target=/var/log \ @@ -43,7 +40,8 @@ RUN --mount=type=bind,source=install_rvm.sh,target=/root/install_rvm.sh \ FROM ${BASE_IMAGE} AS iwyu-build LABEL maintainer="Kyle Edwards " -RUN --mount=type=bind,source=install_iwyu.sh,target=/root/install_iwyu.sh \ +RUN --mount=type=bind,source=dnf.conf,target=/etc/dnf/dnf.conf \ + --mount=type=bind,source=install_iwyu.sh,target=/root/install_iwyu.sh \ --mount=type=bind,source=iwyu_packages.lst,target=/root/iwyu_packages.lst \ --mount=type=cache,from=dnf-cache,source=/var/lib/dnf,target=/var/lib/dnf,sharing=private \ --mount=type=tmpfs,target=/var/log \ @@ -56,7 +54,8 @@ LABEL maintainer="Ben Boeckel " ENV RBENV_ROOT=/opt/rbenv -RUN --mount=type=bind,source=install_deps.sh,target=/root/install_deps.sh \ +RUN --mount=type=bind,source=dnf.conf,target=/etc/dnf/dnf.conf \ + --mount=type=bind,source=install_deps.sh,target=/root/install_deps.sh \ --mount=type=bind,source=deps_packages.lst,target=/root/deps_packages.lst \ --mount=type=cache,from=dnf-cache,source=/var/lib/dnf,target=/var/lib/dnf,sharing=private \ --mount=type=cache,target=/var/cache/pip \ diff --git a/.gitlab/ci/docker/fedora41/dnf.conf b/.gitlab/ci/docker/fedora41/dnf.conf new file mode 100644 index 0000000000..1189746973 --- /dev/null +++ b/.gitlab/ci/docker/fedora41/dnf.conf @@ -0,0 +1,32 @@ +[main] +autocheck_running_kernel=0 +debuglevel=2 +diskspacecheck=0 +fastestmirror=1 +gpgcheck=1 +installonly_limit=5 +install_weak_deps=0 +keepcache=1 +log_rotate=0 +max_parallel_downloads=10 +metadata_expire=90m +multilib_policy=best +plugins=1 +tsflags=nodocs + +# Enable color for all output +color=always + +# Default color options according to yum.conf(5) +color_list_installed_older=bold,black +color_list_installed_newer=bold,yellow +color_list_installed_reinstall=normal +color_list_installed_extra=bold,red +color_list_available_upgrade=bold,blue +color_list_available_downgrade=dim,yellow +color_list_available_install=normal +color_list_available_reinstall =bold,underline,green +color_search_match=bold,magenta +color_update_installed=green +color_update_local=cyan +color_update_remote=yellow diff --git a/.gitlab/ci/docker/fedora41/install_deps.sh b/.gitlab/ci/docker/fedora41/install_deps.sh index 2ed50251c5..d5513744d9 100755 --- a/.gitlab/ci/docker/fedora41/install_deps.sh +++ b/.gitlab/ci/docker/fedora41/install_deps.sh @@ -2,12 +2,7 @@ set -e -dnf install \ - --setopt=install_weak_deps=False \ - --setopt=fastestmirror=True \ - --setopt=max_parallel_downloads=10 \ - -y \ - $(grep '^[^#]\+$' /root/deps_packages.lst) +dnf install -y $(grep '^[^#]\+$' /root/deps_packages.lst) # Remove tests for numpy for v in 3.13; do diff --git a/.gitlab/ci/docker/fedora41/install_iwyu.sh b/.gitlab/ci/docker/fedora41/install_iwyu.sh index 718b3d0c34..4dea0dab8f 100755 --- a/.gitlab/ci/docker/fedora41/install_iwyu.sh +++ b/.gitlab/ci/docker/fedora41/install_iwyu.sh @@ -3,12 +3,7 @@ set -e # Install development tools. -dnf install \ - --setopt=install_weak_deps=False \ - --setopt=fastestmirror=True \ - --setopt=max_parallel_downloads=10 \ - -y \ - $(grep '^[^#]\+$' /root/iwyu_packages.lst) +dnf install -y $(grep '^[^#]\+$' /root/iwyu_packages.lst) cd /root git clone "https://github.com/include-what-you-use/include-what-you-use.git" diff --git a/.gitlab/ci/docker/fedora41/install_rust.sh b/.gitlab/ci/docker/fedora41/install_rust.sh index 0e67bf2516..d6d6e43492 100755 --- a/.gitlab/ci/docker/fedora41/install_rust.sh +++ b/.gitlab/ci/docker/fedora41/install_rust.sh @@ -2,12 +2,7 @@ set -e -dnf install \ - --setopt=install_weak_deps=False \ - --setopt=fastestmirror=True \ - --setopt=max_parallel_downloads=10 \ - -y \ - $(grep '^[^#]\+$' /root/rust_packages.lst) +dnf install -y $(grep '^[^#]\+$' /root/rust_packages.lst) typos_version=1.29.4 cargo install --root /usr/local --version "$typos_version" typos-cli diff --git a/.gitlab/ci/docker/fedora41/install_rvm.sh b/.gitlab/ci/docker/fedora41/install_rvm.sh index 10e7545cf5..92e75bc261 100755 --- a/.gitlab/ci/docker/fedora41/install_rvm.sh +++ b/.gitlab/ci/docker/fedora41/install_rvm.sh @@ -2,12 +2,7 @@ set -e -dnf install \ - --setopt=install_weak_deps=False \ - --setopt=fastestmirror=True \ - --setopt=max_parallel_downloads=10 \ - -y \ - $(grep '^[^#]\+$' /root/rvm_packages.lst) +dnf install -y $(grep '^[^#]\+$' /root/rvm_packages.lst) gpg2 --keyserver hkps://keyserver.ubuntu.com \ --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 \