From 1cc3e3d2dd25a225e63b12d1459b32670ffb58e6 Mon Sep 17 00:00:00 2001 From: Saurabh Shrihar Date: Fri, 26 Apr 2024 12:32:42 +0400 Subject: [PATCH] Update reusable workflow --- .../workflows/ecs_deploy_docker_taskdef.yaml | 24 ++++--------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ecs_deploy_docker_taskdef.yaml b/.github/workflows/ecs_deploy_docker_taskdef.yaml index 5bc4013..7a213e6 100644 --- a/.github/workflows/ecs_deploy_docker_taskdef.yaml +++ b/.github/workflows/ecs_deploy_docker_taskdef.yaml @@ -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 @@ -37,6 +33,9 @@ on: required: false default: "staging" type: string + secrets: + account_number: + required: false jobs: deploy_workflow: @@ -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 @@ -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." @@ -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