generated from nhs-england-tools/repository-template
-
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.
dtoss-5599 image pipeline database changes template (#91)
- Loading branch information
Showing
4 changed files
with
94 additions
and
1 deletion.
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
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,19 @@ | ||
--- | ||
|
||
parameters: | ||
- name: serviceConnection | ||
type: string | ||
|
||
steps: | ||
- task: AzureCLI@2 | ||
name: apply_database_changes | ||
displayName: Apply database changes | ||
inputs: | ||
azureSubscription: ${{ parameters.serviceConnection }} | ||
addSpnToEnvironment: true | ||
failOnStandardError: false | ||
scriptType: bash | ||
scriptLocation: inlineScript | ||
inlineScript: | | ||
# Placeholder for database changes | ||
echo "Applying database changes (placeholder)..." |
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,46 @@ | ||
--- | ||
|
||
parameters: | ||
- name: serviceConnection | ||
type: string | ||
|
||
steps: | ||
- task: AzureCLI@2 | ||
name: deploy_images | ||
displayName: Deploy images with tag $(ADD_IMAGE_TAG) | ||
inputs: | ||
azureSubscription: ${{ parameters.serviceConnection }} | ||
addSpnToEnvironment: true | ||
failOnStandardError: false | ||
scriptType: bash | ||
scriptLocation: inlineScript | ||
inlineScript: | | ||
# Prerequisite: A DNS A record for the chosen Dev ACR must exist in the Prod privatelink.azurecr.io zone, resolving to the public IP for that ACR | ||
set -eo pipefail | ||
declare -a pids | ||
wait_for_completion() { | ||
# acr tasks are backgrounded for parallelism | ||
local -n arr=$1 | ||
for pid in "${arr[@]}"; do | ||
wait ${pid} | ||
done | ||
} | ||
[[ "${DEST_REGISTRY}" =~ dev ]] && az account set -s ${TF_VAR_HUB_SUBSCRIPTION_ID} | ||
repos=$(az acr repository list --name ${DEST_REGISTRY} --output tsv) | ||
for repo in ${repos}; do | ||
functionName=$(echo $repo | sed "s/$(PROJECT_NAME)/$(FUNCTION_NAME_PREFIX)/") | ||
echo "##[debug] Deploying ${repo}:${ADD_IMAGE_TAG} to ${functionName}..." | ||
# Output the command to be run for debugging purposes | ||
echo "##[debug] az functionapp config container set --name $functionName --resource-group $(FUNCTION_RESOURCE_GROUP) --docker-custom-image-name ${DEST_REGISTRY}.azurecr.io/${repo}:${ADD_IMAGE_TAG} --registry-server https://${DEST_REGISTRY}.azurecr.io" | ||
# Uncomment the following line to actually run the command | ||
# az functionapp config container set --name $functionName --resource-group $(FUNCTION_RESOURCE_GROUP) --docker-custom-image-name ${DEST_REGISTRY}.azurecr.io/${repo}:${ADD_IMAGE_TAG} --registry-server https://${DEST_REGISTRY}.azurecr.io & | ||
pids+=($!) | ||
done | ||
wait_for_completion pids | ||
echo "##[debug] All images imported" |
29 changes: 29 additions & 0 deletions
29
.azuredevops/templates/steps/run-post-deployment-tests.yaml
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,29 @@ | ||
--- | ||
|
||
parameters: | ||
- name: serviceConnection | ||
type: string | ||
|
||
steps: | ||
- task: UseDotNet@2 | ||
displayName: 'Use .NET Core sdk and install if required' | ||
inputs: | ||
packageType: 'sdk' | ||
installationPath: $(Agent.ToolsDirectory)/dotnet | ||
|
||
# - task: DotNetCoreCLI@2 | ||
# displayName: 'Restore dependencies' | ||
# inputs: | ||
# command: 'restore' | ||
# projects: '**/*.csproj' | ||
|
||
# - task: DotNetCoreCLI@2 | ||
# displayName: 'Build the .NET project' | ||
# inputs: | ||
# command: 'build' | ||
# projects: '**/*.csproj' | ||
# arguments: '--configuration Release' | ||
|
||
# - script: | | ||
# dotnet run --project <path-to-your-project-file> | ||
# displayName: 'Run .NET Application' |