Skip to content

Commit 1c093bc

Browse files
authored
Merge pull request silinternational#297 from silinternational/develop
Release 3.10.18 -- retain task definition proxyConfiguration
2 parents 926a0c3 + 9d12272 commit 1c093bc

File tree

5 files changed

+65
-7
lines changed

5 files changed

+65
-7
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
steps:
1111
- uses: actions/checkout@v4
1212
- name: Run tests
13-
run: docker-compose -f action-services.yml run test
13+
run: docker compose -f action-services.yml run test
1414

1515
build-and-publish:
1616
name: Build and Publish

action-services.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: "3"
2-
31
services:
42
test:
53
build: .

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: 'ESC-Deploy'
1+
name: 'ECS-Deploy'
22
description: 'Simple shell script for initiating blue-green deployments on Amazon EC2 Container Service (ECS)'
33
inputs:
44
aws_access_key_cmd:

ecs-deploy

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22

33
# Setup default values for variables
4-
VERSION="3.10.17"
4+
VERSION="3.10.18"
55
CLUSTER=false
66
SERVICE=false
77
TASK_DEFINITION=false
@@ -43,7 +43,7 @@ Required arguments:
4343
-k | --aws-access-key AWS Access Key ID. May also be set as environment variable AWS_ACCESS_KEY_ID
4444
-s | --aws-secret-key AWS Secret Access Key. May also be set as environment variable AWS_SECRET_ACCESS_KEY
4545
-r | --region AWS Region Name. May also be set as environment variable AWS_DEFAULT_REGION
46-
-p | --profile AWS Profile to use - If you set this aws-access-key, aws-secret-key and region are needed
46+
-p | --profile AWS Profile to use - If you set this, then aws-access-key, aws-secret-key and region are not needed
4747
-c | --cluster Name of ECS cluster
4848
-i | --image Name of Docker image to run, ex: repo/image:latest
4949
Format: [domain][:port][/repo][/][image][:tag]
@@ -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)