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

shahar1 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new bf7a5b02463 Fix docs build failing to install chromium on the hardened 
CI image (#77420)
bf7a5b02463 is described below

commit bf7a5b024639b160a0ba99b10eca90c647a6f6a9
Author: Ramit Kataria <[email protected]>
AuthorDate: Sat Nov 21 11:08:33 2026 -0700

    Fix docs build failing to install chromium on the hardened CI image (#77420)
    
    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.
---
 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