Skip to content

Commit

Permalink
Release v0.1.1 to develop (#27)
Browse files Browse the repository at this point in the history
Release v0.1.1 to develop
  • Loading branch information
CDR-AndrewG authored Dec 8, 2021
1 parent 60c2b86 commit e0d90f9
Show file tree
Hide file tree
Showing 17 changed files with 1,133 additions and 239 deletions.
54 changes: 54 additions & 0 deletions .azuredevops/pipelines/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
schedules:
- cron: "0 14 * * *"
displayName: Daily Dependabot Run
branches:
include:
- refs/heads/develop
always: true

jobs:
- job: dependabot
displayName: Dependabot
pool:
vmImage: ubuntu-latest
steps:
- task: CmdLine@2
displayName: clone dependabot repo
inputs:
script: |
git clone https://github.com/dependabot/dependabot-script.git
- task: CmdLine@2
displayName: pull dependabot-core Docker image
inputs:
script: docker pull dependabot/dependabot-core
- task: CmdLine@2
displayName: install dependencies
inputs:
script: |
cd dependabot-script
docker run -v "$(pwd):/home/dependabot/dependabot-script" \
--user $(id -u):$(id -g) \
-w /home/dependabot/dependabot-script dependabot/dependabot-core bundle install \
-j 3 \
--path vendor
- task: CmdLine@2
displayName: remove new line chars
inputs:
script: sed -i 's/\r//g' .azuredevops/pipelines/scripts/dependabot-devops.sh
- task: Bash@3
displayName: run dependabot nuget
inputs:
filePath: '.azuredevops/pipelines/scripts/dependabot-devops.sh'
env:
PACKAGE_MANAGER: 'nuget'
SOURCE_CODE_PATH: '/Source'
PERSONAL_ACCESS_TOKEN: $(PERSONAL_ACCESS_TOKEN)
- task: Bash@3
displayName: run dependabot docker
inputs:
filePath: '.azuredevops/pipelines/scripts/dependabot-devops.sh'
env:
PACKAGE_MANAGER: 'docker'
SOURCE_CODE_PATH: '/Source'
PERSONAL_ACCESS_TOKEN: $(PERSONAL_ACCESS_TOKEN)
187 changes: 187 additions & 0 deletions .azuredevops/pipelines/dotnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
resources:
repositories:
- repository: MockRegister
type: git
name: sb-mock-register
ref: develop
- repository: MockDataHolder
type: git
name: sb-mock-data-holder
ref: develop

trigger:
- develop

pool:
vmImage: windows-2019

steps:

# Checkout
- checkout: MockRegister
- checkout: MockDataHolder
- checkout: self

# Restore
- task: DotNetCoreCLI@2
displayName: Restore
inputs:
command: restore
projects: "**/*.csproj"

# Build
- task: DotNetCoreCLI@2
displayName: Build
inputs:
command: "build"
arguments: "--configuration Release"
projects: "**/*.csproj"

# Patch register seed data
- task: CmdLine@2
displayName: Patch Register seed data
inputs:
script: |
@echo Overwriting seed-data.json for the Register with a version that has been patched to use the MDR endpoints.
@echo Copying sb-mock-data-recipient\source\cdr.datarecipient.integrationtests\forpipeline\seed-data.json to sb-mock-register\source\cdr.register.admin.api\data
cd $(Build.SourcesDirectory)
copy sb-mock-data-recipient\source\cdr.datarecipient.integrationtests\forpipeline\seed-data.json sb-mock-register\source\cdr.register.admin.api\data
type sb-mock-register\source\cdr.register.admin.api\data\seed-data.json
# Set timezone to AEST
- task: CmdLine@2
displayName: Set AEST timezone
inputs:
script: |
cd $(Build.SourcesDirectory)
tzutil /s "AUS Eastern Standard Time"
# Install certificates
- task: PowerShell@2
displayName: Install certificates
inputs:
targetType: "inline"
script: |
$PlainPassword = "#M0ckCDRCA#"
$SecurePassword = $PlainPassword | ConvertTo-SecureString -AsPlainText -Force
Import-PfxCertificate -Password $SecurePassword -FilePath "sb-mock-data-holder/CertificateManagement/mtls/ca.pfx" -CertStoreLocation Cert:\LocalMachine\Root
$PlainPassword = "#M0ckDataHolder#"
$SecurePassword = $PlainPassword | ConvertTo-SecureString -AsPlainText -Force
Import-PfxCertificate -Password $SecurePassword -FilePath "sb-mock-data-holder/CertificateManagement/tls/mock-data-holder.pfx" -CertStoreLocation Cert:\LocalMachine\Root
# # Update hosts file
# - task: PowerShell@2
# displayName: Update hosts file
# inputs:
# targetType: "inline"
# script: |
# Add-Content C:\Windows\System32\drivers\etc\hosts "`n127.0.0.1 mock-register"
# Add-Content C:\Windows\System32\drivers\etc\hosts "`n127.0.0.1 mock-data-holder"
# Add-Content C:\Windows\System32\drivers\etc\hosts "`n127.0.0.1 mock-data-recipient"
# ipconfig /displaydns

# Create CDR folder for unit tests
- task: CmdLine@2
displayName: Create CDR folder
inputs:
script: |
mkdir D:\\a\\mock-data-recipient\\mock-data-recipient\\cdr
# Run unit tests
- task: VSTest@2
displayName: Unit Tests
inputs:
testSelector: "testAssemblies"
testAssemblyVer2: |
**\*DataRecipient*UnitTests*.dll
!**\*TestAdapter.dll
!**\obj\**
!**/ref/**
searchFolder: "$(System.DefaultWorkingDirectory)"

# Delete unit test db file
- task: CmdLine@2
displayName: Delete unit test db file
inputs:
script: |
cd D:\\a\\mock-data-recipient\\mock-data-recipient\\cdr
del /Q mdr.db
# Start APIs
- template: Pipeline/start-apis.yml

# Run integration tests
- task: VSTest@2
displayName: Integration Tests
inputs:
runSettingsFile: $(Build.SourcesDirectory)\sb-mock-data-recipient\source\CDR.DataRecipient.IntegrationTests\integration.runsettings
testSelector: "testAssemblies"
testAssemblyVer2: |
**\*DataRecipient*IntegrationTests*.dll
!**\*TestAdapter.dll
!**\obj\**
!**/ref/**
searchFolder: "$(System.DefaultWorkingDirectory)"

# Stop APIs and copy artifacts for integration tests
- template: templates/stop-apis.yml
- template: templates/copy-artifacts.yml
parameters:
name: Integration Tests

# Delete artifacts and restart APIs in preparation for E2E tests
- task: PowerShell@2
displayName: Delete integration test artifacts
condition: always()
inputs:
targetType: "inline"
script: |
remove-item D:\a\mock-register\mock-register\cdr\*.* -recurse
remove-item D:\a\mock-data-holder\mock-data-holder\cdr\*.* -recurse
remove-item D:\a\mock-data-recipient\mock-data-recipient\cdr\*.* -recurse
- template: templates/start-apis.yml

# Install Playwright dotnet tool
- task: PowerShell@2
displayName: Install Playwright dotnet tool
condition: always()
inputs:
targetType: "inline"
script: |
dotnet tool install --global Microsoft.Playwright.CLI
# Install Playwright browsers
- task: PowerShell@2
displayName: Install Playwright browsers
condition: always()
inputs:
targetType: "inline"
script: |
playwright -p $(Build.SourcesDirectory)\sb-mock-data-recipient\source\CDR.DataRecipient.E2ETests install
# Start E2E tests
- task: VSTest@2
displayName: E2E Tests
condition: always()
inputs:
runSettingsFile: $(Build.SourcesDirectory)\sb-mock-data-recipient\source\CDR.DataRecipient.E2ETests\e2e.runsettings
testSelector: "testAssemblies"
testAssemblyVer2: |
**\*DataRecipient*E2ETests*.dll
!**\*TestAdapter.dll
!**\obj\**
!**/ref/**
searchFolder: "$(System.DefaultWorkingDirectory)"

# Stop APIs and copy artifacts for e2e-tests
- template: templates/stop-apis.yml
- template: templates/copy-artifacts.yml
parameters:
name: E2E Tests

# Publish artifacts
- publish: $(Build.SourcesDirectory)\Publish
displayName: Publish artifacts
condition: always()
artifact: Mock-Data-Recipient Build $(Build.BuildNumber)
15 changes: 15 additions & 0 deletions .azuredevops/pipelines/scripts/dependabot-devops.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
SYSTEM_COLLECTIONURI_TRIM=`echo "${SYSTEM_COLLECTIONURI:22}"`
PROJECT_PATH="$SYSTEM_COLLECTIONURI_TRIM$SYSTEM_TEAMPROJECT/_git/$BUILD_REPOSITORY_NAME"
URLENCODED_PATH=`echo "$PROJECT_PATH"|sed 's/ /%20/g'`
echo "org: $SYSTEM_COLLECTIONURI_TRIM"
echo "project: $SYSTEM_TEAMPROJECT"
echo "repo: $BUILD_REPOSITORY_NAME"
echo "path: $PROJECT_PATH"
echo "url encoded path: $URLENCODED_PATH"
echo "package manager: $PACKAGE_MANAGER"
echo "source code path: $SOURCE_CODE_PATH"
#
echo "---[ Starting dependabot run: $SOURCE_CODE_PATH ]---"
echo `docker run -v "$(pwd)/dependabot-script:/home/dependabot/dependabot-script" -w '/home/dependabot/dependabot-script' -e AZURE_ACCESS_TOKEN="$PERSONAL_ACCESS_TOKEN" -e PACKAGE_MANAGER="$PACKAGE_MANAGER" -e PROJECT_PATH="$URLENCODED_PATH" -e DIRECTORY_PATH="$SOURCE_CODE_PATH" dependabot/dependabot-core bundle exec ruby ./generic-update-script.rb`
echo "---[ Finished dependabot run ]---"
16 changes: 16 additions & 0 deletions .azuredevops/pipelines/templates/copy-artifacts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copy artifacts
parameters:
- name: name
type: string

steps:
- task: PowerShell@2
displayName: Copy artifacts to ${{parameters.name}}
condition: always()
inputs:
targetType: "inline"
script: |
md "$(Build.SourcesDirectory)\Publish\${{parameters.name}}"
copy-item D:\a\mock-register\mock-register\cdr\* "$(Build.SourcesDirectory)\Publish\${{parameters.name}}" -recurse -force
copy-item D:\a\mock-data-holder\mock-data-holder\cdr\* "$(Build.SourcesDirectory)\Publish\${{parameters.name}}" -recurse -force
copy-item D:\a\mock-data-recipient\mock-data-recipient\cdr\* "$(Build.SourcesDirectory)\Publish\${{parameters.name}}" -recurse -force
74 changes: 74 additions & 0 deletions .azuredevops/pipelines/templates/start-apis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Start APIs

steps:
- task: CmdLine@2
displayName: Run Register projects
condition: always()
inputs:
script: |
echo Starting CDR.Register.API.Gateway.mTLS
cd $(Build.SourcesDirectory)\sb-mock-register\Source\CDR.Register.API.Gateway.mTLS
start /B dotnet run CDR.Register.API.Gateway.mTLS.csproj --no-build --no-restore --configuration=Release --launch-profile CDR.Register.API.Gateway.mTLS.Pipeline
echo Starting CDR.Register.API.Gateway.TLS
cd $(Build.SourcesDirectory)\sb-mock-register\Source\CDR.Register.API.Gateway.TLS
start /B dotnet run CDR.Register.API.Gateway.TLS.csproj --no-build --no-restore --configuration=Release --launch-profile CDR.Register.API.Gateway.TLS.Pipeline
echo Starting CDR.Register.IdentityServer
cd $(Build.SourcesDirectory)\sb-mock-register\Source\CDR.Register.IdentityServer
start /B dotnet run CDR.Register.IdentityServer.csproj --no-build --no-restore --configuration=Release --launch-profile CDR.Register.IdentityServer.Pipeline
echo Starting CDR.Register.Discovery.API
cd $(Build.SourcesDirectory)\sb-mock-register\Source\CDR.Register.Discovery.API
start /B dotnet run CDR.Register.Discovery.API.csproj --no-build --no-restore --configuration=Release --launch-profile CDR.Register.Discovery.API.Pipeline
echo Starting CDR.Register.SSA.API
cd $(Build.SourcesDirectory)\sb-mock-register\Source\CDR.Register.SSA.API
start /B dotnet run CDR.Register.SSA.API.csproj --no-build --no-restore --configuration=Release --launch-profile CDR.Register.SSA.API.Pipeline
echo Starting CDR.Register.Status.API
cd $(Build.SourcesDirectory)\sb-mock-register\Source\CDR.Register.Status.API
start /B dotnet run CDR.Register.Status.API.csproj --no-build --no-restore --configuration=Release --launch-profile CDR.Register.Status.API.Pipeline
echo Starting CDR.Register.Admin.API
cd $(Build.SourcesDirectory)\sb-mock-register\Source\CDR.Register.Admin.API
start /B dotnet run CDR.Register.Admin.API.csproj --no-build --no-restore --configuration=Release --launch-profile CDR.Register.Admin.API.Pipeline
cd $(Build.SourcesDirectory)
- task: CmdLine@2
displayName: Run DH projects
condition: always()
inputs:
script: |
echo Starting CDR.DataHolder.API.Gateway.mTLS
cd $(Build.SourcesDirectory)\sb-mock-data-holder\Source\CDR.DataHolder.API.Gateway.mTLS
start /B dotnet run CDR.DataHolder.API.Gateway.mTLS.csproj --no-build --no-restore --configuration=Release --launch-profile CDR.DataHolder.API.Gateway.mTLS.Pipeline
echo Starting CDR.DataHolder.IdentityServer
cd $(Build.SourcesDirectory)\sb-mock-data-holder\Source\CDR.DataHolder.IdentityServer
start /B dotnet run CDR.DataHolder.IdentityServer.csproj --no-build --no-restore --configuration=Release --launch-profile CDR.DataHolder.IdentityServer.Pipeline
echo Starting CDR.DataHolder.Resource.API
cd $(Build.SourcesDirectory)\sb-mock-data-holder\Source\CDR.DataHolder.Resource.API
start /B dotnet run CDR.DataHolder.Resource.API.csproj --no-build --no-restore --configuration=Release --launch-profile CDR.DataHolder.Resource.API.Pipeline
echo Starting CDR.DataHolder.Manage.API
cd $(Build.SourcesDirectory)\sb-mock-data-holder\Source\CDR.DataHolder.Manage.API
start /B dotnet run CDR.DataHolder.Manage.API.csproj --no-build --no-restore --configuration=Release --launch-profile CDR.DataHolder.Manage.API.Pipeline
echo Starting CDR.DataHolder.Public.API
cd $(Build.SourcesDirectory)\sb-mock-data-holder\Source\CDR.DataHolder.Public.API
start /B dotnet run CDR.DataHolder.Public.API.csproj --no-build --no-restore --configuration=Release --launch-profile CDR.DataHolder.Public.API.Pipeline
cd $(Build.SourcesDirectory)
- task: CmdLine@2
displayName: Run DR projects
condition: always()
inputs:
script: |
cd $(Build.SourcesDirectory)\sb-mock-data-recipient\source\CDR.DataRecipient.Web
start /B dotnet run CDR.DataRecipient.Web.csproj --no-build --no-restore --configuration=Release --launch-profile CDR.DataRecipient.Web.Pipeline
cd $(Build.SourcesDirectory)
13 changes: 13 additions & 0 deletions .azuredevops/pipelines/templates/stop-apis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Stop APIs so that logs and DBs are closed.

steps:
- task: PowerShell@2
displayName: Stop APIs
condition: always()
inputs:
targetType: "inline"
script: |
Get-Process -Name *CDR.Register* | Stop-Process
Get-Process -Name *CDR.DataHolder* | Stop-Process
Get-Process -Name *CDR.DataRecipient* | Stop-Process
Get-Process -Name *dotnet* | Stop-Process
24 changes: 24 additions & 0 deletions .azuredevops/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
**Checklist:** (Put an `x` in all the boxes that apply)
- [ ] My code follows the code style of this project.
- [ ] I have updated the documentation accordingly.
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.

**What kind of change does this PR introduce?** (Bug fix, feature, docs update, ...)



**What is the current behavior?** (You can also link to an open issue here)



**What is the new behavior?** (if this is a feature change)



**Does this PR introduce a breaking change?** (What changes might users need to make in their application due to this PR?)



**Other information**:

Loading

0 comments on commit e0d90f9

Please sign in to comment.