Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
113 changes: 70 additions & 43 deletions .azuredevops/pipelines/build-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,19 @@ schedules:
include:
- develop

parameters:
# https://github.com/microsoft/azure-pipelines-yaml/blob/master/design/runtime-parameters.md#syntax
- name: MockRegisterOverrideDependentImageTag
type: string
default: ' ' # default value; if no default, then the parameter MUST be given by the user at runtime
- name: MdhBankingOverrideDependentImageTag
type: string
default: ' ' # default value; if no default, then the parameter MUST be given by the user at runtime
- name: MdhEnergyOverrideDependentImageTag
type: string
default: ' ' # default value; if no default, then the parameter MUST be given by the user at runtime

variables:

${{ if eq(variables['Build.SourceBranchName'], 'main') }}:
containerTag: main
${{ else }}:
containerTag: develop

baseSourceDirectory: $(Build.SourcesDirectory)/Source
dockerComposeDirectory: $(baseSourceDirectory)/DockerCompose

Expand All @@ -30,6 +35,27 @@ jobs:
timeoutInMinutes: 120

steps:
# set the register tag to use based on the logic in the template file
- template: set-tag-name.yml
parameters:
name: RegisterTag
input: ${{ parameters.MockRegisterOverrideDependentImageTag }}
context: $[replace(variables['Build.SourceBranch'], 'refs/heads/', '')]

# set the DataHolderBankingTag to use
- template: set-tag-name.yml
parameters:
name: DataHolderBankingTag
input: ${{ parameters.MdhBankingOverrideDependentImageTag }}
context: $[replace(variables['Build.SourceBranch'], 'refs/heads/', '')]

# set the DataHolderEnergyTag to use
- template: set-tag-name.yml
parameters:
name: DataHolderEnergyTag
input: ${{ parameters.MdhEnergyOverrideDependentImageTag }}
context: $[replace(variables['Build.SourceBranch'], 'refs/heads/', '')]

# Build mock-data-recipient
- task: Docker@2
displayName: Build mock-data-recipient image
Expand All @@ -40,26 +66,25 @@ jobs:
repository: mock-data-recipient
tags: latest

# Login to ACR
# Login to Shared ACR
- task: Docker@2
displayName: Login to ACR
condition: always()
displayName: Login to Shared ACR
inputs:
command: login
containerRegistry: $(AcrBaseUrl)
command: login
containerRegistry: $(SpSharedAcr)

# Pull and re-tag images from Azure ACR
- task: Bash@3
displayName: Pull docker images from ACR
inputs:
targetType: inline
script: |
docker pull $(AcrBaseUrl).azurecr.io/mock-register:$(containerTag)
docker pull $(AcrBaseUrl).azurecr.io/mock-data-holder:$(containerTag)
docker pull $(AcrBaseUrl).azurecr.io/mock-data-holder-energy:$(containerTag)
docker tag $(AcrBaseUrl).azurecr.io/mock-register:$(containerTag) mock-register:latest
docker tag $(AcrBaseUrl).azurecr.io/mock-data-holder:$(containerTag) mock-data-holder:latest
docker tag $(AcrBaseUrl).azurecr.io/mock-data-holder-energy:$(containerTag) mock-data-holder-energy:latest
docker pull $(SharedAcrBaseUrl).azurecr.io/mock-register:$(RegisterTag)
docker pull $(SharedAcrBaseUrl).azurecr.io/mock-data-holder:$(DataHolderBankingTag)
docker pull $(SharedAcrBaseUrl).azurecr.io/mock-data-holder-energy:$(DataHolderEnergyTag)
docker tag $(SharedAcrBaseUrl).azurecr.io/mock-register:$(RegisterTag) mock-register:latest
docker tag $(SharedAcrBaseUrl).azurecr.io/mock-data-holder:$(DataHolderBankingTag) mock-data-holder:latest
docker tag $(SharedAcrBaseUrl).azurecr.io/mock-data-holder-energy:$(DataHolderEnergyTag) mock-data-holder-energy:latest

# List docker images
- task: Docker@2
Expand Down Expand Up @@ -175,7 +200,7 @@ jobs:
docker run \
-v=$(dockerComposeDirectory)/_temp/mock-data-recipient-integration-tests/testresults/results.trx:/app/results.trx:ro \
-v=$(dockerComposeDirectory)/_temp/mock-data-recipient-integration-tests/testresults/formatted/:/app/out/:rw \
$(AcrBaseUrl).azurecr.io/trx-formatter -i results.trx -t "MDR" --outputprefix "MDR" -o out/
$(SharedAcrBaseUrl).azurecr.io/trx-formatter -i results.trx -t "MDR" --outputprefix "MDR" -o out/
displayName: 'Run trx-formatter for integration tests'
condition: always()

Expand All @@ -190,7 +215,7 @@ jobs:
docker run \
-v=$(dockerComposeDirectory)/_temp/mock-data-recipient-e2e-tests/testresults/results.trx:/app/results.trx:ro \
-v=$(dockerComposeDirectory)/_temp/mock-data-recipient-e2e-tests/testresults/formatted/:/app/out/:rw \
$(AcrBaseUrl).azurecr.io/trx-formatter -i results.trx -t "MDR-E2E" --outputprefix "MDR-E2E" -o out/
$(SharedAcrBaseUrl).azurecr.io/trx-formatter -i results.trx -t "MDR-E2E" --outputprefix "MDR-E2E" -o out/
displayName: 'Run trx-formatter for E2E tests'
condition: always()

Expand Down Expand Up @@ -230,32 +255,34 @@ jobs:
- publish: $(baseSourceDirectory)/CDR.DataRecipient.Repository.SQL/efbundle
displayName: Publish EF Migration bundle
condition: always()
artifact: Database Migration Scripts

- task: Docker@2
displayName: 'Re-Tag Mock Data Recipient image with :branch-name'
inputs:
containerRegistry: $(AcrBaseUrl)
repository: 'mock-data-recipient'
command: tag
arguments: 'mock-data-recipient $(AcrBaseUrl).azurecr.io/mock-data-recipient:$(Build.SourceBranchName)'
artifact: Database Migration Scripts

- task: Docker@2
displayName: 'Re-Tag Mock Data Recipient image with :latest (for develop branch only)'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/develop'))
- task: Bash@3
displayName: 'Tag and push Mock Data Recipient image with Source Branch Name for any successful builds.'
condition: succeeded()
inputs:
containerRegistry: $(AcrBaseUrl)
repository: 'mock-data-recipient'
command: tag
arguments: 'mock-data-recipient $(AcrBaseUrl).azurecr.io/mock-data-recipient:latest'
targetType: inline
script: |
echo Tagging mock-data-recipient with Source Branch Name: $(Build.SourceBranchName)
docker tag mock-data-recipient $(SharedAcrBaseUrl).azurecr.io/mock-data-recipient:$(Build.SourceBranchName)

- task: CmdLine@2
displayName: 'Push Mock Data Recipient image with :branch-name tag to ACR'
inputs:
script: 'docker push $(AcrBaseUrl).azurecr.io/mock-data-recipient:$(Build.SourceBranchName)'
echo Pushing all tags to $(SharedAcrBaseUrl).azurecr.io/mock-data-recipient
docker image push --all-tags $(SharedAcrBaseUrl).azurecr.io/mock-data-recipient

- task: CmdLine@2
displayName: 'Push Mock Data Recipient image with :latest tag to ACR (develop branch only)'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/develop'))
- task: Bash@3
displayName: 'Tag and Push Mock Data Recipient images for develop, main and release branches.'
condition: and(succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/develop'), eq(variables['Build.SourceBranch'], 'refs/heads/main'), startsWith(variables['Build.SourceBranch'], 'refs/heads/releases/')))
inputs:
script: 'docker push $(AcrBaseUrl).azurecr.io/mock-data-recipient:latest'
targetType: inline
script: |
echo Tagging mock-data-recipient with latest tag
docker tag mock-data-recipient $(SharedAcrBaseUrl).azurecr.io/mock-data-recipient:latest

echo Tagging mock-data-recipient with Source Branch Name-latest: $(Build.SourceBranchName)-latest
docker tag mock-data-recipient $(SharedAcrBaseUrl).azurecr.io/mock-data-recipient:$(Build.SourceBranchName)-latest

echo Tagging mock-data-recipient with build id: $(Build.BuildId)
docker tag mock-data-recipient $(SharedAcrBaseUrl).azurecr.io/mock-data-recipient:$(Build.BuildId)

echo Pushing all tags to $(SharedAcrBaseUrl).azurecr.io/mock-data-recipient
docker image push --all-tags $(SharedAcrBaseUrl).azurecr.io/mock-data-recipient
33 changes: 33 additions & 0 deletions .azuredevops/pipelines/set-tag-name.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
parameters:
- name: name # Name of the variable to set
type: string
- name: input
type: string
default: ''
- name: context
type: string # e.g., $(Build.SourceBranchName)

steps:
- powershell: |
$input = "${{ parameters.input }}"
$context = "${{ parameters.context }}"
$varName = "${{ parameters.name }}"

Write-Host "Setting variable: $varName"
Write-Host "Input provided: $input"
Write-Host "Context: $context"

if (-not [string]::IsNullOrWhiteSpace($input)) {
Write-Host "##vso[task.setvariable variable=$varName]$input"
Write-Host "Used provided value for ${varName}: ${input}"
} else {
switch -Wildcard ($context) {
"main" { $value = "main-latest" }
"develop" { $value = "develop-latest" }
"*release*" { $value = "main-latest" }
default { $value = "develop-latest" }
}
Write-Host "Resolved ${varName} to: ${value}"
Write-Host "##vso[task.setvariable variable=$varName]$value"
}
displayName: 'Set ${{ parameters.name }} variable'
8 changes: 4 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -70,7 +70,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v3
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell
# 📚 https://git.io/JvXDl
Expand All @@ -84,4 +84,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
uses: github/codeql-action/analyze@v2
2 changes: 1 addition & 1 deletion .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:

steps:
- name: Checkout Data Recipient
uses: actions/checkout@v4
uses: actions/checkout@v2
with:
path: ./mock-data-recipient

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v2

- name: Publish Unit Test Report
uses: dorny/test-reporter@v1
Expand All @@ -25,7 +25,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v2

- name: Publish Integration Test Report
uses: dorny/test-reporter@v1
Expand All @@ -39,7 +39,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v2

- name: Publish e2e Test Report
uses: dorny/test-reporter@v1
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
## [3.0.1] - 2025-06-19
### Changed
- Fixed multiple build warnings to improve code quality and maintainability

## [3.0.0] - 2025-03-19
### Changed
- Updated NuGet packages
Expand Down
2 changes: 1 addition & 1 deletion Help/container/HELP.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ docker build -f Dockerfile -t mock-data-recipient .
```
Run the SQL Server image.
```
docker run -d -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=Pa{}w0rd2019" -p 1433:1433 --name sql1 -h sql1 -d mcr.microsoft.com/mssql/server:2022-latest
docker run -d -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=Pa{}w0rd2019" -p 1433:1433 --name sql1 -h sql1 -d mcr.microsoft.com/mssql/server:2022-latest
```
Run the new docker image.
```
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![Consumer Data Right Logo](./cdr-logo.png?raw=true)

[![Consumer Data Standards v1.33.0](https://img.shields.io/badge/Consumer%20Data%20Standards-v1.33.0-blue.svg)](https://consumerdatastandardsaustralia.github.io/standards-archives/standards-1.33.0/#introduction)
[![Consumer Data Standards v1.34.0](https://img.shields.io/badge/Consumer%20Data%20Standards-v1.34.0-blue.svg)](https://consumerdatastandardsaustralia.github.io/standards-archives/standards-1.34.0/#introduction)
[![made-with-dotnet](https://img.shields.io/badge/Made%20with-.NET-1f425Ff.svg)](https://dotnet.microsoft.com/)
[![made-with-csharp](https://img.shields.io/badge/Made%20with-C%23-1f425Ff.svg)](https://docs.microsoft.com/en-us/dotnet/csharp/)
[![MIT License](https://img.shields.io/github/license/ConsumerDataRight/mock-data-recipient)](./LICENSE)
Expand All @@ -13,7 +13,7 @@ This repository contains a mock implementation of a Data Recipient and is offere

## Mock Data Recipient - Alignment
The Mock Data Recipient in this release:
* aligns to [v1.33.0](https://consumerdatastandardsaustralia.github.io/standards-archives/standards-1.33.0/#introduction) of the [Consumer Data Standards](https://consumerdatastandardsaustralia.github.io/standards-archives/standards-1.33.0/#introduction);
* aligns to [v1.34.0](https://consumerdatastandardsaustralia.github.io/standards-archives/standards-1.34.0/#introduction) of the [Consumer Data Standards](https://consumerdatastandardsaustralia.github.io/standards-archives/standards-1.34.0/#introduction);
* can connect to and complete authentication against both [FAPI 1.0 Migration Phase 2 and Phase 3](https://consumerdatastandardsaustralia.github.io/standards/#authentication-flows) compliant data holders.

## Getting Started
Expand Down
Loading
Loading