aws-samples / aws-samples/aws-sam-github-actions-example

Action fails when there are no SAM changes

Đang mở
#10 2 bình luận 0 reaction 0 người được giao Xem trên GitHub
bug
Ngôn ngữ chính
Python
Star
63
Fork
40
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

**Describe the bug**
When a change is pushed to main which doesn't update the SAM template, the deployment job will fail.

**To Reproduce**
Steps to reproduce the behavior:
The previous workflow must have completed successfully, and the repo hasn't been updated.
1. Go to Actions
2. Click on workflow "SAM Validate, Build, Test, Deploy"
3. Choose "Re-run jobs"

This job will fail

**Expected behavior**
The running job should succeed

**Screenshots**
Step "SAM deploy" fails with the following error:
![image](https://user-images.githubusercontent.com/985549/121764600-5e1ccf00-cb84-11eb-9a05-d2139f066609.png)
(note that I ran this from my own fork, so the stack name is different to what you will expect)

A possible fix: Change the last command in template.yml to the following:

sam deploy --template-file .aws-sam/build/template.yaml \
--stack-name ${{ steps.vars.outputs.environment }} \
--s3-bucket ${{ steps.vars.outputs.environment }} \
--parameter-overrides \
'ParameterKey=Name,ParameterValue=example \
ParameterKey=Version,ParameterValue=${{ steps.vars.outputs.version }}' \
--capabilities CAPABILITY_IAM CAPABILITY_NAMED_IAM \
|| echo "Nothing to deploy, no changes"

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu với template.yml và workflow “SAM Validate, Build, Test, Deploy”, tập trung vào bước “SAM deploy” đang bị lỗi. Tái hiện lỗi bằng cách chạy lại một workflow đã hoàn tất mà không có thay đổi nào trong SAM template, sau đó xác minh rằng job thành công và không báo cáo thay đổi triển khai nào khi không có gì để triển khai.

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

Đánh giá

Công nghệ
aws, github-actions
Lĩnh vực
ci-cd, cloud, devops
Loại issue
Lỗi
Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
38/100

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.