ci(docker): 临时探针——定位镜像 apt 层的 update-alternatives 失败 - #110
Closed
ReSerendipity wants to merge 1 commit into
Closed
ReSerendipity wants to merge 1 commit into
ReSerendipity wants to merge 1 commit into
Conversation
main 的 `Build & Scan Image` 与 `Boot hardened container & probe` 从 12:19 起确定性失败在 `apt-get` 阶段:`update-alternatives: error: alternative path /usr/share/man/man7/bash-builtins.7.gz doesn't exist`(重试两次一模一样,与 PR 内容无关)。 不在 Dockerfile 上盲改的理由有两条:① 本机没有 docker daemon(只有 CLI,也没有 colima/podman),改完无法自验;② `docker-build.yml` 一轮 20+ 分钟(25 GB 上下文 + Trivy), 拿它当试错循环既慢又把两条门禁反复刷红。 所以先花几分钟跑这个探针:在托管 runner 的 container job 里用**同一个基础镜像** (nvidia/cuda:12.1.0-runtime-ubuntu22.04),把 Dockerfile 的 apt 层拆成 A/B/C 三段逐条执行, 失败时 dump 出:谁维护这条 alternative、bash/man-db/manpages 的 dpkg 状态、 /usr/share/man 现状、`apt-get -s upgrade` 会动到谁、相关 postinst 里有没有 update-alternatives。 主要嫌疑是 runtime 段那句 `apt-get upgrade -y`(它会把 bash/man-db/manpages 一起升上来, 而 `--no-install-recommends` 又可能没装 man-db 的配套),三段拆开就能定位。 定位完成后删掉本文件 —— 它是一次性探针,不是常开门禁。 Signed-off-by: ReSerendipity <zengyangc@outlook.com>
Owner
Author
|
已由 #111 接替(本 PR 的根因假设被自己的探针数据证伪)。 |
Owner
Author
更正:这条 PR 的根因假设是错的,别照它改 Dockerfile我开这条探针时要验证的假设是:镜像构建间歇性失败的根因是 探针把它证伪了:5 步全绿(同一基础镜像 而且我漏看了现成的反证 —— 同仓 红 run( 绿色 run 同一行是 这条 PR 的价值到此为止(一次性诊断作业,不合入),修复与验收见 #111。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
这条 PR 现在只是诊断,不是修复;探针文件在定位后会被同一个 PR 里删掉。
要解决的问题
main 从 12:19 起
Build & Scan Image与Boot hardened container & probe确定性红在apt-get阶段:判据链(说明它不是某个 PR 引入的):main 11:07 的同类构建还是 success(
41f5a12),之后两次 PR 构建 + 各一次重试全红在同一步;#107/#108 都没碰
Dockerfile。为什么先做探针而不是直接改 Dockerfile
docker-build.yml当试错循环,一轮 20+ 分钟还会把两条安全门禁反复刷红;A/B/C 三段逐条跑,几分钟就能定位是哪一段、哪个包;失败时自动 dump:
谁维护这条 alternative、
bash/man-db/manpages的 dpkg 状态、/usr/share/man现状、apt-get -s upgrade会动到谁、相关 postinst 里有没有update-alternatives调用。主要嫌疑是 runtime 段那句
apt-get upgrade -y:它会把 bash / man-db / manpages 一起升上来,而两处
--no-install-recommends又可能让 man-db 的配套不完整。拆开跑就能证实或排除。之后
定位到根因就在这条 PR 里给出真修复(而不是
path-exclude之类未经验证的规避),并删掉探针文件;修复要在完整镜像构建上验绿才算完,不接受"看起来合理"。