Skip to content

Commit

Permalink
Update reusable workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
sshrihar committed Apr 26, 2024
1 parent be098a4 commit 1cc3e3d
Showing 1 changed file with 5 additions and 19 deletions.
24 changes: 5 additions & 19 deletions .github/workflows/ecs_deploy_docker_taskdef.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@ on:
inputs:
app_name:
required: true
type: string
account_number:
required: true
type: string
default: "123456"
type: string
cluster_name:
required: true
type: string
Expand Down Expand Up @@ -37,6 +33,9 @@ on:
required: false
default: "staging"
type: string
secrets:
account_number:
required: false

jobs:
deploy_workflow:
Expand All @@ -60,7 +59,6 @@ jobs:
- name: Set variables
run: |
ls -lrt
if [ "${{ inputs.taskdef_file_script }}" == "local" ]; then
echo "taskdef_file_script=pipelines/Support/taskdef_template/taskdef_creator.py" >> $GITHUB_ENV
echo "taskdef_file_template=pipelines/Support/taskdef_template/taskdef_template.json" >> $GITHUB_ENV
Expand All @@ -75,20 +73,8 @@ jobs:
fetch-depth: 0
path: ./code

- name: Determine Account Number Source
id: determine_account_number
run: |
if [[ "${{ inputs.account_number }}" =~ ^secret\..*$ ]]; then
echo "account_number_resolved=${{ secrets[format('{0}', inputs.account_number)] }}" >> $GITHUB_OUTPUT
else
echo "account_number_resolved=${{ inputs.account_number }}" >> $GITHUB_OUTPUT
fi
- name: Create taskdef file dynamically using parameters passed
run: |
ls -lrt
echo "here: ${{ env.taskdef_file_script }}"
echo "here: ${{ env.taskdef_file_template }}"
script_dir="$(dirname ${{ env.taskdef_file_script }})"
if [[ -z "$script_dir" ]]; then
echo "Warning: Script name doesn't contain a directory path. Using current directory."
Expand All @@ -100,7 +86,7 @@ jobs:
pipenv install && \
pipenv run python ${{ env.taskdef_file_script }} \
-pf code/${{ inputs.taskdef_file_vars }} -tt ${{ env.taskdef_file_template }} \
-acc ${{ needs.determine_account_number.outputs.account_number }} \
$(if [[ "${{ secrets.account_number }}" ]]; then echo "-acc ${{ secrets.account_number }}"; fi) \
-app ${{ inputs.app_name }}
- name: Configure AWS credentials
Expand Down

0 comments on commit 1cc3e3d

Please sign in to comment.