Skip to content

Commit

Permalink
Publish v13 (#86)
Browse files Browse the repository at this point in the history
* Update build pipelines

* Update README.md

* Update DevOps-ApplyDTLArtifacts.yml

* Update build pipelines

* Use reflection instead of hardcoded names to copy object LDAPConnection, to avoid misses/errors

* Update LDAPCP.csproj

* Use reflection to copy configuration objects, whenever possible

* Update comments where reflection is used

* Switch to agent "Hosted Windows 2019 with VS2019"

* Correct typos

* Add mapping to populate the email of groups

* Update CHANGELOG.md

* Update pipelines

* Fix typo in indentation

* Fix DestinationFolder

* Fix pipelines

* Update DevOps-ApplyDTLArtifacts.yml

* Fix typo

* Update DevOps-RunTests.yml

* Create FUNDING.yml

* Update text to better explain settings

* Update NuGet packages

- Update NUnit from 3.11 to 3.12
- Update Newtonsoft.Json from 12.0.1 to 12.0.2

* Improve code quality as per Codacy's report

* Improve code quality as per Codacy's report

* Improve code quality as per Codacy's report

* Improve code quality as per Codacy's report

* Use StringBuilder

* Update DevOps-Compile.yml

* Update DevOps-ApplyDTLArtifacts.yml

* Fix debug/release configuration to deploy in VM running tests

* Fix artifact name

* Update DevOps-RunTests.yml

* Update DevOps-RunTests.yml

* Update README.md

* Improve logging when testing augmentation doesn't return expected result

* Improve logging when testing augmentation doesn't return expected result

* Update logging during augmentation

* Improve logging during augmentation

* Fix bug: PrincipalContext is not built with expected ContextOptions during augmentation, if LDAPConnection.UseSPServerConnectionToAD is true

* Update CHANGELOG.md

* Update CHANGELOG.md
  • Loading branch information
Yvand committed Jul 3, 2019
1 parent 52aaedd commit be5a75b
Show file tree
Hide file tree
Showing 23 changed files with 908 additions and 521 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Change log for LDAPCP

## Unreleased

* Add a default mapping to populate the email of groups
* Update text in claims mapping page to better explain settings
* Fix bug: During augmentation, PrincipalContext is not built with expected ContextOptions if LDAPConnection.UseSPServerConnectionToAD is true
* Improve logging during augmentation
* Improve logging when testing augmentation doesn't return expected result
* Update DevOps build pipelines
* Improve code quality as per Codacy's static code analysis
* Update NuGet package NUnit from 3.11 to 3.12
* Make most of public members privates and replace them with public properties, to meet best practices
* Use reflection to copy configuration objects, whenever possible, to avoid misses when new properties are added

## LDAPCP 12.0.20190321.770 enhancements & bug-fixes - Published in March 21, 2019

* Add more strict checks on the claim type passed during augmentation and validation, to record a more meaningful error if needed
Expand Down
41 changes: 19 additions & 22 deletions DevOps-ApplyDTLArtifacts.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
resources:
- repo: self

variables:
BuildConfiguration: Release

jobs:
- job: ApplyArtifactsSP2013
condition: eq(variables['Deployment.ProvisionSharePoint2013'], 'yes')
Expand All @@ -12,29 +9,29 @@ jobs:
variables:
jobSharePointVersion: 2013
pool:
name: Hosted VS2017
vmImage: 'windows-2019'
steps:
- checkout: none #skip checking out the default repository resource
- task: automagically.DownloadFile.DownloadFile.DownloadFile@1
displayName: 'Download apply-dtl-artifact.ps1'
inputs:
FileUrl: 'https://raw.githubusercontent.com/Yvand/AzureRM-Templates/dev/DevTestLabs-Artifacts/manage-artifacts/apply-dtl-artifact.ps1'
DestinationFolder: '$(System.DefaultWorkingDirectory)\drop\BuildPipeline'

DestinationFolder: '$(System.DefaultWorkingDirectory)\scripts'
- task: AzurePowerShell@3
displayName: 'Apply artifact "Azure Pipelines Agent"'
inputs:
azureSubscription: '$(DevTestLabs.AzureConnectionName)'
ScriptPath: '$(System.DefaultWorkingDirectory)\drop\BuildPipeline\apply-dtl-artifact.ps1'
ScriptPath: '$(System.DefaultWorkingDirectory)\scripts\apply-dtl-artifact.ps1'
ScriptArguments: '-DevTestLabName "$(DevTestLabs.LabName)" -VirtualMachineName "SP$(jobSharePointVersion)" -RepositoryName "Yvand/AzureRM-Templates" -ArtifactName "windows-vsts-build-agent" -param_vstsAccount "$(DevOps.OrganizationName)" -param_vstsPassword "$(DevOps.AccessToken)" -param_poolName "$(system.teamProject)-Tests-$(jobSharePointVersion)" -param_windowsLogonAccount "$(Deployment.DomainName)\$(Deployment.AdminUserName)" -param_windowsLogonPassword "$(Deployment.AdminPassword)" -param_agentName "SP$(jobSharePointVersion)" -param_agentNameSuffix "-$(Build.BuildNumber)" -param_RunAsAutoLogon false -param_driveLetter C -param_workDirectory ""'
preferredAzurePowerShellVersion: 5.1.1

- task: AzurePowerShell@3
displayName: 'Apply artifact "Download Azure Pipelines Artifact and Run Script"'
inputs:
azureSubscription: '$(DevTestLabs.AzureConnectionName)'
ScriptPath: '$(System.DefaultWorkingDirectory)\drop\BuildPipeline\apply-dtl-artifact.ps1'
ScriptArguments: -DevTestLabName '$(DevTestLabs.LabName)' -VirtualMachineName 'SP$(jobSharePointVersion)' -RepositoryName 'Yvand/AzureRM-Templates' -ArtifactName 'windows-vsts-download-and-run-script' -param_vstsProjectUri 'https://dev.azure.com/$(DevOps.OrganizationName)/$(system.teamProject)' -param_buildDefinitionName '$(DevOps.BuildArtifactsPipelineName)' -param_personalAccessToken $(DevOps.AccessToken) -param_pathToScript 'drop\SPTestServer artifacts\ConfigureLab.ps1' -param_scriptArguments "-pathToPackage ''..\$(system.teamProject)\bin\$(BuildConfiguration)\$(system.teamProject).wsp' -claimsProviderName '$(system.teamProject)' -spTrustName '$(Deployment.DomainFQDN)' -adminUserName '$(Deployment.DomainName)\$(Deployment.AdminUserName)' -adminPassword '$(Deployment.AdminPassword)'"
ScriptPath: '$(System.DefaultWorkingDirectory)\scripts\apply-dtl-artifact.ps1'
ScriptArguments: -DevTestLabName '$(DevTestLabs.LabName)' -VirtualMachineName 'SP$(jobSharePointVersion)' -RepositoryName 'Yvand/AzureRM-Templates' -ArtifactName 'windows-vsts-download-and-run-script' -param_vstsProjectUri 'https://dev.azure.com/$(DevOps.OrganizationName)/$(system.teamProject)' -param_buildDefinitionName '$(DevOps.BuildArtifactsPipelineName)' -param_personalAccessToken $(DevOps.AccessToken) -param_pathToScript 'drop_$(Tests.BuildConfiguration)\$(Deployment.ConfigureServerFolderName)\ConfigureLab.ps1' -param_scriptArguments "-pathToPackage ''..\$(system.teamProject)\bin\$(Tests.BuildConfiguration)\$(system.teamProject).wsp' -claimsProviderName '$(system.teamProject)' -spTrustName '$(Deployment.DomainFQDN)' -adminUserName '$(Deployment.DomainName)\$(Deployment.AdminUserName)' -adminPassword '$(Deployment.AdminPassword)'"
preferredAzurePowerShellVersion: 5.1.1

- job: ApplyArtifactsSP2016
Expand All @@ -44,29 +41,29 @@ jobs:
variables:
jobSharePointVersion: 2016
pool:
name: Hosted VS2017
vmImage: 'windows-2019'
steps:
- checkout: none #skip checking out the default repository resource
- task: automagically.DownloadFile.DownloadFile.DownloadFile@1
displayName: 'Download apply-dtl-artifact.ps1'
inputs:
FileUrl: 'https://raw.githubusercontent.com/Yvand/AzureRM-Templates/dev/DevTestLabs-Artifacts/manage-artifacts/apply-dtl-artifact.ps1'
DestinationFolder: '$(System.DefaultWorkingDirectory)\drop\BuildPipeline'

DestinationFolder: '$(System.DefaultWorkingDirectory)\scripts'
- task: AzurePowerShell@3
displayName: 'Apply artifact "Azure Pipelines Agent"'
inputs:
azureSubscription: '$(DevTestLabs.AzureConnectionName)'
ScriptPath: '$(System.DefaultWorkingDirectory)\drop\BuildPipeline\apply-dtl-artifact.ps1'
ScriptPath: '$(System.DefaultWorkingDirectory)\scripts\apply-dtl-artifact.ps1'
ScriptArguments: '-DevTestLabName "$(DevTestLabs.LabName)" -VirtualMachineName "SP$(jobSharePointVersion)" -RepositoryName "Yvand/AzureRM-Templates" -ArtifactName "windows-vsts-build-agent" -param_vstsAccount "$(DevOps.OrganizationName)" -param_vstsPassword "$(DevOps.AccessToken)" -param_poolName "$(system.teamProject)-Tests-$(jobSharePointVersion)" -param_windowsLogonAccount "$(Deployment.DomainName)\$(Deployment.AdminUserName)" -param_windowsLogonPassword "$(Deployment.AdminPassword)" -param_agentName "SP$(jobSharePointVersion)" -param_agentNameSuffix "-$(Build.BuildNumber)" -param_RunAsAutoLogon false -param_driveLetter C -param_workDirectory ""'
preferredAzurePowerShellVersion: 5.1.1

- task: AzurePowerShell@3
displayName: 'Apply artifact "Download Azure Pipelines Artifact and Run Script"'
inputs:
azureSubscription: '$(DevTestLabs.AzureConnectionName)'
ScriptPath: '$(System.DefaultWorkingDirectory)\drop\BuildPipeline\apply-dtl-artifact.ps1'
ScriptArguments: -DevTestLabName '$(DevTestLabs.LabName)' -VirtualMachineName 'SP$(jobSharePointVersion)' -RepositoryName 'Yvand/AzureRM-Templates' -ArtifactName 'windows-vsts-download-and-run-script' -param_vstsProjectUri 'https://dev.azure.com/$(DevOps.OrganizationName)/$(system.teamProject)' -param_buildDefinitionName '$(DevOps.BuildArtifactsPipelineName)' -param_personalAccessToken $(DevOps.AccessToken) -param_pathToScript 'drop\SPTestServer artifacts\ConfigureLab.ps1' -param_scriptArguments "-pathToPackage ''..\$(system.teamProject)\bin\$(BuildConfiguration)\$(system.teamProject).wsp' -claimsProviderName '$(system.teamProject)' -spTrustName '$(Deployment.DomainFQDN)' -adminUserName '$(Deployment.DomainName)\$(Deployment.AdminUserName)' -adminPassword '$(Deployment.AdminPassword)'"
ScriptPath: '$(System.DefaultWorkingDirectory)\scripts\apply-dtl-artifact.ps1'
ScriptArguments: -DevTestLabName '$(DevTestLabs.LabName)' -VirtualMachineName 'SP$(jobSharePointVersion)' -RepositoryName 'Yvand/AzureRM-Templates' -ArtifactName 'windows-vsts-download-and-run-script' -param_vstsProjectUri 'https://dev.azure.com/$(DevOps.OrganizationName)/$(system.teamProject)' -param_buildDefinitionName '$(DevOps.BuildArtifactsPipelineName)' -param_personalAccessToken $(DevOps.AccessToken) -param_pathToScript 'drop_$(Tests.BuildConfiguration)\$(Deployment.ConfigureServerFolderName)\ConfigureLab.ps1' -param_scriptArguments "-pathToPackage ''..\$(system.teamProject)\bin\$(Tests.BuildConfiguration)\$(system.teamProject).wsp' -claimsProviderName '$(system.teamProject)' -spTrustName '$(Deployment.DomainFQDN)' -adminUserName '$(Deployment.DomainName)\$(Deployment.AdminUserName)' -adminPassword '$(Deployment.AdminPassword)'"
preferredAzurePowerShellVersion: 5.1.1

- job: ApplyArtifactsSP2019
Expand All @@ -76,27 +73,27 @@ jobs:
variables:
jobSharePointVersion: 2019
pool:
name: Hosted VS2017
vmImage: 'windows-2019'
steps:
- checkout: none #skip checking out the default repository resource
- checkout: none #skip checking out the default repository resource
- task: automagically.DownloadFile.DownloadFile.DownloadFile@1
displayName: 'Download apply-dtl-artifact.ps1'
inputs:
FileUrl: 'https://raw.githubusercontent.com/Yvand/AzureRM-Templates/dev/DevTestLabs-Artifacts/manage-artifacts/apply-dtl-artifact.ps1'
DestinationFolder: '$(System.DefaultWorkingDirectory)\drop\BuildPipeline'

DestinationFolder: '$(System.DefaultWorkingDirectory)\scripts'
- task: AzurePowerShell@3
displayName: 'Apply artifact "Azure Pipelines Agent"'
inputs:
azureSubscription: '$(DevTestLabs.AzureConnectionName)'
ScriptPath: '$(System.DefaultWorkingDirectory)\drop\BuildPipeline\apply-dtl-artifact.ps1'
ScriptPath: '$(System.DefaultWorkingDirectory)\scripts\apply-dtl-artifact.ps1'
ScriptArguments: '-DevTestLabName "$(DevTestLabs.LabName)" -VirtualMachineName "SP$(jobSharePointVersion)" -RepositoryName "Yvand/AzureRM-Templates" -ArtifactName "windows-vsts-build-agent" -param_vstsAccount "$(DevOps.OrganizationName)" -param_vstsPassword "$(DevOps.AccessToken)" -param_poolName "$(system.teamProject)-Tests-$(jobSharePointVersion)" -param_windowsLogonAccount "$(Deployment.DomainName)\$(Deployment.AdminUserName)" -param_windowsLogonPassword "$(Deployment.AdminPassword)" -param_agentName "SP$(jobSharePointVersion)" -param_agentNameSuffix "-$(Build.BuildNumber)" -param_RunAsAutoLogon false -param_driveLetter C -param_workDirectory ""'
preferredAzurePowerShellVersion: 5.1.1

- task: AzurePowerShell@3
displayName: 'Apply artifact "Download Azure Pipelines Artifact and Run Script"'
inputs:
azureSubscription: '$(DevTestLabs.AzureConnectionName)'
ScriptPath: '$(System.DefaultWorkingDirectory)\drop\BuildPipeline\apply-dtl-artifact.ps1'
ScriptArguments: -DevTestLabName '$(DevTestLabs.LabName)' -VirtualMachineName 'SP$(jobSharePointVersion)' -RepositoryName 'Yvand/AzureRM-Templates' -ArtifactName 'windows-vsts-download-and-run-script' -param_vstsProjectUri 'https://dev.azure.com/$(DevOps.OrganizationName)/$(system.teamProject)' -param_buildDefinitionName '$(DevOps.BuildArtifactsPipelineName)' -param_personalAccessToken $(DevOps.AccessToken) -param_pathToScript 'drop\SPTestServer artifacts\ConfigureLab.ps1' -param_scriptArguments "-pathToPackage ''..\$(system.teamProject)\bin\$(BuildConfiguration)\$(system.teamProject).wsp' -claimsProviderName '$(system.teamProject)' -spTrustName '$(Deployment.DomainFQDN)' -adminUserName '$(Deployment.DomainName)\$(Deployment.AdminUserName)' -adminPassword '$(Deployment.AdminPassword)'"
ScriptPath: '$(System.DefaultWorkingDirectory)\scripts\apply-dtl-artifact.ps1'
ScriptArguments: -DevTestLabName '$(DevTestLabs.LabName)' -VirtualMachineName 'SP$(jobSharePointVersion)' -RepositoryName 'Yvand/AzureRM-Templates' -ArtifactName 'windows-vsts-download-and-run-script' -param_vstsProjectUri 'https://dev.azure.com/$(DevOps.OrganizationName)/$(system.teamProject)' -param_buildDefinitionName '$(DevOps.BuildArtifactsPipelineName)' -param_personalAccessToken $(DevOps.AccessToken) -param_pathToScript 'drop_$(Tests.BuildConfiguration)\$(Deployment.ConfigureServerFolderName)\ConfigureLab.ps1' -param_scriptArguments "-pathToPackage ''..\$(system.teamProject)\bin\$(Tests.BuildConfiguration)\$(system.teamProject).wsp' -claimsProviderName '$(system.teamProject)' -spTrustName '$(Deployment.DomainFQDN)' -adminUserName '$(Deployment.DomainName)\$(Deployment.AdminUserName)' -adminPassword '$(Deployment.AdminPassword)'"
preferredAzurePowerShellVersion: 5.1.1
64 changes: 36 additions & 28 deletions DevOps-Compile.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
name: $(BuildVersion).$(date:yyyyMMdd).$(Build.BuildId)
resources:
- repo: self

variables:
SolutionFileName: '$(system.teamProject).sln'

jobs:
- job: Compile
strategy:
Expand All @@ -16,7 +18,7 @@ jobs:
platform: $(BuildPlatform)
displayName: Compile
pool:
name: Hosted VS2017
vmImage: 'windows-2019'
demands:
- msbuild
- visualstudio
Expand All @@ -31,41 +33,47 @@ jobs:
# Set variables
$azureStorageBaseDirectory = "Resources\$(system.teamProject)"
$projectLocalPath = "$(System.DefaultWorkingDirectory)\$(system.teamProject)"
$devTestLabsLocalPath = "$(Build.ArtifactStagingDirectory)\SPTestServer artifacts"
$buildResourcesLocalPath = "$(Build.ArtifactStagingDirectory)\BuildPipeline"
$devTestLabsLocalPath = "$(Build.ArtifactStagingDirectory)\$(Tests.DataFolderName)"
# Create the SPTestServer artifacts directory if it doesn't exist
if ((Test-Path -Path $devTestLabsLocalPath -PathType Container) -eq $false) {
New-Item -ItemType Directory -Path $devTestLabsLocalPath
}
# Create now folder that will contain later scripts to configure local test server
#if ((Test-Path -Path "$(Build.ArtifactStagingDirectory)\$(Deployment.ConfigureServerFolderName)" -PathType Container) -eq $false) {
#New-Item -ItemType Directory -Path "$(Build.ArtifactStagingDirectory)\$(Deployment.ConfigureServerFolderName)"
#}
# Create the Build pipeline directory if it doesn't exist
if ((Test-Path -Path $buildResourcesLocalPath -PathType Container) -eq $false) {
New-Item -ItemType Directory -Path $buildResourcesLocalPath
}
Write-Output ("Copy files to build $(system.teamProject) from Azure storage account")
$azureContext = New-AzureStorageContext $(AzureStorageAccountName) $(AzureStorageAccountKey)
$azureShare = Get-AzureStorageShare $(AzureStorageShareName) –Context $azureContext
#Get-AzureStorageFileContent –Share $azureShare –Path "$azureStorageBaseDirectory\$(system.teamProject).snk" "$projectLocalPath\$(system.teamProject).snk"
Write-Output ("Copy signing key from $(DownloadSecureFile.secureFilePath) to $projectLocalPath")
Copy-Item "$(DownloadSecureFile.secureFilePath)" -Destination "$projectLocalPath"
Get-AzureStorageFileContent –Share $azureShare –Path "$azureStorageBaseDirectory\SharePoint 2013\Microsoft.SharePoint.dll" "$projectLocalPath\Microsoft.SharePoint.dll"
Write-Output ("Copy SPTestServer artifacts content from Azure storage account")
$azurePath = Join-Path -Path $azureStorageBaseDirectory -ChildPath "SPTestServer artifacts"
Get-AzureStorageFile -ShareName $(AzureStorageShareName) -Context $azureContext -Path $azurePath | Get-AzureStorageFile | ?{$_.GetType().Name -eq "CloudFile"} | Get-AzureStorageFileContent -Destination $devTestLabsLocalPath
Write-Output ("Copy BuildResources content from Azure storage account")
$azurePath = Join-Path -Path $azureStorageBaseDirectory -ChildPath "BuildPipeline"
Get-AzureStorageFile -ShareName $(AzureStorageShareName) -Context $azureContext -Path $azurePath | Get-AzureStorageFile | ? {$_.GetType().Name -eq "CloudFile"} | Get-AzureStorageFileContent -Destination $buildResourcesLocalPath
Write-Output ("Add assembly Microsoft.SharePoint.dll to the GAC")
Write-Output ("Copy Microsoft.SharePoint.dll from Azure storage account")
$azureContext = New-AzureStorageContext $(AzureStorageAccountName) $(AzureStorageAccountKey)
$azureShare = Get-AzureStorageShare $(AzureStorageShareName) -Context $azureContext
Get-AzureStorageFileContent -Share $azureShare -Path "$azureStorageBaseDirectory\SharePoint 2013\Microsoft.SharePoint.dll" "$projectLocalPath\Microsoft.SharePoint.dll"
Write-Output ("Add Microsoft.SharePoint.dll to the GAC")
[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
$publish = New-Object System.EnterpriseServices.Internal.Publish
$publish.GacInstall("$projectLocalPath\Microsoft.SharePoint.dll")
displayName: 'Import resources from Azure storage account'
Write-Output ("Copy integration tests data from the Azure storage account")
# Create the destination directory
if ((Test-Path -Path $devTestLabsLocalPath -PathType Container) -eq $false) {
New-Item -ItemType Directory -Path $devTestLabsLocalPath
}
$azurePath = Join-Path -Path $azureStorageBaseDirectory -ChildPath "$(Tests.DataFolderName)"
Get-AzureStorageFile -ShareName $(AzureStorageShareName) -Context $azureContext -Path $azurePath | Get-AzureStorageFile | ?{$_.GetType().Name -eq "CloudFile"} | Get-AzureStorageFileContent -Destination $devTestLabsLocalPath
displayName: 'Import resources'
- task: automagically.DownloadFile.DownloadFile.DownloadFile@1
displayName: 'Download ConfigureLab.ps1'
inputs:
FileUrl: 'https://raw.githubusercontent.com/Yvand/AzureRM-Templates/dev/DevTestLabs-Artifacts/manage-artifacts/ConfigureLab.ps1'
DestinationFolder: '$(Build.ArtifactStagingDirectory)\$(Deployment.ConfigureServerFolderName)'

- task: automagically.DownloadFile.DownloadFile.DownloadFile@1
displayName: 'Download ConfigureLab.psm1'
inputs:
FileUrl: 'https://raw.githubusercontent.com/Yvand/AzureRM-Templates/dev/DevTestLabs-Artifacts/manage-artifacts/ConfigureLab.psm1'
DestinationFolder: '$(Build.ArtifactStagingDirectory)\$(Deployment.ConfigureServerFolderName)'

- task: NuGetToolInstaller@0
displayName: 'Use NuGet 4.4.1'
inputs:
Expand Down Expand Up @@ -112,4 +120,4 @@ jobs:
displayName: 'Publish Artifact: drop'
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: drop
artifactName: 'drop_$(configuration)'
Loading

0 comments on commit be5a75b

Please sign in to comment.