Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
4288b50
Receive parameters from CI pipeline
micjustus-nc Jun 4, 2025
c31afec
Update quotes for arguments
micjustus-nc Jun 4, 2025
3e7698b
Call the pipeline on the same branch as the build template (not using…
micjustus-nc Jun 4, 2025
6ea3521
Enable test scenario
micjustus-nc Jun 4, 2025
de580c8
Ensure steps alway execute for testing
micjustus-nc Jun 4, 2025
b695ac1
Format update for all services output; update ref for testing;
micjustus-nc Jun 4, 2025
e15ab9e
Fix incorrect refs
micjustus-nc Jun 4, 2025
1a2855f
Fix reference to branch name instead of PR name
micjustus-nc Jun 4, 2025
f3d8d4f
Parameter definition updates
micjustus-nc Jun 4, 2025
dfb4761
Update parameter name casing
micjustus-nc Jun 4, 2025
486b3d0
Remove unnecessary parameter
micjustus-nc Jun 4, 2025
3b9d724
Fix variable reference issue
micjustus-nc Jun 5, 2025
ba228e7
Issue with docker services JSON array
micjustus-nc Jun 5, 2025
7ebf937
Update services to separate by comma
micjustus-nc Jun 5, 2025
00ca16d
Fix correct item separation using comma
micjustus-nc Jun 5, 2025
e2ee328
Remove unnecessary parameter
micjustus-nc Jun 6, 2025
b0b3a9f
Add required properties to build-3 pipeline
micjustus-nc Jun 6, 2025
8010f9d
Remove parameters not defined in referenced workflow
micjustus-nc Jun 6, 2025
14db980
Prepare for PR
micjustus-nc Jun 6, 2025
c638f77
Update branch name used to run as "main"ℹ
micjustus-nc Jun 6, 2025
56098cb
Update build stage parameter values
micjustus-nc Jun 6, 2025
5bb57f1
Testing default registry host value in pipeline
micjustus-nc Jun 6, 2025
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
9 changes: 7 additions & 2 deletions .azuredevops/templates/steps/tf_plan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

parameters:
- name: tfCommandOptions
type: string
default: ''

steps:
Expand All @@ -24,7 +23,13 @@ steps:
provider: azurerm
command: plan
workingDirectory: $(TF_DIRECTORY)
commandOptions: -input=false -var-file=$(tfVarsFile) ${{ parameters.tfCommandOptions }} -out=$(Build.ArtifactStagingDirectory)/$(ENVIRONMENT).tfplan
commandOptions: >
-input=false
-var-file=$(tfVarsFile)
-var="image_commit_hash=$(imageHash)"
-var="registry_host=$(registryHost)"
${{ parameters.tfCommandOptions }}
-out=$(Build.ArtifactStagingDirectory)/$(ENVIRONMENT).tfplan
environmentServiceNameAzureRM: $(SERVICE_CONNECTION)

- task: PublishBuildArtifacts@1
Expand Down
12 changes: 5 additions & 7 deletions .github/workflows/cicd-1-pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,11 @@ jobs:
uses: ./.github/workflows/stage-3-build.yaml
if: needs.metadata.outputs.does_pull_request_exist == 'true' || (github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'reopened'))
with:
build_datetime: "${{ needs.metadata.outputs.build_datetime }}"
build_timestamp: "${{ needs.metadata.outputs.build_timestamp }}"
build_epoch: "${{ needs.metadata.outputs.build_epoch }}"
nodejs_version: "${{ needs.metadata.outputs.nodejs_version }}"
python_version: "${{ needs.metadata.outputs.python_version }}"
terraform_version: "${{ needs.metadata.outputs.terraform_version }}"
version: "${{ needs.metadata.outputs.version }}"
docker_compose_file_csv_list: compose.yaml
excluded_containers_csv_list: azurite,azurite-setup,sql-database,database-setup,db
environment_tag: ${{ needs.metadata.outputs.environment_tag }}
function_app_source_code_path: src
project_name: project-pipeline-name
secrets: inherit
acceptance-stage: # Recommended maximum execution time is 10 minutes
name: "Acceptance stage"
Expand Down
28 changes: 24 additions & 4 deletions .github/workflows/stage-3-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ jobs:
env:
pr_num_tag: ${{ needs.containers-to-build.outputs.pr_num_tag }}
short_commit_hash: ${{ needs.containers-to-build.outputs.short_commit_hash }}
project_name: ${{ inputs.project_name }}
permissions:
id-token: write
contents: read
Expand Down Expand Up @@ -233,24 +234,43 @@ jobs:
- name: Tag all Registry Container images
env:
container_registry: ${{ env.REGISTRY_HOST }}
docker_services: ${{ needs.containers-to-build.outputs.docker_services }}
project_name: ${{ inputs.project_name }}
docker_services: >-
${{ needs.containers-to-build.outputs.docker_services && join(fromJSON(needs.containers-to-build.outputs.docker_services || '[]'), ',') }}
run: |
echo Running 'docker buildx imagetools' on remote repositories...

if [[ ${USE_AZURECR} == 'true' ]]; then
az acr login --name "${ACR_NAME}"
fi

services=($(echo "$docker_services" | jq -r '.[]'))
IFS=',' read -ra services <<< "$docker_services"
for service in "${services[@]}"; do
image_name="${project_name}-${service}"
registry_image=${container_registry,,}/${image_name,,}

echo "Adding tag ${short_commit_hash} to ${image_name}..."
docker buildx imagetools create "${registry_image}:${pr_num_tag}" --tag "${registry_image}:${short_commit_hash}" || echo "Tagging failed for $service"
docker buildx imagetools create "${registry_image}:${pr_num_tag}" --tag "${registry_image}:${short_commit_hash}" \
|| echo "Tagging failed for $service"
done

- uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- name: Call deployment pipeline
if: success()
env:
container_registry: ${{ env.REGISTRY_HOST }}
run: |
az pipelines run \
--branch "main" \
--name cd-infrastructure-dev-core \
--org https://dev.azure.com/nhse-dtos \
--project ${project_name} \
--parameters "imageHash=${short_commit_hash}" "registryHost=${container_registry,,}"

aggregate-reports:
name: Aggregate reports
runs-on: ubuntu-latest
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,5 @@ coverage.xml
.pyre/
.pylint.d/
.prof
__azurite_db_blob__.json
__azurite_db_blob_extent__.json
7 changes: 5 additions & 2 deletions scripts/deployments/get-docker-names.sh
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,16 @@ EOF
fi

changed_services_json="$(jq -c -n '$ARGS.positional | unique' --args "${changed_services[@]}")"
services_json="$(jq -c -n '$ARGS.positional | unique' --args "${docker_services_map[@]}")"

args=("${docker_services_map[@]}")
services_json=$(jq -c -n '$ARGS.positional | unique' --args "${args[@]}")


IFS=$IFS_OLD
echo "List of services to build:"
echo "${changed_services_json}"
echo "FUNC_NAMES=${changed_services_json}" >> "${GITHUB_OUTPUT}"
echo "ALL_SERVICES=%{services_json}" >> "${GITHUB_OUTPUT}"
echo "ALL_SERVICES=${services_json}" >> "${GITHUB_OUTPUT}"

# Assumes all compose files are together in the same folder
echo "DOCKER_COMPOSE_DIR=$(dirname "${compose_file}")" >> "${GITHUB_OUTPUT}"
Loading