AMP-313: Use centralized deploy workflow from cp-vp-aks-deploy#130
AMP-313: Use centralized deploy workflow from cp-vp-aks-deploy#130
Conversation
Add Wait-For-ACR-Push, Update-Deploy-Config, and Trigger-K8s-Deploy jobs to automate the full deployment flow after ADO pipeline 460 completes. Updates trigger-ado-pipeline to v2 to capture run_id.
There was a problem hiding this comment.
Pull request overview
This PR extends the reusable GitHub Actions workflow to automate an end-to-end deployment flow after triggering Azure DevOps pipeline 460, including waiting for completion, updating the deployment config repo, and triggering a K8s deploy pipeline.
Changes:
- Add
deploy_environmentwiring from calling workflows into the reusable build/publish workflow. - Update the ADO trigger action to
hmcts/trigger-ado-pipeline@v2and capturerun_idfor monitoring. - Add new jobs to wait for ADO completion, update
hmcts/cp-vp-aks-deployconfig via SSH +yq, and trigger the K8s ADO pipeline.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| .github/workflows/ci-released.yml | Passes deploy_environment into the reusable workflow. |
| .github/workflows/ci-draft.yml | Passes deploy_environment into the reusable workflow for non-release CI. |
| .github/workflows/ci-build-publish.yml | Adds deploy-environment input/secret, upgrades ADO trigger action, and introduces wait/config-update/K8s-trigger jobs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| run: | | ||
| ENV_BRANCH="env/${{ inputs.deploy_environment }}" | ||
| git fetch origin "${ENV_BRANCH}" || true | ||
| if git rev-parse --verify "origin/${ENV_BRANCH}" >/dev/null 2>&1; then | ||
| git checkout "${ENV_BRANCH}" | ||
| git pull origin "${ENV_BRANCH}" | ||
| else | ||
| git checkout -b "${ENV_BRANCH}" | ||
| fi |
There was a problem hiding this comment.
deploy_environment is used to form/push an env/<name> branch here, but it’s only validated later in Trigger-K8s-Deploy. With an invalid value, this job can still create/update and push an unintended branch before the workflow fails. Validate deploy_environment (dev/sit/prp/prd) before any git operations that mutate the deploy repo.
| git diff --cached --quiet && echo "No changes to commit" && exit 0 | ||
| git commit -m "Update ${{ needs.Build.outputs.repo_name }} to ${{ needs.Artefact-Version.outputs.artefact_version }}" |
There was a problem hiding this comment.
If the env/<deploy_environment> branch does not yet exist and the image tag already matches (so there are “No changes to commit”), this step exits before pushing the newly-created branch. The next job then triggers ADO pipeline 434 against refs/heads/env/<deploy_environment>, which may not exist remotely and can fail. Ensure the env branch exists on origin (push it at least once) even when there are no content changes.
| git diff --cached --quiet && echo "No changes to commit" && exit 0 | |
| git commit -m "Update ${{ needs.Build.outputs.repo_name }} to ${{ needs.Artefact-Version.outputs.artefact_version }}" | |
| if ! git diff --cached --quiet; then | |
| git commit -m "Update ${{ needs.Build.outputs.repo_name }} to ${{ needs.Artefact-Version.outputs.artefact_version }}" | |
| else | |
| echo "No changes to commit" | |
| fi |
JIRA link (if applicable)
See AMP-313
Change description
Replace
Update-Deploy-ConfigandTrigger-K8s-Deployjobs with a singleDeploy-To-K8sreusable workflow call tocp-vp-aks-deploy. Deployment logic is now centralized, reducing ~96 lines to 8.Depends on https://github.com/hmcts/cp-vp-aks-deploy/pull/24 being merged first.
Does this PR introduce a breaking change? (check one with "x")