add update task definition image git hash
This commit is contained in:
parent
8802df86a7
commit
78bd133b3b
10
index.js
10
index.js
@ -27,12 +27,22 @@ const ecs = new AWS.ECS({
|
|||||||
;!(async function () {
|
;!(async function () {
|
||||||
let log = console.log
|
let log = console.log
|
||||||
|
|
||||||
|
let gitHash = (process.env.GIT_HASH || '').trim()
|
||||||
|
|
||||||
log('Get TaskDefinition last version')
|
log('Get TaskDefinition last version')
|
||||||
let taskDefinition = await ecs.describeTaskDefinition({
|
let taskDefinition = await ecs.describeTaskDefinition({
|
||||||
taskDefinition: definitionName
|
taskDefinition: definitionName
|
||||||
}).promise()
|
}).promise()
|
||||||
log('Old Version : ', taskDefinition.taskDefinition.taskDefinitionArn)
|
log('Old Version : ', taskDefinition.taskDefinition.taskDefinitionArn)
|
||||||
|
|
||||||
|
let image = taskDefinition.taskDefinition.containerDefinitions[0].image
|
||||||
|
console.log('show image :: ', image)
|
||||||
|
if (typeof gitHash === 'string' && gitHash.length > 0) {
|
||||||
|
image = image.split(':')[0] + ':' gitHash
|
||||||
|
taskDefinition.taskDefinition.containerDefinitions[0].image = image
|
||||||
|
}
|
||||||
|
console.log('show new image :: ', image)
|
||||||
|
|
||||||
log('Update TaskDefinition')
|
log('Update TaskDefinition')
|
||||||
let updateStatus = await ecs.registerTaskDefinition({
|
let updateStatus = await ecs.registerTaskDefinition({
|
||||||
containerDefinitions: taskDefinition.taskDefinition.containerDefinitions,
|
containerDefinitions: taskDefinition.taskDefinition.containerDefinitions,
|
||||||
|
Loading…
Reference in New Issue
Block a user