Skip to content

Commit

Permalink
temp: send discord messages for start and exit for all envs (#526)
Browse files Browse the repository at this point in the history
* temp: send dev discord messages for start and exit

* fix: send discord messages to all envs
  • Loading branch information
v-stickykeys authored Dec 6, 2021
1 parent 41bc9aa commit a2ac1ed
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 21 deletions.
8 changes: 3 additions & 5 deletions runner/check-aws-ecs-tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@ async function main() {
} else {
console.log('OK')
console.log('Only one running task found (assumed to be self)')
if (process.env.AWS_ECS_CLUSTER.includes('prod')) {
// Only do this in prod because it's too noisy given the short interval of
// tnet and dev anchoring
sendStartNotification(taskArns)
}
// Only do this in prod because it's too noisy given the short interval of
// tnet and dev anchoring
sendStartNotification(taskArns)
}
}

Expand Down
30 changes: 14 additions & 16 deletions runner/report-exit.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
const { generateDiscordCloudwatchFields, sendDiscordNotification, listECSTasks } = require('./helpers')

async function main() {
if (process.env.AWS_ECS_CLUSTER.includes('prod')) {
// Only do this in prod because it's too noisy given the short interval of
// tnet and dev anchoring
const taskArns = await listECSTasks()
const fields = generateDiscordCloudwatchFields(taskArns)
const message = [
{
title: `CAS anchor task finished (${process.env.AWS_ECS_CLUSTER})`,
color: 3447003, // Blue
fields,
},
]
const data = { embeds: message, username: 'cas-runner' }
const retryDelayMs = 300000 // 300k ms = 5 mins
sendDiscordNotification(process.env.DISCORD_WEBHOOK_URL_INFO_CAS, data, retryDelayMs)
}
// Only do this in prod because it's too noisy given the short interval of
// tnet and dev anchoring
const taskArns = await listECSTasks()
const fields = generateDiscordCloudwatchFields(taskArns)
const message = [
{
title: `CAS anchor task finished (${process.env.AWS_ECS_CLUSTER})`,
color: 3447003, // Blue
fields,
},
]
const data = { embeds: message, username: 'cas-runner' }
const retryDelayMs = 300000 // 300k ms = 5 mins
sendDiscordNotification(process.env.DISCORD_WEBHOOK_URL_INFO_CAS, data, retryDelayMs)
}

main()
Expand Down

0 comments on commit a2ac1ed

Please sign in to comment.