Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor PSake File to Perform Deployment in Azure DevOps - Fixes #179 #182

Merged
merged 30 commits into from
Oct 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
26e454d
Added support for running integration tests in Azure DevOps
PlagueHO Sep 22, 2018
af87d1d
Suppress confirmation of installation of PSDepend module during CI
PlagueHO Sep 22, 2018
1527633
Prevent AppVeyor CI from executing deploy task
PlagueHO Sep 22, 2018
1ca34fd
Correct Azure Pipelines Windows build environment variables
PlagueHO Sep 22, 2018
6cbafcf
Add Publish Artifacts task to Windows Azure Pipeline
PlagueHO Sep 22, 2018
9daa0cf
Add Publish step to Azure Pipeline CI topublish psakefile
PlagueHO Sep 22, 2018
529f289
Added missing Changelog entries
PlagueHO Sep 22, 2018
c61b7e0
Fix Azure Pipelines YAML
PlagueHO Sep 22, 2018
2722b0e
Correct YAML again
PlagueHO Sep 22, 2018
02a13f8
Added PSDepend File Artifact to Azure Pipeline CI
PlagueHO Sep 22, 2018
8b08443
Added build file artifact
PlagueHO Sep 22, 2018
e3b8e44
Reworked CI Build Task to Update Git with version number
PlagueHO Sep 22, 2018
8b68a2d
Correct Artefact PSDepend path
PlagueHO Sep 22, 2018
a6b59d4
Prepare Release Pipeline
PlagueHO Sep 22, 2018
683baa9
Correct Zip File artefact
PlagueHO Sep 22, 2018
95e61f1
Changed Azure DevOps Build Number format
PlagueHO Sep 22, 2018
947be2a
Correct spelling of Name variable
PlagueHO Sep 22, 2018
4ac2f3b
Correct Build Number
PlagueHO Sep 22, 2018
80abaee
Update Module Artefact name in Azure DevOps pipeline
PlagueHO Sep 22, 2018
188a4bd
Clean up Deploy Code
PlagueHO Sep 22, 2018
124e3d2
Prepare for Deployment
PlagueHO Sep 23, 2018
8a359c8
Change Deploy to run in any environment
PlagueHO Sep 23, 2018
8b6bfe6
Add Dignostic Code to PSake
PlagueHO Sep 30, 2018
a6b0f78
Change build to always publish test results even if failed
PlagueHO Sep 30, 2018
e315b80
Refactor Build Code
PlagueHO Oct 1, 2018
07b791a
Fix Psake File
PlagueHO Oct 1, 2018
6595ba0
Change the Deploy Folder that the PSake file picks up
PlagueHO Oct 2, 2018
9ee98fe
Update the Verbose information in the Deploy
PlagueHO Oct 2, 2018
d0ba974
Final Tweak to Deploy Output
PlagueHO Oct 2, 2018
3eef45f
Final updates to CHANGELOG.MD
PlagueHO Oct 2, 2018
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
12 changes: 8 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@

## Unreleased

- Fixed RU Display [Issue #168](https://github.com/PlagueHO/CosmosDB/issues/168)
- Fixed Powershell Core `Invoke-WebRequest` error handling
- Fixed retry logic bug (`$fatal` initially set to `$true` instead of `$false`)
- Fixed stored procedure debug logging output
- Fixed RU display - fixes [Issue #168](https://github.com/PlagueHO/CosmosDB/issues/168)
- Fixed Powershell Core `Invoke-WebRequest` error handling.
- Fixed retry logic bug (`$fatal` initially set to `$true` instead of `$false`).
- Fixed stored procedure debug logging output.
- Rework CI process to simplify code.
- Enabled integration test execution in Azure DevOps Pipelines - fixes [Issue #179](https://github.com/PlagueHO/CosmosDB/issues/179)
- Added artifact publish tasks for Azure Pipeline.
- Refactored module deployment process to occur in Azure DevOps pipeline - fixes [Issue #181](https://github.com/PlagueHO/CosmosDB/issues/181)

## 2.1.7.675

Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ environment:
secure: b/CtRX2iDdREmV5mOgoqK9g6HObrPhjNkjeTxrYMgJbiYYmzvivV1Xp52M79NxDN

build_script:
- ps: . .\build.ps1 -Deploy
- ps: . .\build.ps1
53 changes: 52 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,58 @@
name: $(rev:r)
jobs:
- job: Build_PS_Win2016
pool:
vmImage: vs2017-win2016

steps:
- powershell: |
.\build.ps1 -Verbose
displayName: 'Build and Test'
env:
azureApplicationId: $(azureApplicationId)
azureApplicationPassword: $(azureApplicationPassword)
azureSubscriptionId: $(azureSubscriptionId)
azureTenantId: $(azureTenantId)

- task: PublishTestResults@2
inputs:
testRunner: 'NUnit'
testResultsFiles: '**/TestResults.xml'
testRunTitle: 'PS_Win2016'
displayName: 'Publish Test Results'
condition: in(variables['Agent.JobStatus'], 'Succeeded', 'SucceededWithIssues', 'Failed')

- job: Build_PSCore_Ubuntu1604
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: 'staging/CosmosDB'
artifactName: 'CosmosDB'
displayName: 'Publish Module'

- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: 'staging/zip'
artifactName: 'zip'
displayName: 'Publish Module'

- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: 'psakefile.ps1'
artifactName: 'scripts'
displayName: 'Publish PSake File'

- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: 'cosmosdb.depend.psd1'
artifactName: 'scripts'
displayName: 'Publish PSDepend File'

- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: 'build.ps1'
artifactName: 'scripts'
displayName: 'Publish Build File'

- job: Build_PSCore_Ubuntu1604
pool:
vmImage: ubuntu-16.04

Expand All @@ -29,17 +67,24 @@ jobs:
- script: |
pwsh -c '.\build.ps1'
displayName: 'Build and Test'
env:
azureApplicationId: $(azureApplicationId)
azureApplicationPassword: $(azureApplicationPassword)
azureSubscriptionId: $(azureSubscriptionId)
azureTenantId: $(azureTenantId)

- task: PublishTestResults@2
inputs:
testRunner: 'NUnit'
testResultsFiles: '**/TestResults.xml'
testRunTitle: 'PSCore_Ubuntu1604'
displayName: 'Publish Test Results'
condition: in(variables['Agent.JobStatus'], 'Succeeded', 'SucceededWithIssues', 'Failed')

- job: Build_PSCore_MacOS1013
pool:
vmImage: xcode9-macos10.13

steps:
- script: |
brew update
Expand All @@ -50,10 +95,16 @@ jobs:
- script: |
pwsh -c '.\build.ps1'
displayName: 'Build and Test'
env:
azureApplicationId: $(azureApplicationId)
azureApplicationPassword: $(azureApplicationPassword)
azureSubscriptionId: $(azureSubscriptionId)
azureTenantId: $(azureTenantId)

- task: PublishTestResults@2
inputs:
testRunner: 'NUnit'
testResultsFiles: '**/TestResults.xml'
testRunTitle: 'PSCore_MacOS1013'
displayName: 'Publish Test Results'
condition: in(variables['Agent.JobStatus'], 'Succeeded', 'SucceededWithIssues', 'Failed')
57 changes: 27 additions & 30 deletions build.ps1
Original file line number Diff line number Diff line change
@@ -1,45 +1,42 @@
[CmdletBinding()]
param (
[Parameter()]
[Switch]
$Deploy
)
[System.String[]]
$TaskList = 'Default',

Write-Verbose -Message 'Beginning build process...'
[Parameter()]
[System.Collections.Hashtable]
$Parameters,

$task = 'Default'
if ($Deploy)
{
$task = 'Deploy'
}
[Parameter()]
[System.Collections.Hashtable]
$Properties
)

Write-Verbose -Message ('Beginning ''{0}'' process...' -f ($TaskList -join ','))

# Bootstrap the environment
$null = Get-PackageProvider -Name NuGet -ForceBootstrap

# Install PSDepend module
# Install PSake module if it is not already installed
if (-not (Get-Module -Name PSDepend -ListAvailable))
{
$installModuleParameters = @{
Name = 'PSDepend'
Force = $true
AllowClobber = $true
Repository = 'PSGallery'
}
try
{
Install-Module @installModuleParameters
}
catch
{
Install-Module @installModuleParameters -Scope CurrentUser
}
Install-Module -Name PSDepend -Scope CurrentUser -Force -Confirm:$false
}

# Install all other build dependencies
# Install build dependencies required for Init task
Import-Module -Name PSDepend
Invoke-PSDepend -Path $PSScriptRoot -Force -Import -Install

Set-BuildEnvironment -Force

Invoke-Psake -buildFile $ENV:BHProjectPath\psakefile.ps1 -taskList $task -nologo
Invoke-PSDepend `
-Path $PSScriptRoot `
-Force `
-Import `
-Install `
-Tags 'Bootstrap'

# Execute the PSake tasts from the psakefile.ps1
Invoke-Psake `
-buildFile (Join-Path -Path $PSScriptRoot -ChildPath 'psakefile.ps1') `
-nologo `
@PSBoundParameters

exit ( [int]( -not $psake.build_success ) )
54 changes: 42 additions & 12 deletions cosmosdb.depend.psd1
Original file line number Diff line number Diff line change
@@ -1,67 +1,97 @@
@{
psake = @{
psake = @{
Name = 'psake'
DependencyType = 'PSGalleryModule'
Parameters = @{
Repository = 'PSGallery'
SkipPublisherCheck = $true
}
Target = 'CurrentUser'
Version = '4.7.0'
Version = '4.7.4'
Tags = 'Bootstrap'
}

Pester = @{
Pester = @{
Name = 'Pester'
DependencyType = 'PSGalleryModule'
Parameters = @{
Repository = 'PSGallery'
SkipPublisherCheck = $true
}
Target = 'CurrentUser'
Version = '4.3.1'
Version = '4.4.0'
Tags = 'Test'
}

PSScriptAnalyzer = @{
PSScriptAnalyzer = @{
Name = 'PSScriptAnalyzer'
DependencyType = 'PSGalleryModule'
Parameters = @{
Repository = 'PSGallery'
SkipPublisherCheck = $true
}
Target = 'CurrentUser'
Version = '1.16.1'
Version = '1.17.1'
Tags = 'Test'
}

BuildHelpers = @{
BuildHelpers = @{
Name = 'BuildHelpers'
DependencyType = 'PSGalleryModule'
Parameters = @{
Repository = 'PSGallery'
SkipPublisherCheck = $true
}
Target = 'CurrentUser'
Version = '1.0.0'
Version = '2.0.0'
Tags = 'Init'
}

PSDeploy = @{
PSDeploy = @{
Name = 'PSDeploy'
DependencyType = 'PSGalleryModule'
Parameters = @{
Repository = 'PSGallery'
SkipPublisherCheck = $true
}
Target = 'CurrentUser'
Version = '0.2.3'
Version = '1.0'
Tags = 'Deploy'
}

Platyps = @{
Platyps = @{
Name = 'Platyps'
DependencyType = 'PSGalleryModule'
Parameters = @{
Repository = 'PSGallery'
SkipPublisherCheck = $true
}
Target = 'CurrentUser'
Version = '0.9.0'
Version = '0.11.1'
Tags = 'Build'
}

'AzureRM' = @{
Name = 'AzureRM'
DependencyType = 'PSGalleryModule'
Parameters = @{
Repository = 'PSGallery'
SkipPublisherCheck = $true
}
Target = 'CurrentUser'
Version = '6.8.1'
Tags = 'Test_Desktop'
}

'AzureRM.NetCore' = @{
Name = 'AzureRM.NetCore'
DependencyType = 'PSGalleryModule'
Parameters = @{
Repository = 'PSGallery'
SkipPublisherCheck = $true
}
Target = 'CurrentUser'
Version = '0.13.1'
Tags = 'Test_Core'
}
}
Loading