Bug: Summary step fails with "Cannot iterate over null" when image has no Cmd
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 72/100
调研方向
从运行 docker inspect 的摘要脚本以及读取 Config.Cmd 的 jq 表达式开始;issue 中已确定 inspect.json 和失败的 join(\" \") 表达式。让摘要能够容忍 null 数组字段,包括 Config.Cmd 和可能存在的 Config.Entrypoint,然后验证带有 ENTRYPOINT 但没有 CMD 的镜像能够成功完成。
由索引模型根据 Issue 内容生成。
描述
Describe the Bug
The post-build summary step fails with exit code 5 when the built Docker image has a null Config.Cmd (i.e. the image uses only an ENTRYPOINT and no CMD instruction). The image builds and pushes successfully — the failure is entirely in the summary/reporting step, but it causes the whole job to be marked as failed.
Expected Behavior
The summary step should handle a null Config.Cmd gracefully and complete without error. Images that define only an ENTRYPOINT are valid Docker images and should not cause the action to fail.
Steps to Reproduce
- Use
cloudposse/github-action-docker-build-push@v3withsummary: true(the default) - Build a Docker image whose
DockerfiledefinesENTRYPOINTbut noCMD - Observe the workflow fail in the summary step after an otherwise successful build and push
Screenshots
Logs from the failing step:
jq: error (at inspect.json:83): Cannot iterate over null (null)
Process completed with exit code 5.
The summary step runs docker inspect on the built image and extracts fields with jq. The line responsible is:
CMD=$(jq -r '.[0].Config.Cmd | join(" ")' inspect.json)
When Config.Cmd is null, jq cannot apply join to a null value and exits with code 5.
The suggested fix is a // [] fallback:
CMD=$(jq -r '.[0].Config.Cmd // [] | join(" ")' inspect.json)
The same pattern should be applied to any other field in the summary script that assumes a non-null array (e.g. Config.Entrypoint).
Environment
- Action:
cloudposse/github-action-docker-build-push@v3 - Runner OS:
ubuntu-latest - Docker image: defines
ENTRYPOINTonly, noCMD
Additional Context
The image inspect output confirms "Cmd": null in Config. This is valid per the Docker image spec — CMD is optional when ENTRYPOINT is set.
- 主要语言
- Dockerfile
- 星标
- 14
- 派生
- 15
- 平均合并
- 8 小时 45 分钟
- 30 天内合并 PR
- 1
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
cloudposse/github-action-docker-build-push 的其他 Issue
-
bug
难度 3/5 1-2 天 新手友好度 35/100
-
bug
难度 2/5 1-3 小时 新手友好度 35/100
cloudposse/github-action-docker-build-push#77 · 1 条评论 ·
-
triage
难度 3/5 1-2 天 新手友好度 35/100
cloudposse/github-action-docker-build-push#57 · 3 个 reaction ·
-
难度 2/5 1-3 小时 新手友好度 20/100
查看 cloudposse/github-action-docker-build-push 的全部 Issue
相似的 Issue
-
lens:agent lens:process process
难度 2/5 1-3 小时 新手友好度 78/100
thebristolsound/birdbrain#1771 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
area:ops priority:P2 type:chore
难度 1/5 1 小时以内 新手友好度 82/100
skaiy/wild_agentos#407 ·
维护者通常 1 天内回复
-
ci-install-db-tools stall-case tests flake: stalled apt-get can be killed before it logs its call未关闭effort:low model:light plan planner:opus-5-5 tests
难度 2/5 1-3 小时 新手友好度 86/100
维护者通常 1 天内回复
-
component/test-automation work/tech-debt
难度 2/5 1-3 小时 新手友好度 78/100
bcgov/bc-wallet-mobile#4845 ·
维护者通常 1 天内回复