Skip to content

Commit 35f26b4

Browse files
authored
v1.0.0 release
2 parents 2ddbc58 + 79ee01f commit 35f26b4

File tree

141 files changed

+6447
-705
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

141 files changed

+6447
-705
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
trigger:
2+
- develop
3+
- main
4+
- releases/*
5+
6+
pool:
7+
vmImage: windows-latest
8+
9+
steps:
10+
- task: UseDotNet@2
11+
displayName: 'Install .NET 6 SDK'
12+
inputs:
13+
packageType: 'sdk'
14+
version: '6.0.x'
15+
performMultiLevelLookup: true
16+
17+
- script: |
18+
ls
19+
cd Source/CDR.DCR
20+
ls
21+
dotnet restore
22+
dotnet build --configuration Release
23+
24+
- task: DotNetCoreCLI@2
25+
inputs:
26+
command: publish
27+
arguments: '--configuration Release --output publish_output'
28+
projects: 'Source/CDR.DCR/CDR.DCR.csproj'
29+
publishWebProjects: false
30+
modifyOutputPath: false
31+
zipAfterPublish: false
32+
33+
- task: ArchiveFiles@2
34+
displayName: 'Archive Files'
35+
inputs:
36+
rootFolderOrFile: '$(System.DefaultWorkingDirectory)/publish_output'
37+
includeRootFolder: false
38+
archiveFile: '$(System.DefaultWorkingDirectory)/CDR.DCR.zip'
39+
40+
- task: PublishBuildArtifacts@1
41+
inputs:
42+
PathToPublish: '$(System.DefaultWorkingDirectory)/CDR.DCR.zip'
43+
artifactName: 'functions'
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
trigger:
2+
- develop
3+
- main
4+
- releases/*
5+
6+
pool:
7+
vmImage: windows-latest
8+
9+
steps:
10+
- task: UseDotNet@2
11+
displayName: 'Install .NET 6 SDK'
12+
inputs:
13+
packageType: 'sdk'
14+
version: '6.0.x'
15+
performMultiLevelLookup: true
16+
17+
- script: |
18+
ls
19+
cd Source/CDR.DiscoverDataHolders
20+
ls
21+
dotnet restore
22+
dotnet build --configuration Release
23+
24+
- task: DotNetCoreCLI@2
25+
inputs:
26+
command: publish
27+
arguments: '--configuration Release --output publish_output'
28+
projects: 'Source/CDR.DiscoverDataHolders/CDR.DiscoverDataHolders.csproj'
29+
publishWebProjects: false
30+
modifyOutputPath: false
31+
zipAfterPublish: false
32+
33+
- task: ArchiveFiles@2
34+
displayName: 'Archive Files'
35+
inputs:
36+
rootFolderOrFile: '$(System.DefaultWorkingDirectory)/publish_output'
37+
includeRootFolder: false
38+
archiveFile: '$(System.DefaultWorkingDirectory)/CDR.DiscoverDataHolders.zip'
39+
40+
- task: PublishBuildArtifacts@1
41+
inputs:
42+
PathToPublish: '$(System.DefaultWorkingDirectory)/CDR.DiscoverDataHolders.zip'
43+
artifactName: 'functions'
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Build pipeline v2 (Containerised)
2+
3+
resources:
4+
repositories:
5+
- repository: MockRegister
6+
type: git
7+
name: sb-mock-register
8+
ref: develop
9+
10+
trigger:
11+
- none
12+
13+
pool:
14+
vmImage: ubuntu-latest
15+
16+
steps:
17+
18+
# Checkout repositories
19+
- checkout: MockRegister
20+
- checkout: self
21+
22+
# Build mock-data-recipient
23+
- task: Docker@2
24+
displayName: Build mock-data-recipient image
25+
inputs:
26+
command: build
27+
Dockerfile: $(Build.SourcesDirectory)/sb-mock-data-recipient/Source/Dockerfile
28+
buildContext: $(Build.SourcesDirectory)/sb-mock-data-recipient/Source
29+
repository: mock-data-recipient
30+
tags: latest
31+
32+
# List docker images
33+
- task: Docker@2
34+
displayName: List Docker images
35+
condition: always()
36+
inputs:
37+
command: images
38+
39+
# Save docker image to TAR so it can be published
40+
- task: Docker@2
41+
displayName: Save MockDataRecipient image to TAR
42+
# condition: always()
43+
inputs:
44+
repository: mock-data-recipient
45+
command: save
46+
arguments: --output $(build.artifactstagingdirectory)/mock-data-recipient.image.tar mock-data-recipient
47+
addPipelineData: false
48+
49+
# Publish docker image
50+
- task: PublishPipelineArtifact@1
51+
displayName: Publish container images
52+
# condition: always()
53+
inputs:
54+
path: $(build.artifactstagingdirectory)
55+
artifact: Container Images
56+
57+
- task: UseDotNet@2
58+
displayName: 'Use .NET 6 sdk'
59+
condition: always()
60+
inputs:
61+
packageType: sdk
62+
version: '6.0.x'
63+
performMultiLevelLookup: true
64+
65+
- task: CmdLine@2
66+
displayName: 'Install dotnet-ef'
67+
condition: always()
68+
inputs:
69+
script: 'dotnet tool install --global dotnet-ef'
70+
71+
- task: CmdLine@2
72+
displayName: 'Check dotnet-ef version'
73+
condition: always()
74+
inputs:
75+
script: 'dotnet-ef'
76+
77+
- script: |
78+
cd $(Build.SourcesDirectory)/sb-mock-data-recipient/Source/CDR.DataRecipient.Repository.SQL
79+
dotnet ef migrations bundle --context RecipientDatabaseContext --verbose --self-contained
80+
ls
81+
displayName: 'Run EF Migrations bundle'
82+
condition: always()
83+
84+
- publish: $(Build.SourcesDirectory)/sb-mock-data-recipient/Source/CDR.DataRecipient.Repository.SQL/efbundle
85+
displayName: Publish EF Migration bundle
86+
condition: always()
87+
artifact: Database Migration Scripts

.azuredevops/pipelines/build-v2.yml

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ resources:
1717

1818
trigger:
1919
- develop
20-
20+
- main
21+
- releases/*
22+
2123
pool:
2224
vmImage: ubuntu-latest
2325

@@ -34,7 +36,7 @@ steps:
3436
displayName: Build mock-register image
3537
inputs:
3638
command: build
37-
Dockerfile: $(Build.SourcesDirectory)/sb-mock-register/Source/Dockerfile
39+
Dockerfile: $(Build.SourcesDirectory)/sb-mock-register/Source/Dockerfile.for-testing
3840
buildContext: $(Build.SourcesDirectory)/sb-mock-register/Source
3941
repository: mock-register
4042
tags: latest
@@ -44,7 +46,7 @@ steps:
4446
displayName: Build mock-data-holder image
4547
inputs:
4648
command: build
47-
Dockerfile: $(Build.SourcesDirectory)/sb-mock-data-holder/Source/Dockerfile
49+
Dockerfile: $(Build.SourcesDirectory)/sb-mock-data-holder/Source/Dockerfile.for-testing
4850
buildContext: $(Build.SourcesDirectory)/sb-mock-data-holder/Source
4951
repository: mock-data-holder
5052
tags: latest
@@ -54,7 +56,7 @@ steps:
5456
displayName: Build mock-data-holder-energy image
5557
inputs:
5658
command: build
57-
Dockerfile: $(Build.SourcesDirectory)/sb-mock-data-holder-energy/Source/Dockerfile
59+
Dockerfile: $(Build.SourcesDirectory)/sb-mock-data-holder-energy/Source/Dockerfile.for-testing
5860
buildContext: $(Build.SourcesDirectory)/sb-mock-data-holder-energy/Source
5961
repository: mock-data-holder-energy
6062
tags: latest
@@ -99,6 +101,16 @@ steps:
99101
repository: mock-data-recipient-e2e-tests
100102
tags: latest
101103

104+
# Build mock-data-recipient
105+
- task: Docker@2
106+
displayName: Build mock-data-recipient-for-testing image
107+
inputs:
108+
command: build
109+
Dockerfile: $(Build.SourcesDirectory)/sb-mock-data-recipient/Source/Dockerfile.for-testing
110+
buildContext: $(Build.SourcesDirectory)/sb-mock-data-recipient/Source
111+
repository: mock-data-recipient-for-testing
112+
tags: latest
113+
102114
# List docker images
103115
- task: Docker@2
104116
displayName: List Docker images
@@ -252,3 +264,17 @@ steps:
252264
displayName: Publish EF Migration bundle
253265
condition: always()
254266
artifact: Database Migration Scripts
267+
268+
- task: PublishTestResults@2
269+
displayName: 'Surface Integration Test TRX results to devops'
270+
condition: succeededOrFailed()
271+
inputs:
272+
testResultsFormat: 'VSTest' # Options: JUnit, NUnit, VSTest, xUnit, cTest
273+
testResultsFiles: '**/results.trx'
274+
#searchFolder: '$(System.DefaultWorkingDirectory)' # Optional
275+
#mergeTestResults: false # Optional
276+
#failTaskOnFailedTests: false # Optional
277+
#testRunTitle: # Optional
278+
#buildPlatform: # Optional
279+
#buildConfiguration: # Optional
280+
#publishRunAttachments: true # Optional

.github/workflows/docker.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ jobs:
7171
uses: docker/build-push-action@v2
7272
with:
7373
context: ./Source
74-
file: ./Source/Dockerfile
74+
file: ./Source/Dockerfile.for-testing
7575
platforms: linux/amd64,linux/arm64
7676
push: ${{ github.repository_owner == 'ConsumerDataRight' && github.event_name != 'pull_request' }}
7777
tags: ${{ steps.meta.outputs.tags }}

.github/workflows/dotnet.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ jobs:
9191
# Build mock-data-recipient image
9292
- name: Build the mock-data-recipient image
9393
run: |
94-
docker build ./mock-data-recipient/Source --file ./mock-data-recipient/Source/Dockerfile --tag mock-data-recipient:latest
94+
docker build ./mock-data-recipient/Source --file ./mock-data-recipient/Source/Dockerfile.for-testing --tag mock-data-recipient:latest
9595
9696
# Build mock-data-recipient-integration-tests image
9797
- name: Build the mock-data-recipient-integration-tests image

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
## [1.0.0] - 2022-08-02
10+
### Added
11+
- Azure functions to perform Data Holder discovery by polling the Get Data Holder Brands API of the Register.
12+
13+
### Changed
14+
- First version of the Mock Data Recipient deployed into the CDR Sandbox.
15+
916
## [0.2.1] - 2022-06-09
1017
### Changed
1118
- Build and Test action to archive test results. End to end tests now included in test report.
@@ -44,4 +51,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4451
## [0.1.0] - 2021-10-01
4552

4653
### Added
47-
- First release of the Mock Data Recipient.
54+
- First release of the Mock Data Recipient.

Help/azurefunctions/HELP.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
<h2>Azure Functions</h2>
2+
<div style="margin-left:18px;">
3+
The Mock Data Recipient solution contains azure function projects.<br />
4+
The DiscoverDataHolders function is used to get the list of Data Holder Brands<br />
5+
from the Mock Register and update the Mock Data Recipient repository DataHolderBrands table.<br />
6+
The DCR function is used to register the software product included in the Mock Data Recipient<br />
7+
with the newly discovered Data Holder Brands from the Mock Register.<br />
8+
</div>
9+
10+
<h2>To Run and Debug Azure Functions</h2>
11+
<div style="margin-left:18px;">
12+
The following procedures can be used to run the functions in a local development environment for evaluation of the functions.
13+
<br />
14+
15+
<div style="margin-top:6px;">
16+
1) Start the Mock Register, Mock Data Holder, Mock Data Holder Energy and Mock Data Recipient solutions.
17+
</div>
18+
<div style="margin-left:18px;">
19+
Noting that the Mock Data Recipient must be running as it is required for the https://localhost:9001/jwks<br />
20+
endpoint that is used for the Access Token.<br />
21+
</div>
22+
23+
<div style="margin-top:6px;">
24+
2) Start the Azure Storage Emulator (Azurite):
25+
</div>
26+
<div style="margin-left:18px;margin-bottom:6px;">
27+
using a MS Windows command prompt:<br />
28+
</div>
29+
30+
```
31+
md C:\azurite
32+
cd "C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\Extensions\Microsoft\Azure Storage Emulator"
33+
azurite --silent --location c:\azurite --debug c:\azurite\debug.log
34+
```
35+
36+
<div style="margin-left:18px;">
37+
Noting this is only required to be performed once, it will then be listening on ports - 10000, 10001 and 10002<br />
38+
when debugging is started from MS Visual Studio by selecting CDR.DiscoverDataHolder or CDR.DCR as the startup project<br />
39+
(by starting a debug instance using F5 or Debug > Start Debugging)
40+
<br />
41+
</div>
42+
<div style="margin-left:18px;margin-bottom:6px;">
43+
or by using a MS Windows command prompt:<br />
44+
</div>
45+
46+
```
47+
navigate to .\mock-data-holder-energy\Source\CDR.GetDataRecipients<br />
48+
func start --verbose<br />
49+
```
50+
51+
<div style="margin-left:18px;">
52+
To reset the message queue, uncomment the following line of code and start the debug instance as indicated above, placing a<br /> breakpoint after this code;<br />
53+
await DeleteAllMessagesAsync(log, qConnString, qName);<br />
54+
</div>
55+
56+
<div style="margin-top:6px;">
57+
3) Open two instances of Mock Data Recipient in MS Visual Studio,
58+
</div>
59+
<div style="margin-left:18px;">
60+
(select CDR.DCR as the startup project in one and CDR.DiscoverDataHolder as the startup project in the other)
61+
</div>
62+
63+
<div style="margin-top:6px;">
64+
4) Start each debug instances (F5 or Debug > Start Debugging), this will simulate the discovery of Data Holder brands and the
65+
</div>
66+
<div style="margin-left:18px;">
67+
processing of the messages added to the queue.
68+
</div>
69+
70+
<div style="margin-left:18px;margin-top:12px;margin-bottom:6px;">
71+
Noting the below sql script is used to clear out the registrations as the seed data is not a good reflection on reality as the<br /> infosecBaseUri values are either invalid or duplicated, so running this script resets the data so the registration process can<br />
72+
occur for the processed message queue item.
73+
</div>
74+
75+
```
76+
DECLARE @i INT = 1;
77+
WHILE (@i <= 3600000)
78+
BEGIN
79+
WAITFOR DELAY '00:00:01'
80+
DELETE FROM [cdr-mdr].[dbo].[Registration]
81+
DELETE FROM [cdr-idsvr].[dbo].[Clients]
82+
DELETE FROM [cdr-idsvre].[dbo].[Clients]
83+
SET @i = @i + 1;
84+
END
85+
86+
87+
Observing the following tables shows the above functions in operation from the database perspective:
88+
SELECT * FROM [cdr-mdr].[dbo].[DcrMessage]
89+
SELECT * FROM [cdr-mdr].[dbo].[LogEvents_DCRService]
90+
```

0 commit comments

Comments
 (0)