From 9904d9db6e5132457b385e28cc29a7f93dbcd7e2 Mon Sep 17 00:00:00 2001 From: Lindsey Hattamer Date: Fri, 18 Feb 2022 12:44:00 -0500 Subject: [PATCH 1/2] update yml to use select --- .github/workflows/deploy-template.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-template.yml b/.github/workflows/deploy-template.yml index 9556a22b..4764097a 100644 --- a/.github/workflows/deploy-template.yml +++ b/.github/workflows/deploy-template.yml @@ -87,8 +87,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 == "platform-console-api").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 == "platform-console-api").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 From 4128d0c616614c81604f81b0b9c901124bf90597 Mon Sep 17 00:00:00 2001 From: Lindsey Hattamer Date: Mon, 21 Feb 2022 09:55:53 -0500 Subject: [PATCH 2/2] add reusable variable --- .github/workflows/deploy-template.yml | 7 +++++-- .github/workflows/deploy.yml | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-template.yml b/.github/workflows/deploy-template.yml index 4764097a..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[] | select(.name == "platform-console-api").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 == "platform-console-api").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 }}