gha_build.sh ignores failures of the archetype's own mvn install

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

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
1/5
Thời gian dự kiến
Dưới một giờ
Mức phù hợp với người mới
88/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
bash, github-actions, java
Lĩnh vực
build-system, ci-cd

Hướng nghiên cứu

Bắt đầu với gha_build.sh và kiểm tra hàm archetype, đặc biệt là bước mvn -q clean install và lời gọi mvn archetype:generate sau đó. Kiểm tra cách các bước lân cận xử lý lỗi lệnh. Công việc được xem là hoàn tất khi cài đặt archetype thất bại khiến script thoát thay vì tạo dự án từ archetype đã lưu trong bộ nhớ đệm; hãy chạy script với một lần cài đặt thất bại để xác nhận.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

In gha_build.sh, the archetype function runs mvn -q clean install in the archetype module but doesn't check its exit code. The next step, mvn archetype:generate -DarchetypeCatalog=local, then generates from whatever version of the archetype is in the local catalog.

So when the archetype's integration test fails:

  • On a clean machine, which is CI today since setup-java has no Maven cache, nothing is in the local catalog and generate fails with "The desired archetype does not exist". The job goes red, but the error points at the wrong step.
  • On a machine that has installed an older archetype before (any dev machine, or CI if Maven caching is turned on later), generate quietly uses the old archetype and the run passes. The new archetype is never tested.

Releases aren't affected: release.yml runs mvn release:prepare/perform over the full reactor, which runs the archetype integration tests and stops on failure.

This came up in #1714. The springboot4 archetype's integration test failed with NoClassDefFoundError for JsonApplyView, and a local gha_build.sh run still reported success because it generated from a cached 3.0.3-SNAPSHOT archetype.

Suggested fix: check the exit code after the archetype install, like the other steps do.

cd ${WORKING_DIR}/${ARCHETYPE_NAME} && mvn -q clean install
if [[ "$?" -ne 0 ]]; then
    exit 1
fi

Passing -DarchetypeVersion with the project version to archetype:generate would also stop it from falling back to an older archetype.

Ngôn ngữ chính
Java
Star
1.6k
Fork
575
Merge trung bình
1 ngày 15 giờ
Pull request đã merge (30 ngày)
12

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 aws/serverless-java-container

Tất cả issue của aws/serverless-java-container

Issue tương tự

Thêm issue về Java

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.