Skip to content

Commit bf7eac5

Browse files
committed
extra steps to report failure and show logs
1 parent d5003c3 commit bf7eac5

3 files changed

Lines changed: 35 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,34 @@ jobs:
5656
- name: Run tests
5757
run: |
5858
make test
59+
60+
- name: Show localstack logs
61+
if: always()
62+
run: |
63+
make logs
64+
cat logs.txt
65+
66+
- name: Send a Slack notification
67+
if: failure() || github.event_name != 'pull_request'
68+
uses: ravsamhq/notify-slack-action@v2
69+
with:
70+
status: ${{ job.status }}
71+
token: ${{ secrets.GITHUB_TOKEN }}
72+
notification_title: "{workflow} has {status_message}"
73+
message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>"
74+
footer: "Linked Repo <{repo_url}|{repo}> | <{run_url}|View Workflow run>"
75+
notify_when: "failure"
76+
env:
77+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
78+
79+
- name: Generate a Diagnostic Report
80+
if: failure()
81+
run: |
82+
curl -s localhost:4566/_localstack/diagnose | gzip -cf > diagnose.json.gz
83+
84+
- name: Upload the Diagnostic Report
85+
if: failure()
86+
uses: actions/upload-artifact@v4
87+
with:
88+
name: diagnose.json.gz
89+
path: ./diagnose.json.gz

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ volume/
33
cdk.out
44
dms_sample
55
__pycache__/
6+
cdk.local.out/

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ deploy-aws: ## Deploy the stack on AWS
5757
$(VENV_RUN); $(CLOUD_ENV) cdk bootstrap
5858
$(VENV_RUN); $(CLOUD_ENV) cdk deploy --require-approval never
5959

60-
destroy: ## Destroy the stack on LocalStack
60+
stop: ## Stop LocalStack
6161
docker-compose down
6262

6363
destroy-aws: venv ## Destroy the stack on AWS
@@ -70,6 +70,6 @@ test-aws: ## Test the application on AWS
7070
$(VENV_RUN); $(CLOUD_ENV) python run.py
7171

7272
logs: ## Show logs from LocalStack
73-
@docker logs -f localstack_main > logs.txt
73+
@docker logs localstack-main > logs.txt
7474

75-
.PHONY: usage install start deploy test logs destroy deploy-aws test-aws destroy-aws
75+
.PHONY: usage install start deploy test logs stop deploy-aws test-aws destroy-aws

0 commit comments

Comments
 (0)