diff --git a/action.yml b/action.yml index d158dc9..a3cbad2 100644 --- a/action.yml +++ b/action.yml @@ -1,6 +1,11 @@ name: Build Task Definition from ECS Service description: Build a task-definition from merging a given container-definitions JSON file into the task-definition of a running service on ECS. inputs: + region: + description: | + Region in which the ECS service log group is present + This will also replace strings from you container-definitions file. + required: true cluster: description: | Name of the cluster diff --git a/dist/build-task-definition.sh b/dist/build-task-definition.sh index 1b34b19..3b7c86a 100755 --- a/dist/build-task-definition.sh +++ b/dist/build-task-definition.sh @@ -37,7 +37,7 @@ pretty_print_task_definition() { echo "$task_definition" } -container_definitions=$(sed -e "s++$INPUT_IMAGE+g;" -e "s++$INPUT_CLUSTER+g;" "$INPUT_CONTAINER_DEFINITIONS_PATH") +container_definitions=$(sed -e "s++$INPUT_IMAGE+g;" -e "s++$INPUT_CLUSTER+g;" -e "s++$INPUT_REGION+g; "$INPUT_CONTAINER_DEFINITIONS_PATH") container_definitions=$( echo "$container_definitions" | \ jq '. | map(if has("portMappings") then .portMappings |= map(if .hostPort == null then .hostPort = .containerPort else . end) else . end)' diff --git a/src/build-task-definition.sh b/src/build-task-definition.sh index 1b34b19..3b7c86a 100755 --- a/src/build-task-definition.sh +++ b/src/build-task-definition.sh @@ -37,7 +37,7 @@ pretty_print_task_definition() { echo "$task_definition" } -container_definitions=$(sed -e "s++$INPUT_IMAGE+g;" -e "s++$INPUT_CLUSTER+g;" "$INPUT_CONTAINER_DEFINITIONS_PATH") +container_definitions=$(sed -e "s++$INPUT_IMAGE+g;" -e "s++$INPUT_CLUSTER+g;" -e "s++$INPUT_REGION+g; "$INPUT_CONTAINER_DEFINITIONS_PATH") container_definitions=$( echo "$container_definitions" | \ jq '. | map(if has("portMappings") then .portMappings |= map(if .hostPort == null then .hostPort = .containerPort else . end) else . end)'