ci(docker): docker-build 加 paths-ignore docs/**(纯文档改动不再重建镜像) - #163
Merged
Merged
Conversation
反面证据是实测的三条:#157 / #159 / #162 都只改 docs/,各触发一次 Build & Scan Image (22.6 / 22.6 / 22 分钟,见各自 main push 的 run 时长),而扫的镜像构建输入并没有变: .dockerignore 已把 docs、tests、.github 排除在上下文外,Dockerfile 的 COPY 面只有 pyproject.toml / requirements.txt / app/(第 54/55 行)与运行时那次 COPY . .(第 113 行)。 只放 docs/** 一条,刻意不收的三类: - README.md:pyproject 的 readme = "README.md" 会把它吃进 wheel 元数据,且它不在 .dockerignore 的排除列表里,改它确实改产物; - app/**、requirements*.txt、pyproject.toml、Dockerfile、.dockerignore、deploy/**: 全是构建输入; - .github/workflows/**:包括本文件自己,改门禁逻辑必须能跑到(本 PR 就是这样自证的)。 docker-publish.yml 这次没动:它的 on.push 同时含 branches:[main] 与 tags:["v*"], 而 paths 过滤在 tag push 上的语义我无法用本仓历史证实(RP 自己打的 tag 从不级联, 人工补的那条腿走 workflow_dispatch,本就不吃路径过滤)。要么单独确认过一次语义再加, 要么把它拆成两个 trigger 块——都属于要另外取证的动作,收益只有 21.8 分钟那一半。 Signed-off-by: ReSerendipity <ReSerendipity@users.noreply.github.com>
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.
批准开工的 P1-5 第一条。未自合并,等绿停住。
改了什么(1 file,+10 −0)
docker-build.yml的push.branches:[main]与pull_request.branches:[main]各加一条paths-ignore: ["docs/**"]。为什么是这三条实测撑腰
docs/SECURITY_CODEQL_TRIAGE.mddocs/SECURITY_CODEQL_TRIAGE.md+ 一个测试docs/release-governance.md扫的镜像构建输入并没有变:
.dockerignore已排除docs、tests、.github(第 19–22 行区),Dockerfile的 COPY 面是pyproject.toml/requirements.txt/app(:54–55)与运行时COPY --chown=ttsuser:ttsuser . .(:113)—— docs 不在镜像里。刻意不收的路径(避免把 docker 自己的改动挡在触发外)
README.md:pyproject.toml的readme = "README.md"会把它吃进 wheel 元数据,且它不在.dockerignore的排除项里 → 改它确实改产物,必须仍然构建。app/**、requirements*.txt、requirements-lock.txt、pyproject.toml、Dockerfile、.dockerignore、deploy/**、launcher/**:全是构建输入。.github/workflows/**:包括本文件自身 —— 改门禁逻辑必须能跑到。这条 CR 本身就是自证:它改的是 workflow 文件,所以Docker Build会照常触发;等它并入后,下一笔纯docs/**的 PR 应当不再出现Docker Build(我正在做的 v2.3.0 记录 PR 就能当这个反向验证,若它那时还没合,我另找一次核)。为什么没顺手改
docker-publish.yml它的
on.push同时含branches: [main]与tags: ["v*"],而 paths 过滤在 tag push 上的语义我没法用本仓历史证实:实测 RP 自己打的 tag 从不级联(v2.2.5 起release-gate/gpg-signed-release的head_branch全集只到v2.2.4),人工补的那条腿走workflow_dispatch、本就不吃路径过滤。要加得先确认 tag push 是否被paths-ignore影响(或把 push 拆成两个块)——那是另一件要取证的事,收益只是剩下的 21.8 min 那一半,所以本 PR 不做。门禁
push/pull_request两个块各含paths-ignore: ['docs/**'],concurrency(ci: DCO 在 bot PR 上真跑(去掉 actor 级 if)+ docker-build 并发去重 #160 加的)保持。Signed-off-by齐。Refs: #157 #159 #160 #162