Bug: Summary step fails with "Cannot iterate over null" when image has no Cmd
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 72/100
Hướng nghiên cứu
Bắt đầu với script tóm tắt chạy docker inspect và biểu thức jq đọc Config.Cmd; inspect.json và biểu thức gây lỗi join(\" \") đã được xác định trong issue. Làm cho phần tóm tắt có thể xử lý các trường mảng null, bao gồm Config.Cmd và có thể cả Config.Entrypoint, sau đó xác minh rằng một image có ENTRYPOINT nhưng không có CMD vẫn hoàn tất thành công.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Dockerfile
- Star
- 14
- Fork
- 15
- Merge trung bình
- 8 giờ 45 phút
- Pull request đã merge (30 ngày)
- 1
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của cloudposse/github-action-docker-build-push
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 35/100
cloudposse/github-action-docker-build-push#77 · 1 bình luận ·
-
triage
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
cloudposse/github-action-docker-build-push#57 · 3 reaction ·
-
Dependency DashboardĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 20/100
Tất cả issue của cloudposse/github-action-docker-build-push
Issue tương tự
-
Sanity on ansible-core devel fails: ignore-2.23.txt references the removed import-3.9 testCó thể đã có người làm @yurnov đã nhận hôm nay. Đang mởneeds_triage
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 91/100
ansible-collections/kubernetes.core#1275 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug milestone-qa
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
lognorman20/monaco#3995 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
gnosis/gnosis_vpn#540 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[fullsend] E2E: rhdh-version-override — run-e2e.sh overrides RHDH_VERSION to non-existent 2.1Đang mởe2e-failure ready-to-code
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
redhat-developer/rhdh-plugin-export-overlays#4261 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày