This is an automated email from the ASF dual-hosted git repository.

Lee-W pushed a commit to branch v3-4-test
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/v3-4-test by this push:
     new aa71deb9757 [v3-4-test] Fix docs build failing to install chromium on 
the hardened CI image (#77420) (#77454)
aa71deb9757 is described below

commit aa71deb97574608c64337ab371f2ae339cf0deb2
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Tue Nov 24 10:55:03 2026 +0000

    [v3-4-test] Fix docs build failing to install chromium on the hardened CI 
image (#77420) (#77454)
    
    The docs build fails for every PR that builds a package with a mermaid
    diagram. Installing chromium for mermaid-cli ends with "Unable to correct
    problems, you have held broken packages".
    
    dhi.io renumbered its libx11 builds (2:1.8.12-1+dhi0 became
    2:1.8.12-1+deb13u0+dhi0, which sorts lower) and dropped the old ones.
    chromium needs libx11-xcb1, which depends on the exact new libx11-6, and
    apt will not downgrade the copy the image ships.
    
    The image build already handles renumbered packages, but only while it
    installs the OS dependencies. The pinned OS-dependencies image predates
    this renumbering, and the mermaid install runs apt against the live
    repository later, when the docs are built. The latest published
    OS-dependencies image has the same stale packages, so moving the pin
    would not help.
    (cherry picked from commit bf7a5b024639b160a0ba99b10eca90c647a6f6a9)
    
    Co-authored-by: Ramit Kataria <[email protected]>
---
 scripts/in_container/install_mermaid_cli.sh | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/scripts/in_container/install_mermaid_cli.sh 
b/scripts/in_container/install_mermaid_cli.sh
index c4b9518ee9f..f6a0706dc97 100755
--- a/scripts/in_container/install_mermaid_cli.sh
+++ b/scripts/in_container/install_mermaid_cli.sh
@@ -25,9 +25,31 @@ set -euo pipefail
 
 MERMAID_CLI_VERSION="11.17.0"
 
+function align_image_packages_with_hardened_repository() {
+    # Chromium pulls in libraries (libx11-xcb1) that depend on the exact 
dhi.io version of packages
+    # the image already has. When dhi.io has renumbered those since the 
image's OS dependencies were
+    # installed, apt refuses to downgrade the image's copy and the install 
fails. This repeats the
+    # function of the same name in scripts/docker/install_os_dependencies.sh, 
which explains the
+    # renumbering and only runs when the OS dependencies are installed, not on 
this later apt run.
+    local package
+    local dhi_version
+    local -a downgrades=()
+    while read -r package; do
+        dhi_version=$(apt-cache madison "${package}" | awk -F' [|] ' '$3 ~ 
/dhi\.io/ && !found {print $2; found=1}')
+        if [[ -n "${dhi_version}" ]]; then
+            downgrades+=("${package}=${dhi_version}")
+        fi
+    done < <(apt list --installed 2>/dev/null | awk -F/ '/\[installed,local\]/ 
{print $1}')
+    if (( ${#downgrades[@]} )); then
+        echo "Aligning image packages with the dhi.io repository: 
${downgrades[*]}"
+        apt-get install -y -qq --no-install-recommends --allow-downgrades 
"${downgrades[@]}" > /dev/null
+    fi
+}
+
 # Debian's chromium is used instead of the browser puppeteer would download. 
fonts-liberation gives
 # mermaid Liberation Sans, which has Arial's metrics, to measure its labels 
with.
 apt-get update -qq
+align_image_packages_with_hardened_repository
 apt-get install -y -qq --no-install-recommends chromium fonts-liberation > 
/dev/null
 rm -rf /var/lib/apt/lists/*
 

Reply via email to