Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Bug: Summary step fails with "Cannot iterate over null" when image has no Cmd

Đang mở Phù hợp với người mới
#102 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

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
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
docker, dockerfile
Lĩnh vực
ci-cd, devops

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ả

bug

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

  1. Use cloudposse/github-action-docker-build-push@v3 with summary: true (the default)
  2. Build a Docker image whose Dockerfile defines ENTRYPOINT but no CMD
  3. 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 ENTRYPOINT only, no CMD

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

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của cloudposse/github-action-docker-build-push

Tất cả issue của cloudposse/github-action-docker-build-push

Issue tương tự

Thêm issue về DevOps

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.