diff --git a/.github/workflows/deploy-template.yml b/.github/workflows/deploy-template.yml index 9556a22b..06ca814d 100644 --- a/.github/workflows/deploy-template.yml +++ b/.github/workflows/deploy-template.yml @@ -12,6 +12,9 @@ on: auto_deploy_envs: required: true # utility type: string + app_name: + required: true # platform-console-api + type: string secrets: aws_access_key_id: #${{ secrets.AWS_ACCESS_KEY_ID }} required: true @@ -87,8 +90,8 @@ jobs: envs=( ${{ needs.prepare-values.outputs.environments }} ) for env in ${envs[*]}; do - yq e -i '.spec.template.spec.containers.[0].image = "008577686731.dkr.ecr.us-gov-west-1.amazonaws.com/dsva/${{inputs.ecr_repository}}:${{inputs.ecr_repository}}-${{ github.sha }}"' $env/deployment.yml - yq e -i '.spec.template.spec.initContainers.[0].image = "008577686731.dkr.ecr.us-gov-west-1.amazonaws.com/dsva/${{inputs.ecr_repository}}:${{inputs.ecr_repository}}-${{ github.sha }}"' $env/deployment.yml + yq e -i '(.spec.template.spec.containers[] | select(.name == ${{inputs.app_name}}).image) |= "008577686731.dkr.ecr.us-gov-west-1.amazonaws.com/dsva/${{inputs.ecr_repository}}:${{inputs.ecr_repository}}-${{ github.sha }}"' $env/deployment.yml + yq e -i '(.spec.template.spec.initContainers[] | select(.name == ${{inputs.app_name}}).image) |= "008577686731.dkr.ecr.us-gov-west-1.amazonaws.com/dsva/${{inputs.ecr_repository}}:${{inputs.ecr_repository}}-${{ github.sha }}"' $env/deployment.yml done - name: Add and Commit file diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 5b6b2fca..730d0d3f 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -13,6 +13,7 @@ jobs: ecr_repository: 'platform-console' manifests_directory: 'vsp-tools-backend/platform-console-api' auto_deploy_envs: 'utility' + app_name: 'platform-console-api' secrets: aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}