Skip to content
This repository has been archived by the owner on Oct 21, 2023. It is now read-only.

Commit

Permalink
!deploy v2.6.2 - Fixes for #41 and bring Resource and Property functi…
Browse files Browse the repository at this point in the history
…ons up-to-spec

## 2.6.2

* [Issue #41](#41)
  * Fixed: `Update-VSStack` and `Update-VSStackSet` were removing the `BuiltWith = VaporShell` tags if not explicitly included when updating Tags.
* Miscellaneous
  * Brought Resource Type and Property Type functions up to current spec sheet.
  • Loading branch information
scrthq authored Nov 26, 2018
2 parents ec825a0 + 2b56fd5 commit fdf8f57
Show file tree
Hide file tree
Showing 8 changed files with 285 additions and 69 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ launch.json
vaporshell-snippets**
TestResults**.xml
BuildOutput/*
VaporShell.zip
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<!-- TOC -->

* [2.6.2](#262)
* [2.6.1](#261)
* [2.6.0](#260)
* [2.5.5](#255)
Expand Down Expand Up @@ -38,6 +39,13 @@

<!-- /TOC -->

## 2.6.2

* [Issue #41](https://github.com/scrthq/VaporShell/issues/41)
* Fixed: `Update-VSStack` and `Update-VSStackSet` were removing the `BuiltWith = VaporShell` tags if not explicitly included when updating Tags.
* Miscellaneous
* Brought Resource Type and Property Type functions up to current spec sheet.

## 2.6.1

* [Issue #41](https://github.com/scrthq/VaporShell/issues/41)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ function Update-VSStack {
}
Tags {
$tagList = New-Object 'System.Collections.Generic.List[Amazon.CloudFormation.Model.Tag]'
$tagList.Add((VSStackTag -Key BuiltWith -Value VaporShell))
if ($null -ne $Tags) {
foreach ($key in $Tags.Keys) {
$tagList.Add((VSStackTag -Key $key -Value $Tags[$key]))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ function Update-VSStackSet {
}
Tags {
$tagList = New-Object 'System.Collections.Generic.List[Amazon.CloudFormation.Model.Tag]'
$tagList.Add((VSStackTag -Key BuiltWith -Value VaporShell))
if ($null -ne $Tags) {
foreach ($key in $Tags.Keys) {
$tagList.Add((VSStackTag -Key $key -Value $Tags[$key]))
Expand Down
4 changes: 2 additions & 2 deletions VaporShell/VaporShell.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'VaporShell.psm1'

# Version number of this module.
ModuleVersion = '2.6.1'
ModuleVersion = '2.6.2'

# ID used to uniquely identify this module
GUID = 'd526494c-6e59-41ff-ad05-eedbc1473b6a'
Expand Down Expand Up @@ -105,7 +105,7 @@ Website: https://vaporshell.io/
PSData = @{

# Tags applied to this module. These help with module discovery in online galleries.
Tags = 'AWS','CloudFormation','CFN','JSON','YAML','PSEdition_Core','PSEdition_Desktop'
Tags = 'AWS','CloudFormation','CFN','JSON','YAML','IaC','InfrastructureAsCode','PSEdition_Core','PSEdition_Desktop'

# A URL to the license for this module.
LicenseUri = 'https://github.com/scrthq/VaporShell/blob/master/LICENSE'
Expand Down
48 changes: 41 additions & 7 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ phases:
name: Hosted VS2017

steps:
- powershell: . ./build.ps1 -Task Init,Clean,Compile
- powershell: . ./build.ps1
displayName: Compile Module

- task: PublishBuildArtifacts@1
Expand All @@ -38,7 +38,13 @@ phases:
name: Hosted VS2017

steps:
- powershell: . ./build.ps1
- task: DownloadBuildArtifacts@0
displayName: 'Download Build Artifacts'
inputs:
artifactName: BuildOutput
downloadPath: '$(Build.SourcesDirectory)'

- powershell: . ./build.ps1 -Task PesterOnly
displayName: Test Module

- task: PublishTestResults@2
Expand All @@ -58,7 +64,13 @@ phases:
name: Hosted Ubuntu 1604

steps:
- powershell: . ./build.ps1
- task: DownloadBuildArtifacts@0
displayName: 'Download Build Artifacts'
inputs:
artifactName: BuildOutput
downloadPath: '$(Build.SourcesDirectory)'

- powershell: . ./build.ps1 -Task PesterOnly
displayName: Test Module

- task: PublishTestResults@2
Expand All @@ -78,7 +90,13 @@ phases:
name: Hosted macOS

steps:
- powershell: . ./build.ps1
- task: DownloadBuildArtifacts@0
displayName: 'Download Build Artifacts'
inputs:
artifactName: BuildOutput
downloadPath: '$(Build.SourcesDirectory)'

- powershell: . ./build.ps1 -Task PesterOnly
displayName: Test Module

- task: PublishTestResults@2
Expand All @@ -101,9 +119,15 @@ phases:
- script: 'choco install powershell-core --yes'
displayName: 'Install Powershell v6'

- task: DownloadBuildArtifacts@0
displayName: 'Download Build Artifacts'
inputs:
artifactName: BuildOutput
downloadPath: '$(Build.SourcesDirectory)'

- powershell: |
$Env:Path = [Environment]::GetEnvironmentVariable('Path',[EnvironmentVariableTarget]::Machine)
pwsh -command ". ./build.ps1"
pwsh -command ". ./build.ps1 -Task PesterOnly"
displayName: Test Module
- task: PublishTestResults@2
Expand All @@ -126,8 +150,18 @@ phases:
name: Hosted VS2017

steps:
- task: DownloadBuildArtifacts@0
displayName: 'Download Build Artifacts'
inputs:
artifactName: BuildOutput
downloadPath: '$(Build.SourcesDirectory)'

- powershell: |
$env:SourceBranch = '$(Build.SourceBranch)'
$env:NuGetApiKey = '$(NuGetApiKey)'
$Env:GitHubPAT = '$(GitHub.PAT)'
$Env:NuGetApiKey = '$(NuGetApiKey)'
$Env:TwitterAccessSecret = '$(Twitter.AccessSecret)'
$Env:TwitterAccessToken = '$(Twitter.AccessToken)'
$Env:TwitterConsumerKey = '$(Twitter.ConsumerKey)'
$Env:TwitterConsumerSecret = '$(Twitter.ConsumerSecret)'
. ./build.ps1 -Task Deploy
displayName: Deploy to PowerShell Gallery
60 changes: 45 additions & 15 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
[cmdletbinding(DefaultParameterSetName = 'task')]
param(
[parameter(ParameterSetName = 'task', Position = 0)]
[ValidateSet('Init','Update','Clean','Compile','Pester','PesterOnly','Deploy')]
[ValidateSet('Init','Update','Clean','Compile','Import','Pester','PesterOnly','Deploy')]
[string[]]
$Task = @('Init','Update','Clean','Compile','Pester'),
$Task = @('Init','Update','Clean','Compile','Import'),

[parameter(ParameterSetName = 'help')]
[switch]$Help,
Expand Down Expand Up @@ -97,33 +97,63 @@ if ($Help) {
Format-Table -Property Name, Description, Alias, DependsOn
}
else {
'BuildHelpers' | Resolve-Module @update -Verbose
Set-BuildEnvironment -Force
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
$Task -eq 'Deploy' -and -not $Force -and (
$ENV:BUILD_BUILDURI -notlike 'vstfs:*' -or
$env:BUILD_SOURCEBRANCH -like '*pull*' -or
$env:BUILD_SOURCEVERSIONMESSAGE -notmatch '!deploy' -or
$env:BUILD_SOURCEBRANCHNAME -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 build system is VSTS : $($env:BUILD_BUILDURI -like 'vstfs:*') [$env:BUILD_BUILDURI]`n" +
" + Current branch is master : $($env:BUILD_SOURCEBRANCHNAME -eq 'master') [$env:BUILD_SOURCEBRANCHNAME]`n" +
" + Source is not a pull request : $($env:BUILD_SOURCEBRANCH -notlike '*pull*') [$env:BUILD_SOURCEBRANCH]`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" +
" + Build script is not Force ran : $($Force)`n" +
" + Commit message matches '!deploy' : $($env:BUILD_SOURCEVERSIONMESSAGE -match '!deploy') [$env:BUILD_SOURCEVERSIONMESSAGE]`n" +
"Skipping psake for this job!" | Write-Host -ForegroundColor Yellow
exit 0
}
else {
'psake' | Resolve-Module @update -Verbose
if ($Task -eq 'Deploy') {
"Task is 'Deploy' and conditions are correct for deployment:`n" +
" + Build script is Force ran : $($Force)`n" +
" + Current build system is VSTS : $($env:BUILD_BUILDURI -like 'vstfs:*') [$env:BUILD_BUILDURI]`n" +
" + Current branch is master : $($env:BUILD_SOURCEBRANCHNAME -eq 'master') [$env:BUILD_SOURCEBRANCHNAME]`n" +
" + Source is not a pull request : $($env:BUILD_SOURCEBRANCH -notlike '*pull*') [$env:BUILD_SOURCEBRANCH]`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" +
" + Commit message matches '!deploy' : $($env:BUILD_SOURCEVERSIONMESSAGE -match '!deploy') [$env:BUILD_SOURCEVERSIONMESSAGE]"| Write-Host -ForegroundColor Green
}
'BuildHelpers','psake' | Resolve-Module @update -Verbose
Set-BuildEnvironment -Force
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
$psakeParams = @{
nologo = $true
buildFile = "$PSScriptRoot\psake.ps1"
taskList = $Task
}
if ($Task -eq 'TestOnly') {
$global:ExcludeTag = @('Module')
}
else {
$global:ExcludeTag = $null
}
if ($Force) {
$global:ForceDeploy = $true
}
else {
$global:ForceDeploy = $false
}
Invoke-psake @psakeParams @verbose
if ($Task -contains 'Import' -and $psake.build_success) {
Import-Module ([System.IO.Path]::Combine($env:BHBuildOutput,$env:BHProjectName)) -Verbose:$false
}
exit ( [int]( -not $psake.build_success ) )
}
}
Loading

0 comments on commit fdf8f57

Please sign in to comment.