From dbc6086fee201ca1c787963abd575fdeca04d2bc Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Thu, 28 Mar 2019 08:58:09 -0400 Subject: [PATCH 01/10] Set up CI with Azure Pipelines [skip ci] --- azure-pipelines.yml | 64 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 azure-pipelines.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000..bf898f5 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,64 @@ +# Starter pipeline +# Start with a minimal pipeline that you can customize to build and deploy your code. +# Add steps that build, run tests, deploy, and more: +# https://aka.ms/yaml + +jobs: + - job: Build_PS_Win2016 + pool: + vmImage: vs2017-win2016 + steps: + - powershell: | + .\build.ps1 -Verbose + displayName: 'Build and Test' + - task: PublishTestResults@2 + inputs: + testRunner: 'NUnit' + testResultsFiles: '**/TestResults.xml' + testRunTitle: 'PS_Win2016' + displayName: 'Publish Test Results' + + - job: Build_PSCore_Ubuntu1604 + + pool: + vmImage: ubuntu-16.04 + + steps: + - script: | + curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add - + curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | sudo tee /etc/apt/sources.list.d/microsoft.list + sudo apt-get update + sudo apt-get install -y powershell + displayName: 'Install PowerShell Core' + + - script: | + pwsh -c '.\build.ps1' + displayName: 'Build and Test' + + - task: PublishTestResults@2 + inputs: + testRunner: 'NUnit' + testResultsFiles: '**/TestResults.xml' + testRunTitle: 'PSCore_Ubuntu1604' + displayName: 'Publish Test Results' + + - job: Build_PSCore_MacOS1013 + pool: + vmImage: xcode9-macos10.13 + steps: + - script: | + brew update + brew tap caskroom/cask + brew cask install powershell + displayName: 'Install PowerShell Core' + + - script: | + pwsh -c '.\build.ps1' + displayName: 'Build and Test' + + - task: PublishTestResults@2 + inputs: + testRunner: 'NUnit' + testResultsFiles: '**/TestResults.xml' + testRunTitle: 'PSCore_MacOS1013' + displayName: 'Publish Test Results' \ No newline at end of file From 830f5633b50f3d9acd4d6da25a7278f80d714419 Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Thu, 28 Mar 2019 09:13:38 -0400 Subject: [PATCH 02/10] Building Out Build Items --- ZertoApiWrapper.Depend.psd1 | 50 +++++++++++++++++++++++++++++++++++++ ZertoApiWrapper.build.ps1 | 42 ++++++++++++++++++++++++++----- build.ps1 | 16 ++++++++++++ 3 files changed, 102 insertions(+), 6 deletions(-) create mode 100644 ZertoApiWrapper.Depend.psd1 create mode 100644 build.ps1 diff --git a/ZertoApiWrapper.Depend.psd1 b/ZertoApiWrapper.Depend.psd1 new file mode 100644 index 0000000..e0e013c --- /dev/null +++ b/ZertoApiWrapper.Depend.psd1 @@ -0,0 +1,50 @@ +@{ + psake = @{ + Name = 'InvokeBuild' + DependencyType = 'PSGalleryModule' + Parameters = @{ + Repository = 'PSGallery' + SkipPublisherCheck = $true + } + Target = 'CurrentUser' + Version = '5.4.3' + Tags = 'Bootstrap' + } + + Pester = @{ + Name = 'Pester' + DependencyType = 'PSGalleryModule' + Parameters = @{ + Repository = 'PSGallery' + SkipPublisherCheck = $true + } + Target = 'CurrentUser' + Version = '4.6.0' + Tags = 'Test' + } + + PSScriptAnalyzer = @{ + Name = 'PSScriptAnalyzer' + DependencyType = 'PSGalleryModule' + Parameters = @{ + Repository = 'PSGallery' + SkipPublisherCheck = $true + } + Target = 'CurrentUser' + Version = '1.17.1' + Tags = 'Test' + } + + Platyps = @{ + Name = 'Platyps' + DependencyType = 'PSGalleryModule' + Parameters = @{ + Repository = 'PSGallery' + SkipPublisherCheck = $true + } + Target = 'CurrentUser' + Version = '0.12.0' + Tags = 'Build' + } + +} diff --git a/ZertoApiWrapper.build.ps1 b/ZertoApiWrapper.build.ps1 index d4f7348..a8df4ca 100644 --- a/ZertoApiWrapper.build.ps1 +++ b/ZertoApiWrapper.build.ps1 @@ -1,17 +1,44 @@ -task . InstallDependencies, Analyze +#Requires -Modules 'InvokeBuild' -task InstallDependencies { - Install-Module Pester -Force - Install-Module PSScriptAnalyzer -Force +. '.\ZertoApiWrapper.settings.ps1' +# import-module "$BuildRoot\ZertoApiWrapper\ZertoApiWrapper.psd1" -Verbose -Force + +<# [CmdletBinding()] +param([switch]$Install, + [string]$Configuration = (property Configuration Release)) +$targetDir = "temp/$Configuration/ZertoApiWrapper" #> + +task . Analyze, FileTests + +<# Synopsis: Ensure platyPS is installed #> +task CheckPlatyPSInstalled { + if ($null -eq (Get-Module -List platyPS)) { + Install-Module -Scope CurrentUser -Repository PSGallery -Name platyPS + } } -task Analyze { +<# Synopsis: Ensure Pester is installed #> +task CheckPesterInstalled { + if ($null -eq (Get-Module -List Pester)) { + Install-Module -Scope CurrentUser -Repository PSGallery -Name Pester + } +} + +<# Synopsis: Ensure PSScriptAnalyzer is installed #> +task CheckPSScriptAnalyzerInstalled { + if ($null -eq (Get-Module -List PSScriptAnalyzer)) { + Install-Module -Scope CurrentUser -Repository PSGallery -Name PSScriptAnalyzer + } +} + +<# Synopsis: Analyze ZertoApiWrapper functions for Code Violations #> +task Analyze CheckPSScriptAnalyzerInstalled, CheckPesterInstalled, CheckPlatyPSInstalled, { $scriptAnalyzerParams = @{ Path = "$BuildRoot\ZertoApiWrapper\" Severity = @('Error', 'Warning') Recurse = $true Verbose = $false - ExcludeRule = 'PSUseDeclaredVarsMoreThanAssignments' + ExcludeRule = @('PSUseDeclaredVarsMoreThanAssignments', 'PSUseShouldProcessForStateChangingFunctions') } $saresults = Invoke-ScriptAnalyzer @scriptAnalyzerParams @@ -21,3 +48,6 @@ task Analyze { } } +task FileTests CheckPesterInstalled, { + Invoke-Pester "$BuildRoot\Tests\Public\ZertoApiWrapper.Tests.ps1" -Show Fails +} \ No newline at end of file diff --git a/build.ps1 b/build.ps1 new file mode 100644 index 0000000..9ce90cf --- /dev/null +++ b/build.ps1 @@ -0,0 +1,16 @@ +# Bootstrap the environment +$null = Get-PackageProvider -Name NuGet -ForceBootstrap + +if (-not (Get-Module -Name PSDepend -ListAvailable)) { + Install-Module -Name PSDepend -Scope CurrentUser -Force -Confirm:$false +} + +Import-Module -Name PSDepend +Invoke-PSDepend ` + -Path $PSScriptRoot ` + -Force ` + -Import ` + -Install ` + -Tags 'Bootstrap' + +Invoke-Build . From 973143314e8c4dfca0900f06db41287e0cdb8479 Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Thu, 28 Mar 2019 09:19:06 -0400 Subject: [PATCH 03/10] Move Module Installs to Bootstrap Tag --- ZertoApiWrapper.Depend.psd1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ZertoApiWrapper.Depend.psd1 b/ZertoApiWrapper.Depend.psd1 index e0e013c..9b60641 100644 --- a/ZertoApiWrapper.Depend.psd1 +++ b/ZertoApiWrapper.Depend.psd1 @@ -20,7 +20,7 @@ } Target = 'CurrentUser' Version = '4.6.0' - Tags = 'Test' + Tags = 'Bootstrap' } PSScriptAnalyzer = @{ @@ -32,7 +32,7 @@ } Target = 'CurrentUser' Version = '1.17.1' - Tags = 'Test' + Tags = 'Bootstrap' } Platyps = @{ @@ -44,7 +44,7 @@ } Target = 'CurrentUser' Version = '0.12.0' - Tags = 'Build' + Tags = 'Bootstrap' } } From d67eb6530f36c7a90bafec61bf3d8f22c70bf0fa Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Thu, 28 Mar 2019 09:24:17 -0400 Subject: [PATCH 04/10] Ignore PSUseToExportFieldsInManifest Checks --- ZertoApiWrapper.build.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ZertoApiWrapper.build.ps1 b/ZertoApiWrapper.build.ps1 index a8df4ca..272353d 100644 --- a/ZertoApiWrapper.build.ps1 +++ b/ZertoApiWrapper.build.ps1 @@ -38,7 +38,7 @@ task Analyze CheckPSScriptAnalyzerInstalled, CheckPesterInstalled, CheckPlatyPSI Severity = @('Error', 'Warning') Recurse = $true Verbose = $false - ExcludeRule = @('PSUseDeclaredVarsMoreThanAssignments', 'PSUseShouldProcessForStateChangingFunctions') + ExcludeRule = @('PSUseDeclaredVarsMoreThanAssignments', 'PSUseShouldProcessForStateChangingFunctions', 'PSUseToExportFieldsInManifest') } $saresults = Invoke-ScriptAnalyzer @scriptAnalyzerParams @@ -50,4 +50,4 @@ task Analyze CheckPSScriptAnalyzerInstalled, CheckPesterInstalled, CheckPlatyPSI task FileTests CheckPesterInstalled, { Invoke-Pester "$BuildRoot\Tests\Public\ZertoApiWrapper.Tests.ps1" -Show Fails -} \ No newline at end of file +} From 6b8587a30eac09fde3eadcd2718447b4b870b94e Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Thu, 28 Mar 2019 09:29:24 -0400 Subject: [PATCH 05/10] Update Generic Tests --- Tests/Public/ZertoApiWrapper.Tests.ps1 | 42 ++++++++++++++++++-------- 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/Tests/Public/ZertoApiWrapper.Tests.ps1 b/Tests/Public/ZertoApiWrapper.Tests.ps1 index 529c086..b9f88f4 100644 --- a/Tests/Public/ZertoApiWrapper.Tests.ps1 +++ b/Tests/Public/ZertoApiWrapper.Tests.ps1 @@ -1,23 +1,39 @@ +$moduleName = "ZertoApiWrapper" $moduleFileName = "ZertoApiWrapper.psm1" $filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper' -$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.' +$docsPath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests[\\\/]Public', 'docs' $modulePath = $filePath -replace "Public", "" -Import-Module $modulePath\$moduleFileName -Force -$userName = "zerto\build" -$password = ConvertTo-SecureString -String "ZertoBuild" -AsPlainText -Force -$credential = New-Object -TypeName System.Management.Automation.PSCredential($userName, $password) - -# $credential = Import-Clixml -Path C:\ZertoScripts\Creds.xml -$zertoServer = "192.168.1.100" -$zertoPort = "7669" +Import-Module $modulePath\$moduleFileName Describe "File Tests" { - $commands = Get-Command -Module ZertoApiWrapper | Select-Object -ExpandProperty Name + Remove-Module $moduleName -Force + Import-Module $modulePath\$moduleFileName + $commands = Get-Command -Module $moduleName | Select-Object -ExpandProperty Name foreach ($command in $commands) { + $externalHelpFile = "{0}/{1}.md" -f $docsPath, $command $path = "{0}/{1}.ps1" -f $filePath, $command - it "$command is backed by a file with the same name" { - $path | should exist + context "$command File Tests" { + it "$command is backed by a file with the same name" { + $path | should exist + } + it "$command file has openbraces on the same line as the statement" { + $content = Get-Content -Path $path + $openingBracesExist = $content | Where-Object {$_.Trim() -eq '{'} + if ($openingBracesExist) { + Write-Warning "Found the following opening brances on their own line:" + foreach ($openingBrace in $openingBracesExist) { + Write-Warning "Opening Brace on it's own line - $openingBrace" + } + } + $openingBracesExist | should benullorempty + } + it "$command has an external help file" { + $externalHelpFile | should exist + } + it "$command has the External Help File Defined" { + Get-Content -Path $path -First 1 | should be "<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>" + } } } -} \ No newline at end of file +} From f99c95c6c46d464a458389b8aa422593c9286197 Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Thu, 28 Mar 2019 09:53:11 -0400 Subject: [PATCH 06/10] Rename to remove plural noun --- ZertoApiWrapper/Public/Import-ZertoVpg.ps1 | 2 +- ...gSettings.ps1 => Save-ZertoVpgSetting.ps1} | 2 +- ...VpgSettings.md => Save-ZertoVpgSetting.md} | 184 +++++++++--------- 3 files changed, 94 insertions(+), 94 deletions(-) rename ZertoApiWrapper/Public/{Save-ZertoVpgSettings.ps1 => Save-ZertoVpgSetting.ps1} (95%) rename docs/{Save-ZertoVpgSettings.md => Save-ZertoVpgSetting.md} (85%) diff --git a/ZertoApiWrapper/Public/Import-ZertoVpg.ps1 b/ZertoApiWrapper/Public/Import-ZertoVpg.ps1 index 4c269d0..bbc45ef 100644 --- a/ZertoApiWrapper/Public/Import-ZertoVpg.ps1 +++ b/ZertoApiWrapper/Public/Import-ZertoVpg.ps1 @@ -24,7 +24,7 @@ function Import-ZertoVpg { $importedSettings.VpgSettingsIdentifier = $vpgSettingsIdentifier $uri = "{0}/{1}" -f $baseUri, $vpgSettingsIdentifier Invoke-ZertoRestRequest -uri $uri -method "PUT" -body $($importedSettings | convertto-json -Depth 10) - $vpgSettingsIdentifier | Save-ZertoVpgSettings + $vpgSettingsIdentifier | Save-ZertoVpgSetting if ($settingsFile.Count -gt 1) { Start-Sleep 5 } diff --git a/ZertoApiWrapper/Public/Save-ZertoVpgSettings.ps1 b/ZertoApiWrapper/Public/Save-ZertoVpgSetting.ps1 similarity index 95% rename from ZertoApiWrapper/Public/Save-ZertoVpgSettings.ps1 rename to ZertoApiWrapper/Public/Save-ZertoVpgSetting.ps1 index 24f5084..8e06784 100644 --- a/ZertoApiWrapper/Public/Save-ZertoVpgSettings.ps1 +++ b/ZertoApiWrapper/Public/Save-ZertoVpgSetting.ps1 @@ -1,5 +1,5 @@ <# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> -function Save-ZertoVpgSettings { +function Save-ZertoVpgSetting { [cmdletbinding( SupportsShouldProcess = $true )] diff --git a/docs/Save-ZertoVpgSettings.md b/docs/Save-ZertoVpgSetting.md similarity index 85% rename from docs/Save-ZertoVpgSettings.md rename to docs/Save-ZertoVpgSetting.md index 16d9dda..2e2efaf 100644 --- a/docs/Save-ZertoVpgSettings.md +++ b/docs/Save-ZertoVpgSetting.md @@ -1,92 +1,92 @@ ---- -external help file: ZertoApiWrapper-help.xml -Module Name: ZertoApiWrapper -online version: https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Save-ZertoVpgSettings.md -schema: 2.0.0 ---- - -# Save-ZertoVpgSettings - -## SYNOPSIS -Commits the updated Vpg Settings with the configured Vpg Settings Identifier - -## SYNTAX - -``` -Save-ZertoVpgSettings [-vpgSettingsIdentifier] [-WhatIf] [-Confirm] [] -``` - -## DESCRIPTION -Commits the updated Vpg Settings with the configured Vpg Settings Identifier - -## EXAMPLES - -### Example 1 -```powershell -PS C:> Save-ZertoVpgSettings -vpgSettingsIdentifier "MyVpgSettingsIdentifier" -``` - -Commits vpg settings with vpg settings identifier "MyVpgSettingsIdentifier" - -## PARAMETERS - -### -vpgSettingsIdentifier -VpgSettings Identifier to save - -```yaml -Type: String -Parameter Sets: (All) -Aliases: vpgSettingsId - -Required: True -Position: 0 -Default value: None -Accept pipeline input: True (ByPropertyName, ByValue) -Accept wildcard characters: False -``` - -### -Confirm -Prompts you for confirmation before running the cmdlet. - -```yaml -Type: SwitchParameter -Parameter Sets: (All) -Aliases: cf - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -WhatIf -Shows what would happen if the cmdlet runs. -The cmdlet is not run. - -```yaml -Type: SwitchParameter -Parameter Sets: (All) -Aliases: wi - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). - -## INPUTS - -### System.String -## OUTPUTS - -### System.Object -## NOTES - -## RELATED LINKS - -[Zerto REST API VPG Settings End Point Documentation](http://s3.amazonaws.com/zertodownload_docs/Latest/Zerto%20Virtual%20Replication%20Zerto%20Virtual%20Manager%20%28ZVM%29%20-%20vSphere%20Online%20Help/RestfulAPIs/StatusAPIs.5.108.html#) +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Save-ZertoVpgSetting.md +schema: 2.0.0 +--- + +# Save-ZertoVpgSetting + +## SYNOPSIS +Commits the updated Vpg Settings with the configured Vpg Settings Identifier + +## SYNTAX + +``` +Save-ZertoVpgSetting [-vpgSettingsIdentifier] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +Commits the updated Vpg Settings with the configured Vpg Settings Identifier + +## EXAMPLES + +### Example 1 +```powershell +PS C:> Save-ZertoVpgSetting -vpgSettingsIdentifier "MyVpgSettingsIdentifier" +``` + +Commits vpg settings with vpg settings identifier "MyVpgSettingsIdentifier" + +## PARAMETERS + +### -vpgSettingsIdentifier +VpgSettings Identifier to save + +```yaml +Type: String +Parameter Sets: (All) +Aliases: vpgSettingsId + +Required: True +Position: 1 +Default value: None +Accept pipeline input: True (ByPropertyName, ByValue) +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### System.String +## OUTPUTS + +### System.Object +## NOTES + +## RELATED LINKS + +[Zerto REST API VPG Settings End Point Documentation](http://s3.amazonaws.com/zertodownload_docs/Latest/Zerto%20Virtual%20Replication%20Zerto%20Virtual%20Manager%20%28ZVM%29%20-%20vSphere%20Online%20Help/RestfulAPIs/StatusAPIs.5.108.html#) From 3098566c890d8a733d67f6c46ef9726b749a11e3 Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Thu, 28 Mar 2019 09:53:48 -0400 Subject: [PATCH 07/10] Update Markdown Help --- docs/Remove-ZertoPeerSite.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/Remove-ZertoPeerSite.md b/docs/Remove-ZertoPeerSite.md index 142d574..6bb3816 100644 --- a/docs/Remove-ZertoPeerSite.md +++ b/docs/Remove-ZertoPeerSite.md @@ -150,8 +150,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. -For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS From deae94227217ce790e94224029826e967725a5c1 Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Thu, 28 Mar 2019 10:13:10 -0400 Subject: [PATCH 08/10] Update examples to single noun --- .../Public/en-us/ZertoApiWrapper-help.xml | 24 +++++++++---------- docs/Get-ZertoVpgSetting.md | 10 ++++---- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/ZertoApiWrapper/Public/en-us/ZertoApiWrapper-help.xml b/ZertoApiWrapper/Public/en-us/ZertoApiWrapper-help.xml index 0ee3eb7..03653be 100644 --- a/ZertoApiWrapper/Public/en-us/ZertoApiWrapper-help.xml +++ b/ZertoApiWrapper/Public/en-us/ZertoApiWrapper-help.xml @@ -5977,35 +5977,35 @@ -------------------------- Example 1 -------------------------- - PS C:\> Get-ZertoVpgSettings -vpgSettingsIdentifier "MySettingsIdentifier" + PS C:\> Get-ZertoVpgSetting -vpgSettingsIdentifier "MySettingsIdentifier" Returns all current settings for vpgSettingsIdentifier "MySettingsIdentifier" -------------------------- Example 2 -------------------------- - PS C:\> Get-ZertoVpgSettings -vpgSettingsIdentifier "MySettingsIdentifier" -vmIdentifier "MyVmId" + PS C:\> Get-ZertoVpgSetting -vpgSettingsIdentifier "MySettingsIdentifier" -vmIdentifier "MyVmId" Returns all current vm level settings for the vmIdentifier "MyVmId" in vpgSettingsIdentifier "MySettingsIdentifier" -------------------------- Example 3 -------------------------- - PS C:\> Get-ZertoVpgSettings -vpgSettingsIdentifier "MySettingsIdentifier" -vmIdentifier "MyVmId" -volumes + PS C:\> Get-ZertoVpgSetting -vpgSettingsIdentifier "MySettingsIdentifier" -vmIdentifier "MyVmId" -volumes Returns current vm level settings for volumes for vmId "MyVmId" in vpgSettingsIdentifier "MySettingsIdentifier" -------------------------- Example 4 -------------------------- - PS C:\> Get-ZertoVpgSettings -vpgSettingsIdentifier "MySettingsIdentifier" -nics + PS C:\> Get-ZertoVpgSetting -vpgSettingsIdentifier "MySettingsIdentifier" -nics Returns current vm level settings for nics for vmId "MyVmId" in vpgSettingsIdentifier "MySettingsIdentifier" -------------------------- Example 5 -------------------------- - PS C:\> Get-ZertoVpgSettings -vpgSettingsIdentifier "MySettingsIdentifier" -basic + PS C:\> Get-ZertoVpgSetting -vpgSettingsIdentifier "MySettingsIdentifier" -basic Returns current basic settings for vpgSettingsIdentifier "MySettingsIdentifier" @@ -10656,9 +10656,9 @@ - Save-ZertoVpgSettings + Save-ZertoVpgSetting Save - ZertoVpgSettings + ZertoVpgSetting Commits the updated Vpg Settings with the configured Vpg Settings Identifier @@ -10668,8 +10668,8 @@ - Save-ZertoVpgSettings - + Save-ZertoVpgSetting + vpgSettingsIdentifier VpgSettings Identifier to save @@ -10706,7 +10706,7 @@ - + vpgSettingsIdentifier VpgSettings Identifier to save @@ -10771,7 +10771,7 @@ -------------------------- Example 1 -------------------------- - PS C:> Save-ZertoVpgSettings -vpgSettingsIdentifier "MyVpgSettingsIdentifier" + PS C:> Save-ZertoVpgSetting -vpgSettingsIdentifier "MyVpgSettingsIdentifier" Commits vpg settings with vpg settings identifier "MyVpgSettingsIdentifier" @@ -10780,7 +10780,7 @@ Online Version: - https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Save-ZertoVpgSettings.md + https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Save-ZertoVpgSetting.md Zerto REST API VPG Settings End Point Documentation diff --git a/docs/Get-ZertoVpgSetting.md b/docs/Get-ZertoVpgSetting.md index d812532..8c97811 100644 --- a/docs/Get-ZertoVpgSetting.md +++ b/docs/Get-ZertoVpgSetting.md @@ -118,35 +118,35 @@ It is important to note that only once a VPG settings object has been created, w ### Example 1 ```powershell -PS C:\> Get-ZertoVpgSettings -vpgSettingsIdentifier "MySettingsIdentifier" +PS C:\> Get-ZertoVpgSetting -vpgSettingsIdentifier "MySettingsIdentifier" ``` Returns all current settings for vpgSettingsIdentifier "MySettingsIdentifier" ### Example 2 ```powershell -PS C:\> Get-ZertoVpgSettings -vpgSettingsIdentifier "MySettingsIdentifier" -vmIdentifier "MyVmId" +PS C:\> Get-ZertoVpgSetting -vpgSettingsIdentifier "MySettingsIdentifier" -vmIdentifier "MyVmId" ``` Returns all current vm level settings for the vmIdentifier "MyVmId" in vpgSettingsIdentifier "MySettingsIdentifier" ### Example 3 ```powershell -PS C:\> Get-ZertoVpgSettings -vpgSettingsIdentifier "MySettingsIdentifier" -vmIdentifier "MyVmId" -volumes +PS C:\> Get-ZertoVpgSetting -vpgSettingsIdentifier "MySettingsIdentifier" -vmIdentifier "MyVmId" -volumes ``` Returns current vm level settings for volumes for vmId "MyVmId" in vpgSettingsIdentifier "MySettingsIdentifier" ### Example 4 ```powershell -PS C:\> Get-ZertoVpgSettings -vpgSettingsIdentifier "MySettingsIdentifier" -nics +PS C:\> Get-ZertoVpgSetting -vpgSettingsIdentifier "MySettingsIdentifier" -nics ``` Returns current vm level settings for nics for vmId "MyVmId" in vpgSettingsIdentifier "MySettingsIdentifier" ### Example 5 ```powershell -PS C:\> Get-ZertoVpgSettings -vpgSettingsIdentifier "MySettingsIdentifier" -basic +PS C:\> Get-ZertoVpgSetting -vpgSettingsIdentifier "MySettingsIdentifier" -basic ``` Returns current basic settings for vpgSettingsIdentifier "MySettingsIdentifier" From 5a10669403d96ed42036598c511ab764df6d58b3 Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Thu, 28 Mar 2019 10:14:11 -0400 Subject: [PATCH 09/10] Add Build Tasks for Help System --- ZertoApiWrapper.build.ps1 | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/ZertoApiWrapper.build.ps1 b/ZertoApiWrapper.build.ps1 index 272353d..00e604a 100644 --- a/ZertoApiWrapper.build.ps1 +++ b/ZertoApiWrapper.build.ps1 @@ -51,3 +51,21 @@ task Analyze CheckPSScriptAnalyzerInstalled, CheckPesterInstalled, CheckPlatyPSI task FileTests CheckPesterInstalled, { Invoke-Pester "$BuildRoot\Tests\Public\ZertoApiWrapper.Tests.ps1" -Show Fails } + +$buildMamlParams = @{ + Inputs = { Get-ChildItem docs\*.md } + Outputs = ".\ZertoApiWrapper\Public\en-us\ZertoApiWrapper-help.xml" +} + +task BuildMamlHelp CheckPlatyPSInstalled, { + if (Test-Path $buildMamlParams.Outputs) { + Remove-Item $buildMamlParams.Outputs + } + platyPS\New-ExternalHelp .\docs -Force -OutputPath $buildMamlParams.Outputs +} + +task UpdateMarkdownHelp CheckPlatyPSInstalled, { + remove-module ZertoApiWrapper -force -ErrorAction SilentlyContinue + Import-Module .\ZertoApiWrapper\ZertoApiWrapper.psm1 -Force + Update-MarkDownHelp -Path docs -AlphabeticParamsOrder +} From 3e9f450208775091b32692baed99ee6ca38bae3a Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Thu, 28 Mar 2019 10:32:23 -0400 Subject: [PATCH 10/10] Fix Test Publishing --- ZertoApiWrapper.build.ps1 | 3 ++- azure-pipelines.yml | 24 ++++++++++++------------ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/ZertoApiWrapper.build.ps1 b/ZertoApiWrapper.build.ps1 index 00e604a..e469509 100644 --- a/ZertoApiWrapper.build.ps1 +++ b/ZertoApiWrapper.build.ps1 @@ -49,7 +49,8 @@ task Analyze CheckPSScriptAnalyzerInstalled, CheckPesterInstalled, CheckPlatyPSI } task FileTests CheckPesterInstalled, { - Invoke-Pester "$BuildRoot\Tests\Public\ZertoApiWrapper.Tests.ps1" -Show Fails + $testResultsFile = "$BuildRoot\Tests\Public\TestResults.xml" + Invoke-Pester -Script "$BuildRoot\Tests\Public\ZertoApiWrapper.Tests.ps1" -OutputFile $testResultsFile -PassThru } $buildMamlParams = @{ diff --git a/azure-pipelines.yml b/azure-pipelines.yml index bf898f5..afbd413 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -14,15 +14,15 @@ jobs: - task: PublishTestResults@2 inputs: testRunner: 'NUnit' - testResultsFiles: '**/TestResults.xml' + testResultsFiles: '**/Public/TestResults.xml' testRunTitle: 'PS_Win2016' displayName: 'Publish Test Results' - + - job: Build_PSCore_Ubuntu1604 - + pool: vmImage: ubuntu-16.04 - + steps: - script: | curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add - @@ -30,18 +30,18 @@ jobs: sudo apt-get update sudo apt-get install -y powershell displayName: 'Install PowerShell Core' - + - script: | pwsh -c '.\build.ps1' displayName: 'Build and Test' - + - task: PublishTestResults@2 inputs: testRunner: 'NUnit' - testResultsFiles: '**/TestResults.xml' + testResultsFiles: '**/Public/TestResults.xml' testRunTitle: 'PSCore_Ubuntu1604' displayName: 'Publish Test Results' - + - job: Build_PSCore_MacOS1013 pool: vmImage: xcode9-macos10.13 @@ -51,14 +51,14 @@ jobs: brew tap caskroom/cask brew cask install powershell displayName: 'Install PowerShell Core' - + - script: | pwsh -c '.\build.ps1' displayName: 'Build and Test' - + - task: PublishTestResults@2 inputs: testRunner: 'NUnit' - testResultsFiles: '**/TestResults.xml' + testResultsFiles: '**/Public/TestResults.xml' testRunTitle: 'PSCore_MacOS1013' - displayName: 'Publish Test Results' \ No newline at end of file + displayName: 'Publish Test Results'