Skip to content

Commit 71a70c5

Browse files
authored
Refactor to use a bash file, pass dummy env var and multiline output (#1018)
1 parent 64cdbc1 commit 71a70c5

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

.github/workflows/cd.yml

+5-3
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,18 @@ jobs:
5858
- name: Format SSM Parameters
5959
id: format-secrets
6060
run: |
61-
FORMATTED_SECRETS=$(ruby bin/format_aws_secrets.rb ${{ steps.ssm-download.outputs.parameters }})
62-
echo "formatted_secrets=${FORMATTED_SECRETS}" >> $GITHUB_OUTPUT
61+
echo '${{ steps.ssm-download.outputs.parameters }}' > params.json
62+
./bin/format_aws_secrets params.json
6363
6464
- name: Fill in the new image ID in the Amazon ECS task definition
6565
id: task-def
66-
uses: aws-actions/amazon-ecs-render-task-definition@v1
66+
uses: aws-actions/amazon-ecs-render-task-definition@v1.7.0
6767
with:
6868
task-definition: ${{ vars.ECS_TASK_DEFINITION_PATH }}
6969
container-name: ${{ vars.CONTAINER_NAME }}
7070
image: ${{ steps.image-digest.outputs.image }}
71+
environment-variables: |
72+
DUMMY=DUMMY
7173
secrets: |
7274
${{ steps.format-secrets.outputs.formatted_secrets }}
7375

bin/format_aws_secrets

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
PARAMS_JSON=$(cat "$1")
4+
5+
FORMATTED_SECRETS=$(echo "$PARAMS_JSON" | jq -r '.[] | "\(.Name | split("/")[-1] | ascii_upcase)=\(.ARN)"')
6+
{
7+
echo "formatted_secrets<<EOF"
8+
echo -e "$FORMATTED_SECRETS"
9+
echo "EOF"
10+
} >> "$GITHUB_OUTPUT"

bin/format_aws_secrets.rb

-11
This file was deleted.

0 commit comments

Comments
 (0)