-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #803 from DFE-Digital/1901-aytq-deploy-review-apps…
…-using-workflow 1901 aytq deploy review apps using workflow
- Loading branch information
Showing
5 changed files
with
307 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: Deploy environment to AKS | ||
description: Deploys an application environment to AKS | ||
|
||
inputs: | ||
environment: | ||
description: The name of the environment | ||
required: true | ||
image-tag: | ||
description: The image tag to deploy | ||
required: true | ||
azure-credentials: | ||
description: JSON object containing a service principal that can read from Azure Key Vault | ||
required: true | ||
pull-request-number: | ||
description: The pull request number which triggered this deploy. | ||
required: false | ||
|
||
runs: | ||
using: composite | ||
|
||
steps: | ||
- uses: hashicorp/setup-terraform@v3 | ||
with: | ||
terraform_version: 1.6.4 | ||
terraform_wrapper: false | ||
|
||
- uses: DFE-Digital/github-actions/set-kubelogin-environment@master | ||
with: | ||
azure-credentials: ${{ inputs.azure-credentials }} | ||
|
||
- name: Terraform Apply | ||
shell: bash | ||
run: | | ||
make ci ${{ inputs.environment }} aks-terraform-apply | ||
env: | ||
DOCKER_IMAGE_TAG: ${{ inputs.image-tag }} | ||
PR_NUMBER: ${{ inputs.pull-request-number }} | ||
|
||
- name: Extract Terraform outputs | ||
shell: bash | ||
id: set_outputs | ||
run: | | ||
output=$(terraform -chdir=terraform/application output -json urls) | ||
echo "HOSTNAMES=$output" >> $GITHUB_ENV | ||
- name: Run smoke tests | ||
shell: bash | ||
run: | | ||
# Parse the JSON array of URLs into a Bash array | ||
urls=$(echo "$HOSTNAMES" | jq -r '.[]') | ||
# Loop over each URL and perform the curl check on the /health/all.json endpoint | ||
for url in $urls; do | ||
echo "Check health for $url/health/all.json..." | ||
curl -sS --fail "$url/health/all.json" > /dev/null && echo "Health check passed for $url" || echo "Health check failed for $url" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.