Skip to content

AMP-313: Use centralized deploy workflow from cp-vp-aks-deploy#130

Open
Trozz wants to merge 4 commits intomainfrom
AMP-313/auto-deploy-pipeline
Open

AMP-313: Use centralized deploy workflow from cp-vp-aks-deploy#130
Trozz wants to merge 4 commits intomainfrom
AMP-313/auto-deploy-pipeline

Conversation

@Trozz
Copy link

@Trozz Trozz commented Mar 3, 2026

JIRA link (if applicable)

See AMP-313

Change description

Replace Update-Deploy-Config and Trigger-K8s-Deploy jobs with a single Deploy-To-K8s reusable workflow call to cp-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")

[ ] Yes
[x] No

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.
Copilot AI review requested due to automatic review settings March 3, 2026 12:38
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_environment wiring from calling workflows into the reusable build/publish workflow.
  • Update the ADO trigger action to hmcts/trigger-ado-pipeline@v2 and capture run_id for monitoring.
  • Add new jobs to wait for ADO completion, update hmcts/cp-vp-aks-deploy config 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>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +249 to +257
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
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +279 to +280
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 }}"
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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

Copilot uses AI. Check for mistakes.
@Trozz Trozz changed the title AMP-313: Add automated deployment pipeline AMP-313: Use centralized deploy workflow from cp-vp-aks-deploy Mar 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants