Skip to content

Commit 8f08129

Browse files
authored
Merge pull request #293 from silinternational/feature/keep-proxyConfiguration
Keep `proxyConfiguration`, if present
2 parents 0e958ad + 9780172 commit 8f08129

File tree

2 files changed

+61
-1
lines changed

2 files changed

+61
-1
lines changed

ecs-deploy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ function createNewTaskDefJson() {
374374

375375
# Some options in task definition should only be included in new definition if present in
376376
# current definition. If found in current definition, append to JQ filter.
377-
CONDITIONAL_OPTIONS=(networkMode taskRoleArn placementConstraints executionRoleArn runtimePlatform ephemeralStorage)
377+
CONDITIONAL_OPTIONS=(networkMode taskRoleArn placementConstraints executionRoleArn runtimePlatform ephemeralStorage proxyConfiguration)
378378
for i in "${CONDITIONAL_OPTIONS[@]}"; do
379379
re=".*${i}.*"
380380
if [[ "$DEF" =~ $re ]]; then

test.bats

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -686,3 +686,63 @@ EOF
686686
[ "$output" == "something:tag_123" ]
687687
echo "output = $output" 1>&2
688688
}
689+
690+
@test "test createNewTaskDefJson with existing proxyConfiguration value" {
691+
imageWithoutTag="121212345678.dkr.ecr.us-east-1.amazonaws.com/acct/repo"
692+
useImage="121212345678.dkr.ecr.us-east-1.amazonaws.com/acct/repo:1111111111"
693+
TASK_DEFINITION=$(cat <<EOF
694+
{
695+
"taskDefinition": {
696+
"status": "ACTIVE",
697+
"networkMode": "bridge",
698+
"family": "app-task-def",
699+
"requiresAttributes": [
700+
{
701+
"name": "com.amazonaws.ecs.capability.ecr-auth"
702+
}
703+
],
704+
"volumes": [],
705+
"taskDefinitionArn": "arn:aws:ecs:us-east-1:121212345678:task-definition/app-task-def:123",
706+
"containerDefinitions": [
707+
{
708+
"environment": [
709+
{
710+
"name": "KEY",
711+
"value": "value * "
712+
}
713+
],
714+
"name": "API",
715+
"links": [],
716+
"mountPoints": [],
717+
"image": "121212345678.dkr.ecr.us-east-1.amazonaws.com/acct/repo:1487623908",
718+
"essential": true,
719+
"portMappings": [
720+
{
721+
"protocol": "tcp",
722+
"containerPort": 80,
723+
"hostPort": 10080
724+
}
725+
],
726+
"entryPoint": [],
727+
"memory": 128,
728+
"command": [
729+
"/data/run.sh"
730+
],
731+
"cpu": 200,
732+
"volumesFrom": []
733+
}
734+
],
735+
"placementConstraints": null,
736+
"proxyConfiguration": {
737+
"containerName": "example"
738+
},
739+
"revision": 123
740+
}
741+
}
742+
EOF
743+
)
744+
expected='{ "family": "app-task-def", "volumes": [], "containerDefinitions": [ { "environment": [ { "name": "KEY", "value": "value * " } ], "name": "API", "links": [], "mountPoints": [], "image": "121212345678.dkr.ecr.us-east-1.amazonaws.com/acct/repo:1111111111", "essential": true, "portMappings": [ { "protocol": "tcp", "containerPort": 80, "hostPort": 10080 } ], "entryPoint": [], "memory": 128, "command": [ "/data/run.sh" ], "cpu": 200, "volumesFrom": [] } ], "placementConstraints": null, "networkMode": "bridge", "proxyConfiguration": { "containerName": "example" } }'
745+
run createNewTaskDefJson
746+
[ ! -z $status ]
747+
[ "$(echo "$output" | jq .)" == "$(echo "$expected" | jq .)" ]
748+
}

0 commit comments

Comments
 (0)