Skip to content

Commit

Permalink
v1.1.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
CDR-FarooqK authored Oct 4, 2022
1 parent 2d2b0de commit fe365d8
Show file tree
Hide file tree
Showing 61 changed files with 2,921 additions and 411 deletions.
134 changes: 134 additions & 0 deletions .azuredevops/pipelines/build-dr-func-v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@

resources:
repositories:
- repository: MockRegister
type: git
name: sb-mock-register
ref: develop

trigger:
- develop
- main
- releases/*

pool:
vmImage: ubuntu-latest

steps:
- checkout: MockRegister
- checkout: self

# Build mock-register
- task: Docker@2
displayName: Build mock-register image
inputs:
command: build
Dockerfile: $(Build.SourcesDirectory)/sb-mock-register/Source/Dockerfile.for-testing
buildContext: $(Build.SourcesDirectory)/sb-mock-register/Source
repository: mock-register
tags: latest

# Run integration tests
- task: DockerCompose@0
displayName: Integration Tests - Up
condition: always()
inputs:
action: Run a Docker Compose command
dockerComposeFile: $(Build.SourcesDirectory)/sb-mock-data-holder/Source/docker-compose.GetDataRecipients.IntegrationTests.yml
dockerComposeCommand: up --abort-on-container-exit --exit-code-from getdatarecipients-integration-tests

# Remove integration tests
- task: DockerCompose@0
displayName: Integration Tests - Down
condition: always()
inputs:
action: Run a Docker Compose command
dockerComposeFile: $(Build.SourcesDirectory)/sb-mock-data-holder/Source/docker-compose.GetDataRecipients.IntegrationTests.yml
dockerComposeCommand: down

# Publish mock-register logs
- publish: $(Build.SourcesDirectory)/sb-mock-data-holder/Source/_temp/mock-register/tmp
displayName: Publish MockRegister logs
condition: always()
artifact: Mock-Register - Logs

# Publish mock-data-holder logs
- publish: $(Build.SourcesDirectory)/sb-mock-data-holder/Source/_temp/mock-data-holder/tmp
displayName: Publish MockDataHolder logs
condition: always()
artifact: Mock-Data-Holder - Logs

# Login to ACR
- task: Docker@2
displayName: Login to ACR
condition: always()
inputs:
command: login
containerRegistry: <<yourContainerRegistryName>>

# Run trx formatter to output .MD and .CSV
- script: |
docker run \
-v=$(Build.SourcesDirectory)/sb-mock-data-holder/Source/_temp/getdatarecipients-integration-tests/testresults/results.trx:/app/results.trx:ro \
-v=$(Build.SourcesDirectory)/sb-mock-data-holder/Source/_temp/getdatarecipients-integration-tests/testresults/formatted/:/app/out/:rw \
<<yourContainerRegistryName>>.azurecr.io/trx-formatter -i results.trx -t "MDH-GetDataRecipients" --outputprefix "MDH-GetDataRecipients" -o out/
displayName: 'Run trx-formatter'
condition: always()
# Publish getdatarecipients integration tests results
- publish: $(Build.SourcesDirectory)/sb-mock-data-holder/Source/_temp/getdatarecipients-integration-tests/testresults
displayName: Publish integration tests
condition: always()
artifact: GetDataRecipients - Integration tests

- task: PublishTestResults@2
displayName: 'Surface Integration Test TRX results to devops'
condition: succeededOrFailed()
inputs:
testResultsFormat: 'VSTest' # Options: JUnit, NUnit, VSTest, xUnit, cTest
testResultsFiles: '**/results.trx'
searchFolder: $(Build.SourcesDirectory)/sb-mock-data-holder/Source/_temp/getdatarecipients-integration-tests/testresults
#mergeTestResults: false # Optional
#failTaskOnFailedTests: false # Optional
testRunTitle: 'getdatarecipients-integration-tests' # Optional
#buildPlatform: # Optional
#buildConfiguration: # Optional
publishRunAttachments: true # Optional

# Tests have passed, so now build/publish the azure function

- task: UseDotNet@2
displayName: 'Install .NET 6 SDK'
inputs:
packageType: 'sdk'
version: '6.0.x'
performMultiLevelLookup: true

- script: |
cd $(Build.SourcesDirectory)/sb-mock-data-holder/Source/CDR.GetDataRecipients
dotnet restore
dotnet build --configuration Release
displayName: 'Build CDR.GetDataRecipients'
- task: DotNetCoreCLI@2
inputs:
command: publish
arguments: '--configuration Release --output publish_output'
projects: '$(Build.SourcesDirectory)/sb-mock-data-holder/Source/CDR.GetDataRecipients/CDR.GetDataRecipients.csproj'
publishWebProjects: false
modifyOutputPath: false
zipAfterPublish: false
displayName: 'DotNet publish CDR.GetDataRecipients'

- task: ArchiveFiles@2
displayName: 'Archive CDR.GetDataRecipients'
inputs:
rootFolderOrFile: '$(System.DefaultWorkingDirectory)/publish_output'
includeRootFolder: false
archiveFile: '$(System.DefaultWorkingDirectory)/CDR.GetDataRecipients.zip'

- task: PublishBuildArtifacts@1
displayName: 'Publish CDR.GetDataRecipients'
inputs:
PathToPublish: '$(System.DefaultWorkingDirectory)/CDR.GetDataRecipients.zip'
artifactName: 'functions'
21 changes: 18 additions & 3 deletions .azuredevops/pipelines/build-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,29 @@ steps:
condition: always()
artifact: Mock-Data-Holder - Unit tests

# Login to ACR
- task: Docker@2
displayName: Login to ACR
condition: always()
inputs:
command: login
containerRegistry: <<yourContainerRegistryName>>

# Run trx formatter to output .MD and .CSV
- script: |
docker run \
-v=$(Build.SourcesDirectory)/sb-mock-data-holder/Source/_temp/mock-data-holder-integration-tests/testresults/results.trx:/app/results.trx:ro \
-v=$(Build.SourcesDirectory)/sb-mock-data-holder/Source/_temp/mock-data-holder-integration-tests/testresults/formatted/:/app/out/:rw \
<<yourContainerRegistryName>>.azurecr.io/trx-formatter -i results.trx -t "MDH" --outputprefix "MDH" -o out/
displayName: 'Run trx-formatter'
condition: always()

# Publish mock-data-holder integration tests results
- publish: $(Build.SourcesDirectory)/sb-mock-data-holder/Source/_temp/mock-data-holder-integration-tests/testresults
displayName: Publish integration tests
condition: always()
artifact: Mock-Data-Holder - Integration tests

# TODO - MJS - Run formatter over TRX to produce formatted report suitable for attaching to Devops US & publish as artifact

- task: UseDotNet@2
displayName: 'Use .NET 6 sdk'
condition: always()
Expand Down Expand Up @@ -199,4 +214,4 @@ steps:
#testRunTitle: # Optional
#buildPlatform: # Optional
#buildConfiguration: # Optional
#publishRunAttachments: true # Optional
#publishRunAttachments: true # Optional
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.1.0] - 2022-10-05
### Added
- Logging middleware to create a centralised list of all API requests and responses

### Fixed
- Updated supported response modes in OIDC discovery endpoint. [Issue 46](https://github.com/ConsumerDataRight/mock-data-holder/issues/46)

## [1.0.1] - 2022-08-30
### Changed
- Updated package references.
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](https://raw.githubusercontent.com/ConsumerDataRight/mock-data-holder/main/cdr-logo.png)

[![Consumer Data Standards v1.17.0](https://img.shields.io/badge/Consumer%20Data%20Standards-v1.17.0-blue.svg)](https://consumerdatastandardsaustralia.github.io/standards/#introduction)
[![Consumer Data Standards v1.18.0](https://img.shields.io/badge/Consumer%20Data%20Standards-v1.18.0-blue.svg)](https://consumerdatastandardsaustralia.github.io/standards/#introduction)
[![Conformance Test Suite 4.0](https://img.shields.io/badge/Conformance%20Test%20Suite-v4.0-darkblue.svg)](https://www.cdr.gov.au/for-providers/conformance-test-suite-data-holders)
[![FAPI 1.0 Advanced Profile](https://img.shields.io/badge/FAPI%201.0-orange.svg)](https://openid.net/specs/openid-financial-api-part-2-1_0.html)
[![made-with-dotnet](https://img.shields.io/badge/Made%20with-.NET-1f425Ff.svg)](https://dotnet.microsoft.com/)
Expand All @@ -14,7 +14,7 @@ This project includes source code, documentation and instructions for a Consumer
This repository contains a mock implementation of a Mock Data Holder and is offered to help the community in the development and testing of their CDR solutions.

## Mock Data Holder - Alignment
The Mock Data Holder aligns to [v1.17.0](https://consumerdatastandardsaustralia.github.io/standards/#introduction) of the [Consumer Data Standards](https://consumerdatastandardsaustralia.github.io/standards/#introduction).
The Mock Data Holder aligns to [v1.18.0](https://consumerdatastandardsaustralia.github.io/standards/#introduction) of the [Consumer Data Standards](https://consumerdatastandardsaustralia.github.io/standards/#introduction).
The Mock Data Holder passed v4.0 of the [Conformance Test Suite for Data Holders](https://www.cdr.gov.au/for-providers/conformance-test-suite-data-holders).
The Mock Data Holder is compliant with the [FAPI 1.0 Advanced Profile](https://openid.net/specs/openid-financial-api-part-2-1_0.html).
The Mock Data Holder aligns to [FAPI 1.0 Migration Phase 1 and Phase 2](https://consumerdatastandardsaustralia.github.io/standards/#authentication-flows). Phase 1 requirements are switched on by default. Configuration has been added to allow switching on Phase 2 requirements.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<RuntimeIdentifiers>win-x64;linux-x64</RuntimeIdentifiers>
<Version>1.0.1</Version>
<FileVersion>1.0.1</FileVersion>
<AssemblyVersion>1.0.1</AssemblyVersion>
<Version>1.1.0</Version>
<FileVersion>1.1.0</FileVersion>
<AssemblyVersion>1.1.0</AssemblyVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

<IsPackable>false</IsPackable>

<Version>1.0.1</Version>
<Version>1.1.0</Version>

<FileVersion>1.0.1</FileVersion>
<FileVersion>1.1.0</FileVersion>

<AssemblyVersion>1.0.1</AssemblyVersion>
<AssemblyVersion>1.1.0</AssemblyVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Version>1.0.1</Version>
<FileVersion>1.0.1</FileVersion>
<AssemblyVersion>1.0.1</AssemblyVersion>
<Version>1.1.0</Version>
<FileVersion>1.1.0</FileVersion>
<AssemblyVersion>1.1.0</AssemblyVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="IdentityModel" Version="4.4.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="5.0.0" />
<PackageReference Include="Serilog" Version="2.10.0" />
<PackageReference Include="Serilog.AspNetCore" Version="4.0.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="5.0.0" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.15.1" />
</ItemGroup>

</Project>
20 changes: 20 additions & 0 deletions Source/CDR.DataHolder.API.Logger/CDR.DataHolder.API.Logger.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>1.1.0</Version>
<FileVersion>1.1.0</FileVersion>
<AssemblyVersion>1.1.0</AssemblyVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.9" />
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="2.2.0" />
<PackageReference Include="Serilog.AspNetCore" Version="4.1.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="3.3.0" />
<PackageReference Include="Serilog.Sinks.MSSqlServer" Version="5.7.1" />
</ItemGroup>

</Project>
9 changes: 9 additions & 0 deletions Source/CDR.DataHolder.API.Logger/IRequestResponseLogger.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace CDR.DataHolder.API.Logger
{
using Serilog;

public interface IRequestResponseLogger
{
ILogger Log { get; }
}
}
13 changes: 13 additions & 0 deletions Source/CDR.DataHolder.API.Logger/LoggerExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace CDR.DataHolder.API.Logger
{
using Microsoft.Extensions.DependencyInjection;

public static class LoggerExtensions
{
public static IServiceCollection AddRequestResponseLogging(this IServiceCollection services)
{
services.AddSingleton<IRequestResponseLogger, RequestResponseLogger>();
return services;
}
}
}
54 changes: 54 additions & 0 deletions Source/CDR.DataHolder.API.Logger/RequestResponseLogger.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
namespace CDR.DataHolder.API.Logger
{
using System.Diagnostics;
using Microsoft.Extensions.Configuration;
using Serilog;
using Serilog.Core;

public class RequestResponseLogger : IRequestResponseLogger, IDisposable
{
private readonly Logger _logger;
private readonly IConfiguration _configuration;

public ILogger Log { get { return _logger; } }

public RequestResponseLogger(IConfiguration configuration)
{

_configuration = configuration;

_logger = new LoggerConfiguration()
.ReadFrom.Configuration(configuration, sectionName: "SerilogRequestResponseLogger")
.Enrich.WithProperty("RequestMethod", "")
.Enrich.WithProperty("RequestBody", "")
.Enrich.WithProperty("RequestHeaders", "")
.Enrich.WithProperty("RequestPath", "")
.Enrich.WithProperty("RequestQueryString", "")
.Enrich.WithProperty("StatusCode", "")
.Enrich.WithProperty("ElapsedTime", "")
.Enrich.WithProperty("ResponseHeaders", "")
.Enrich.WithProperty("ResponseBody", "")
.Enrich.WithProperty("RequestHost", "")
.Enrich.WithProperty("RequestIpAddress", "")
.Enrich.WithProperty("ClientId", "")
.Enrich.WithProperty("SoftwareId", "")
.Enrich.WithProperty("FapiInteractionId", "")
.CreateLogger();
}

public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}

protected virtual void Dispose(bool disposing)
{
if (disposing)
{
Serilog.Log.CloseAndFlush();
}

}
}
}
Loading

0 comments on commit fe365d8

Please sign in to comment.