Skip to content

Commit 7f85e11

Browse files
authored
chore: add cloudwatch monitoring for getting started smoke test (#2157)
1 parent 7c14f79 commit 7f85e11

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

.circleci/config.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ orbs:
77
macos: circleci/[email protected]
88
android: circleci/[email protected]
99
flutter-orb: circleci/[email protected]
10+
aws-cli: circleci/[email protected]
1011

1112
executors:
1213
mac-executor:
@@ -20,6 +21,16 @@ orbs:
2021
resource_class: large
2122

2223
commands:
24+
send-metric-on-fail:
25+
description: Send failure datapoint to cloudwatch
26+
steps:
27+
- run:
28+
name: Send failure datapoint to cloudwatch
29+
command: |
30+
payload="{\"jobName\": \"${CIRCLE_JOB}\", \"projectRepoName\": \"${CIRCLE_PROJECT_REPONAME}\"}"
31+
echo $payload
32+
aws lambda invoke --function-name CircleCIWorkflowFailureHandler --payload "$payload" --cli-binary-format raw-in-base64-out response.json
33+
when: on_fail
2334
run-with-retry:
2435
description: Run command with retry
2536
parameters:
@@ -115,6 +126,10 @@ orbs:
115126
steps:
116127
- checkout:
117128
path: ~/flutter-canaries
129+
- aws-cli/setup:
130+
role-session-name: ${CIRCLE_WORKFLOW_JOB_ID}
131+
role-arn: ${AWS_ROLE_ARN}
132+
session-duration: '2000'
118133
- install-flutter:
119134
flutter_branch: << parameters.flutter-version >>
120135
- run:
@@ -143,6 +158,7 @@ orbs:
143158
command: flutter test integration_test
144159
no_output_timeout: 1h
145160
retry-count: 5
161+
- send-metric-on-fail
146162

147163
flutter-ios:
148164
parameters:
@@ -153,6 +169,10 @@ orbs:
153169
steps:
154170
- checkout:
155171
path: ~/flutter-canaries
172+
- aws-cli/setup:
173+
role-session-name: ${CIRCLE_WORKFLOW_JOB_ID}
174+
role-arn: ${AWS_ROLE_ARN}
175+
session-duration: '2000'
156176
- run:
157177
name: Install gnu-sed
158178
command: brew install gnu-sed
@@ -179,6 +199,7 @@ orbs:
179199
label: Run Flutter Tests
180200
command: flutter test integration_test
181201
no_output_timeout: 20m
202+
- send-metric-on-fail
182203

183204

184205
executors:
@@ -451,10 +472,14 @@ workflows:
451472
- equal: [ "Canaries", << pipeline.schedule.name >> ]
452473
jobs:
453474
- getting-started-smoke-test/flutter-android:
475+
context:
476+
- cloudwatch-monitoring
454477
matrix:
455478
parameters:
456479
flutter-version: [ "stable", "beta" ]
457480
- getting-started-smoke-test/flutter-ios:
481+
context:
482+
- cloudwatch-monitoring
458483
matrix:
459484
parameters:
460485
flutter-version: [ "stable", "beta" ]

0 commit comments

Comments
 (0)