Skip to content

Commit

Permalink
Support container with no portMappings
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisBoudreau committed Sep 29, 2021
1 parent bba8c3d commit 3591467
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion dist/build-task-definition.sh

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

5 changes: 4 additions & 1 deletion src/build-task-definition.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ pretty_print_task_definition() {
}

container_definitions=$(sed "s+<IMAGE>+$INPUT_IMAGE+g;" "$INPUT_CONTAINER_DEFINITIONS_PATH")
container_definitions=$(echo "$container_definitions" | jq '.[].portMappings |= map(if .hostPort == null then .hostPort = .containerPort else . end)')
container_definitions=$(
echo "$container_definitions" | \
jq '. | map(if has("portMappings") then .portMappings |= map(if .hostPort == null then .hostPort = .containerPort else . end) else . end)'
)

if [ -f "$INPUT_SECRETS_PATH" ]; then
echo "Appending secrets for service $INPUT_SERVICE"
Expand Down

0 comments on commit 3591467

Please sign in to comment.