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

!deploy v2.17.2 with fixes for issue #103 #107

Merged
merged 5 commits into from
Oct 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ DLLUnpackStg
DLLUnpackStg/*
FunctionBackups
FunctionBackups/*
out/*
BuildOutput/*
*config.csv
39 changes: 0 additions & 39 deletions .travis.yml

This file was deleted.

6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Changelog

* [2.17.2](#2172)
* [2.17.1](#2171)
* [2.17.0](#2170)
* [2.16.1](#2161)
Expand Down Expand Up @@ -54,6 +55,11 @@
* [Functions Removed](#functions-removed)
* [Functions Aliased](#functions-aliased)

## 2.17.2

* [Issue #103](https://github.com/scrthq/PSGSuite/issues/103)
* Fixed: `SendNotificationEmail` is now correctly defaulting to `$false`, but attempting to actually send the notification email results in an error. This is now corrected.

## 2.17.1

- Validated deployment via Azure Pipelines
Expand Down
2 changes: 1 addition & 1 deletion PSGSuite/PSGSuite.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'PSGSuite.psm1'

# Version number of this module.
ModuleVersion = '2.17.1'
ModuleVersion = '2.17.2'

# ID used to uniquely identify this module
GUID = '9d751152-e83e-40bb-a6db-4c329092aaec'
Expand Down
2 changes: 1 addition & 1 deletion PSGSuite/PSGSuite.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ Param
$ConfigName
)
$ModuleRoot = $PSScriptRoot
New-Variable -Name PSGSuiteKey -Value $EncryptionKey -Scope Global -Force -PassThru
New-Variable -Name PSGSuiteKey -Value $EncryptionKey -Scope Global -Force
8 changes: 0 additions & 8 deletions PSGSuite/Public/Drive/Add-GSDrivePermission.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,6 @@ function Add-GSDrivePermission {
Type {
$body.$key = ($PSBoundParameters[$key]).ToLower()
}
SendNotificationEmail {
if ($PSBoundParameters[$key]) {
$body.$key = $PSBoundParameters[$key]
}
else {
$body.$key = $false
}
}
Default {
if ($body.PSObject.Properties.Name -contains $key) {
$body.$key = $PSBoundParameters[$key]
Expand Down
17 changes: 6 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,6 @@
<img src="https://dev.azure.com/scrthq/SCRT%20HQ/_apis/build/status/PSGSuite-CI"
alt="Azure Pipelines" title="Azure Pipelines" />
</a>&nbsp;&nbsp;&nbsp;&nbsp;
<!-- AppVeyor -->
<a href="https://ci.appveyor.com/project/scrthq/psgsuite/branch/master">
<img src="https://ci.appveyor.com/api/projects/status/u6pgrn4cs8iagcee/branch/master?svg=true"
alt="AppVeyor" title="AppVeyor" />
</a>&nbsp;&nbsp;&nbsp;&nbsp;
<!-- Travis CI -->
<a href="https://travis-ci.org/scrthq/PSGSuite">
<img src="https://img.shields.io/travis/scrthq/PSGSuite.svg?logo=travis&style=flat"
alt="Travis CI" title="Travis CI" />
</a>&nbsp;&nbsp;&nbsp;&nbsp;
<!-- PS Gallery -->
<a href="https://www.PowerShellGallery.com/packages/PSGSuite">
<img src="https://img.shields.io/powershellgallery/dt/PSGSuite.svg?style=flat"
Expand Down Expand Up @@ -132,9 +122,14 @@ Update-GSSheetValue Export-GSSheet

### Most recent changes

#### 2.17.2

* [Issue #103](https://github.com/scrthq/PSGSuite/issues/103)
* Fixed: `SendNotificationEmail` is now correctly defaulting to `$false`, but attempting to actually send the notification email results in an error. This is now corrected.

#### 2.17.1

- Validated deployment via Azure Pipelines
* Validated deployment via Azure Pipelines

#### 2.17.0

Expand Down
2 changes: 1 addition & 1 deletion Tests/Module Tests/PSGSuite.Tests.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$PSVersion = $PSVersionTable.PSVersion.Major
$projectRoot = Resolve-Path "$PSScriptRoot\..\.."
$ModulePath = Resolve-Path "$projectRoot\out\$($env:BHProjectName)"
$ModulePath = Resolve-Path "$projectRoot\BuildOutput\$($env:BHProjectName)"
$decompiledModulePath = Resolve-Path "$projectRoot\$($env:BHProjectName)"
$env:EnablePSGSuiteDebug = $true

Expand Down
26 changes: 0 additions & 26 deletions appveyor.yml

This file was deleted.

9 changes: 5 additions & 4 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ phases:
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: Compiled Module'
inputs:
PathtoPublish: out/PSGSuite
ArtifactName: PSGSuite
PathtoPublish: BuildOutput
ArtifactName: BuildOutput


- phase: Phase_2
Expand Down Expand Up @@ -107,10 +107,10 @@ phases:
displayName: Test Module

- task: PublishTestResults@2
displayName: 'Publish Test Results **/Test-*.xml'
displayName: 'Publish Test Results **/Test*.xml'
inputs:
testRunner: NUnit
testResultsFiles: '**/Test-*.xml'
testResultsFiles: '**/Test*.xml'
condition: succeededOrFailed()

- phase: Phase_6
Expand All @@ -127,6 +127,7 @@ phases:

steps:
- powershell: |
$env:SourceBranch = '$(Build.SourceBranch)'
$Env:NuGetApiKey = '$(NuGetApiKey)'
. ./build.ps1 -Task Deploy
displayName: Deploy to PowerShell Gallery
51 changes: 34 additions & 17 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -81,32 +81,49 @@ function Resolve-Module {
}
}

'BuildHelpers','psake' | Resolve-Module -UpdateModules:$PSBoundParameters['UpdateModules'] -Verbose:$PSBoundParameters['Verbose']
$update = @{}
$verbose = @{}
if ($PSBoundParameters.ContainsKey('UpdateModules')) {
$update['UpdateModules'] = $PSBoundParameters['UpdateModules']
}
if ($PSBoundParameters.ContainsKey('Verbose')) {
$verbose['Verbose'] = $PSBoundParameters['Verbose']
}

if ($Help) {
'psake' | Resolve-Module @update @verbose
Get-PSakeScriptTasks -buildFile "$PSScriptRoot\psake.ps1" |
Sort-Object -Property Name |
Format-Table -Property Name, Description, Alias, DependsOn
}
else {
'BuildHelpers' | Resolve-Module @update @verbose
Set-BuildEnvironment -Force
if ($ENV:BHBuildSystem -eq 'VSTS' -and $env:BHCommitMessage -notmatch '!deploy' -and $env:BHBranchName -eq "master" -and $PSVersionTable.PSVersion.Major -lt 6 -and -not [String]::IsNullOrEmpty($env:NugetApiKey) -and $Task -eq 'Deploy') {
Write-Host ""
Write-Warning "Current build system is $($ENV:BHBuildSystem), but commit message does not match '!deploy'. Skipping psake for this job..."
Write-Host ""
if (
$Task -eq 'Deploy' -and (
$ENV:BHBuildSystem -ne 'VSTS' -or
$env:SourceBranch -like '*pull*' -or
$env:BHCommitMessage -notmatch '!deploy' -or
$env:BHBranchName -ne 'master' -or
$PSVersionTable.PSVersion.Major -ne 5 -or
$null -eq $env:NugetApiKey
)
) {
"Task is 'Deploy', but conditions are not correct for deployment:`n" +
" + Current build system is VSTS : $($env:BHBuildSystem -eq 'VSTS') [$env:BHBuildSystem]`n" +
" + Current branch is master : $($env:BHBranchName -eq 'master') [$env:BHBranchName]`n" +
" + Source is not a pull request : $($env:SourceBranch -notlike '*pull*') [$env:SourceBranch]`n" +
" + Commit message matches '!deploy' : $($env:BHCommitMessage -match '!deploy') [$env:BHCommitMessage]`n" +
" + Current PS major version is 5 : $($PSVersionTable.PSVersion.Major -eq 5) [$($PSVersionTable.PSVersion.ToString())]`n" +
" + NuGet API key is not null : $($null -ne $env:NugetApiKey)`n" +
"Skipping psake for this job!" | Write-Host -ForegroundColor Yellow
exit 0
}
elseif ($ENV:BHBuildSystem -eq 'VSTS' -and $env:BHCommitMessage -match '!deploy' -and $env:BHBranchName -eq "master" -and $PSVersionTable.PSVersion.Major -lt 6 -and -not [String]::IsNullOrEmpty($env:NugetApiKey)) {
$Task = 'Deploy'
}
elseif ($ENV:BHBuildSystem -ne 'VSTS' -and $Task -eq 'Deploy') {
Write-Host ""
Write-Warning "Current build system is $($ENV:BHBuildSystem). Changing to default task list..."
Write-Host ""
$Task = @('Init','Clean','Compile','Pester')
else {
'psake' | Resolve-Module @update @verbose
Write-Host -ForegroundColor Green "Modules successfully resolved..."
Write-Host -ForegroundColor Green "Invoking psake with task list: [ $($Task -join ', ') ]`n"
Invoke-psake -buildFile "$PSScriptRoot\psake.ps1" -taskList $Task -nologo @verbose
exit ( [int]( -not $psake.build_success ) )
}
Write-Host -ForegroundColor Green "Modules successfully resolved..."
Write-Host -ForegroundColor Green "Invoking psake with task list: [ $($Task -join ', ') ]`n"
Invoke-psake -buildFile "$PSScriptRoot\psake.ps1" -taskList $Task -nologo -Verbose:$PSBoundParameters['Verbose']
exit ( [int]( -not $psake.build_success ) )
}
16 changes: 12 additions & 4 deletions psake.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ Properties {
$sut = $env:BHModulePath
$tests = "$projectRoot\Tests"
$Timestamp = Get-Date -Uformat "%Y%m%d-%H%M%S"
$PSVersion = $PSVersionTable.PSVersion.Major
$PSVersion = $PSVersionTable.PSVersion.ToString()
$TestFile = "TestResults_PS$PSVersion`_$TimeStamp.xml"
$lines = '----------------------------------------------------------------------'
$outputDir = Join-Path -Path $projectRoot -ChildPath 'out'
$outputDir = $env:BHBuildOutput
$outputModDir = Join-Path -Path $outputDir -ChildPath $env:BHProjectName
$manifest = Import-PowerShellDataFile -Path $env:BHPSModuleManifest
$outputModVerDir = Join-Path -Path $outputModDir -ChildPath $manifest.ModuleVersion
Expand Down Expand Up @@ -58,8 +58,9 @@ task Clean -depends Init {
Remove-Module -Name $env:BHProjectName -Force -ErrorAction SilentlyContinue

if (Test-Path -Path $outputDir) {
Get-ChildItem -Path $outputDir -Recurse -File | Where-Object {$_.BaseName -eq $env:BHProjectName} | Remove-Item -Force -Recurse
} else {
Get-ChildItem -Path $outputDir -Recurse -File | Where-Object {$_.BaseName -eq $env:BHProjectName -or $_.Name -like "Test*.xml"} | Remove-Item -Force -Recurse
}
else {
New-Item -Path $outputDir -ItemType Directory > $null
}
" Cleaned previous output directory [$outputDir]"
Expand Down Expand Up @@ -93,6 +94,13 @@ task Compile -depends Clean {

Import-GoogleSDK

if (`$global:PSGSuiteKey -and `$MyInvocation.BoundParameters['Debug']) {
`$prevDebugPref = `$DebugPreference
`$DebugPreference = "Continue"
Write-Debug "```$global:PSGSuiteKey is set to a `$(`$global:PSGSuiteKey.Count * 8)-bit key!"
`$DebugPreference = `$prevDebugPref
}

`$aliasHash = $aliasHashContents

foreach (`$key in `$aliasHash.Keys) {
Expand Down