Skip to content

Commit

Permalink
Replace <REGION> string from container-definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisBoudreau committed Feb 17, 2023
1 parent ed04981 commit 5479485
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -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 <REGION> strings from you container-definitions file.
required: true
cluster:
description: |
Name of the cluster
Expand Down
2 changes: 1 addition & 1 deletion dist/build-task-definition.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/build-task-definition.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pretty_print_task_definition() {
echo "$task_definition"
}

container_definitions=$(sed -e "s+<IMAGE>+$INPUT_IMAGE+g;" -e "s+<CLUSTER>+$INPUT_CLUSTER+g;" "$INPUT_CONTAINER_DEFINITIONS_PATH")
container_definitions=$(sed -e "s+<IMAGE>+$INPUT_IMAGE+g;" -e "s+<CLUSTER>+$INPUT_CLUSTER+g;" -e "s+<REGION>+$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)'
Expand Down

0 comments on commit 5479485

Please sign in to comment.