-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate-updated-task.js
More file actions
31 lines (23 loc) · 918 Bytes
/
create-updated-task.js
File metadata and controls
31 lines (23 loc) · 918 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
'use strict'
const fs = require('fs')
// grab our base task
// this file is only available after it's been created, which will be a sure thing if this script is run
// eslint-disable-next-line
const { taskDefinition } = require('./base.json')
// The only things we need for the update
const { family, containerDefinitions, taskRoleArn } = taskDefinition
// Only include properties relevant to the CLI call found in --generate-cli-skeleton
const task = {
family,
containerDefinitions,
taskRoleArn,
}
// tag of updated image with our IMAGE env var from config.yml and CircleCI's
// built in CIRCLE_SHA1 variable
const image = `${process.env.IMAGE}:${process.env.CIRCLE_SHA1}`
// set the container image to our updated image
task.containerDefinitions[0].image = image
// convert it to json
const jsonTask = JSON.stringify(task)
// create the tmp file
fs.writeFileSync('updated-task.json', jsonTask, 'utf8')