Skip to content

Commit

Permalink
Merge pull request #106 from depot/update-service
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobwgillespie authored Sep 5, 2024
2 parents 1583822 + b79f86d commit 242bdbc
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/handlers/updater.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import {DescribeTasksCommand, ECSClient, ListTasksCommand, StopTaskCommand} from '@aws-sdk/client-ecs'
import {
DescribeTasksCommand,
ECSClient,
ListTasksCommand,
StopTaskCommand,
UpdateServiceCommand,
} from '@aws-sdk/client-ecs'
import {parseISO} from 'date-fns'
import {sleep} from '../utils/common'
import {CLOUD_AGENT_CONNECTION_ID, CLOUD_AGENT_PROVIDER} from '../utils/env'
Expand Down Expand Up @@ -31,6 +37,12 @@ async function checkForUpdates() {

const newerThan = parseISO(req.newerThan)

try {
await ecs.send(new UpdateServiceCommand({cluster, service: serviceName, forceNewDeployment: true}))
} catch (err) {
console.error('Error updating service, ignoring', err)
}

const {taskArns} = await ecs.send(new ListTasksCommand({cluster, serviceName}))
if (!taskArns || taskArns.length === 0) return
const {tasks} = await ecs.send(new DescribeTasksCommand({cluster, tasks: taskArns}))
Expand Down

0 comments on commit 242bdbc

Please sign in to comment.