Skip to content
This repository is currently being migrated. It's locked while the migration is in progress.
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 26 additions & 33 deletions .github/workflows/deploy-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,44 +76,37 @@ jobs:
path: vsp-infra-application-manifests
ref: refs/heads/main

- name: Update vets-api image and version name in Manifest repo for vets-api-parent charts
env:
ECR_REGISTRY: ${{ steps.ecr-login.outputs.registry }}
Comment thread
jweissman marked this conversation as resolved.
ECR_REPOSITORY: dsva/${{inputs.ecr_repository}}
- name: Update vets-api image and version name in Manifest repo
run: |
cd vsp-infra-application-manifests/apps/${{inputs.manifests_directory}}
envs=(dev staging)
for env in ${envs[*]};
do
yq e -i '(."vets-api-parent".image.tag) |= "${{ inputs.commit_sha }}"' $env/values.yaml
yq e -i '(."vets-api-parent".web.envSecrets[] | select(.name=="DD_VERSION").value) |= "${{ inputs.commit_sha }}"' $env/values.yaml
yq e -i '(."vets-api-parent".web.dbMigrate.envSecrets[] | select(.name=="DD_VERSION").value) |= "${{ inputs.commit_sha }}"' $env/values.yaml
yq e -i '(."vets-api-parent".worker.envSecrets[] | select(.name=="DD_VERSION").value) |= "${{ inputs.commit_sha }}"' $env/values.yaml
yq e -i '(."vets-api-parent".web.envSecrets[] | select(.name=="DD_GIT_COMMIT_SHA").value) |= "${{ inputs.commit_sha }}"' $env/values.yaml
yq e -i '(."vets-api-parent".web.dbMigrate.envSecrets[] | select(.name=="DD_GIT_COMMIT_SHA").value) |= "${{ inputs.commit_sha }}"' $env/values.yaml
yq e -i '(."vets-api-parent".worker.envSecrets[] | select(.name=="DD_GIT_COMMIT_SHA").value) |= "${{ inputs.commit_sha }}"' $env/values.yaml
done
git diff

- name: Update vets-api image and version name in Manifest repo for parent helm
env:
ECR_REGISTRY: ${{ steps.ecr-login.outputs.registry }}
ECR_REPOSITORY: dsva/${{inputs.ecr_repository}}
run: |
cd vsp-infra-application-manifests/apps/${{inputs.manifests_directory}}
envs=(prod sandbox)
for env in ${envs[*]};
do
yq e -i '(."vets-api".image.tag) |= "${{ inputs.commit_sha }}"' $env/values.yaml
yq e -i '(."vets-api".web.envSecrets[] | select(.name=="DD_VERSION").value) |= "${{ inputs.commit_sha }}"' $env/values.yaml
yq e -i '(."vets-api".web.dbMigrate.envSecrets[] | select(.name=="DD_VERSION").value) |= "${{ inputs.commit_sha }}"' $env/values.yaml
yq e -i '(."vets-api".worker.envSecrets[] | select(.name=="DD_VERSION").value) |= "${{ inputs.commit_sha }}"' $env/values.yaml
yq e -i '(."vets-api".web.envSecrets[] | select(.name=="DD_GIT_COMMIT_SHA").value) |= "${{ inputs.commit_sha }}"' $env/values.yaml
yq e -i '(."vets-api".web.dbMigrate.envSecrets[] | select(.name=="DD_GIT_COMMIT_SHA").value) |= "${{ inputs.commit_sha }}"' $env/values.yaml
yq e -i '(."vets-api".worker.envSecrets[] | select(.name=="DD_GIT_COMMIT_SHA").value) |= "${{ inputs.commit_sha }}"' $env/values.yaml
for env in dev staging prod sandbox; do
has_parent=$(yq e 'has("vets-api-parent")' "$env/values.yaml")
has_vets=$(yq e 'has("vets-api")' "$env/values.yaml")

if [[ "$has_parent" == "true" && "$has_vets" == "true" ]]; then
echo "Both vets-api and vets-api-parent found in $env/values.yaml, cannot determine chart key. Exiting."
exit 1
elif [[ "$has_parent" == "true" ]]; then
chart_key="vets-api-parent"
elif [[ "$has_vets" == "true" ]]; then
chart_key="vets-api"
else
echo "No known chart key found in $env/values.yaml, skipping."
continue
fi

echo "$env -> $chart_key"
yq e -i '(."'"$chart_key"'".image.tag) |= "${{ inputs.commit_sha }}"' "$env/values.yaml"
Comment thread
jweissman marked this conversation as resolved.
Outdated
yq e -i '(."'"$chart_key"'".web.envSecrets[] | select(.name=="DD_VERSION").value) |= "${{ inputs.commit_sha }}"' "$env/values.yaml"
yq e -i '(."'"$chart_key"'".web.dbMigrate.envSecrets[] | select(.name=="DD_VERSION").value) |= "${{ inputs.commit_sha }}"' "$env/values.yaml"
yq e -i '(."'"$chart_key"'".worker.envSecrets[] | select(.name=="DD_VERSION").value) |= "${{ inputs.commit_sha }}"' "$env/values.yaml"
yq e -i '(."'"$chart_key"'".web.envSecrets[] | select(.name=="DD_GIT_COMMIT_SHA").value) |= "${{ inputs.commit_sha }}"' "$env/values.yaml"
yq e -i '(."'"$chart_key"'".web.dbMigrate.envSecrets[] | select(.name=="DD_GIT_COMMIT_SHA").value) |= "${{ inputs.commit_sha }}"' "$env/values.yaml"
yq e -i '(."'"$chart_key"'".worker.envSecrets[] | select(.name=="DD_GIT_COMMIT_SHA").value) |= "${{ inputs.commit_sha }}"' "$env/values.yaml"
done
git diff

git diff
- name: Add and Commit file
uses: EndBug/add-and-commit@290ea2c423ad77ca9c62ae0f5b224379612c0321 # v10.0.0
with:
Expand Down
Loading