gaelcolas / Sampler

Module template with build pipeline and examples, including DSC elements.
MIT License
171 stars 42 forks source link

error on build with options for markdown in vscode integrated console #345

Closed falkheiland closed 2 years ago

falkheiland commented 2 years ago

Problem description

executing the build.ps1 with tasks Update_markdown_help_source and /or Generate_MAML_from_markdown_help_source does not work.

Verbose logs

ERROR: Mit dem Remotecomputer konnte keine Verbindung hergestellt werden.
In C:\GitHub\PSPathfinder\output\RequiredModules\Sampler\0.112.0\tasks\generateHelp.PlatyPS.build.ps1:181 Zeichen:22
+         $pwshPath = (Get-Process -Id $PID).Path
+                      ~~~~~~~~~~~~~~~~~~~~
In C:\GitHub\PSPathfinder\output\RequiredModules\Sampler\0.112.0\tasks\generateHelp.PlatyPS.build.ps1:126 Zeichen:1
+ Task Update_markdown_help_source {
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In C:\GitHub\PSPathfinder\build.ps1:327 Zeichen:13
+             task $workflow $workflowItem
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In C:\GitHub\PSPathfinder\build.ps1:327 Zeichen:13
+             task $workflow $workflowItem
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Build FAILED. 8 tasks, 1 errors, 0 warnings 00:00:15.3262686
Get-Process : Mit dem Remotecomputer konnte keine Verbindung hergestellt werden.
In C:\GitHub\PSPathfinder\output\RequiredModules\Sampler\0.112.0\tasks\generateHelp.PlatyPS.build.ps1:181 Zeichen:22
+         $pwshPath = (Get-Process -Id $PID).Path
+                      ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-Process], InvalidOperationException
    + FullyQualifiedErrorId : System.InvalidOperationException,Microsoft.PowerShell.Commands.GetProcessCommand

How to reproduce

run inside vscode integrated console

.\build.ps1 -tasks Update_markdown_help_source

Expected behavior

it should work

Current behavior

Error. see verbose logs section.

Suggested solution

https://github.com/gaelcolas/Sampler/blob/a6207e0cb75181a15422d73aac2ba6b7458a3e9e/.build/tasks/generateHelp.PlatyPS.build.ps1#L115

Line 115 should be done diffferently.

Operating system the target node is running

OsName               : Microsoft Windows 11 Pro
OsOperatingSystemSKU : 48
OsArchitecture       : 64-Bit
WindowsVersion       : 2009
WindowsBuildLabEx    : 22000.1.amd64fre.co_release.210604-1628
OsLanguage           : de-DE
OsMuiLanguages       : {de-DE, en-US}

PowerShell version and build the target node is running

Name                           Value
----                           -----
PSVersion                      5.1.22000.282
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.22000.282
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Module version used

Name    Version Path
----    ------- ----
Sampler 0.112.0 C:\Users\fheiland\Documents\PowerShell\Modules\Sampler\0.112.0\Sampler.psd1
johlju commented 2 years ago

I can't reproduce this error in the PowerShell Integrated Console

C:\source\DscResource.DocGenerator [fix/issue#105]> .\build.ps1 -tasks Update_markdown_help_source

[pre-build] Starting Build Init
[build] Starting build with InvokeBuild.
[build] Parsing defined tasks
[build] Loading Configuration from C:\source\DscResource.DocGenerator\build.yaml
Importing tasks from module Sampler.GitHubTasks
         Loading New-Release.GitHub.build.Sampler.GitHubTasks.ib.tasks...
Importing tasks from module Sampler
         Loading Build-Module.ModuleBuilder.build.Sampler.ib.tasks...
         Loading ChocolateyPackage.build.Sampler.ib.tasks...
         Loading Clean.ModuleBuilder.build.Sampler.ib.tasks...
         Loading DeployAll.PSDeploy.build.Sampler.ib.tasks...
         Loading DscResource.Test.build.Sampler.ib.tasks...
         Loading generateHelp.PlatyPS.build.Sampler.ib.tasks...
         Loading GuestConfig.build.Sampler.ib.tasks...
         Loading Invoke-Pester.pester.build.Sampler.ib.tasks...
         Loading JaCoCo.coverage.build.Sampler.ib.tasks...
         Loading release.module.build.Sampler.ib.tasks...
         Loading Set-BuildEnvironment.BuildHelpers.build.Sampler.ib.tasks...
         Loading Set-SamplerTaskVariable...
Adding Workflow from configuration:
  +-> test
  +-> hqrmtest
  +-> publish
  +-> merge
  +-> pack
  +-> build
  +-> .
[build] Executing requested workflow: Update_markdown_help_source
Build Update_markdown_help_source C:\source\DscResource.DocGenerator\build.ps1
Redefined task '.'.

===============================================================================
                        UPDATE MARKDOWN HELP SOURCE
Generate (if absent) or Update the Markdown help source files for each locale folder (i.e. docs/en-US).
-------------------------------------------------------------------------------
  /Update_markdown_help_source
  C:\source\DscResource.DocGenerator\output\RequiredModules\Sampler\0.112.1\tasks\generateHelp.PlatyPS.build.ps1:126

        Project Name               = 'DscResource.DocGenerator'
        Source Path                = 'C:\source\DscResource.DocGenerator\source'
        Output Directory           = 'C:\source\DscResource.DocGenerator\output'
        Release Notes path         = 'C:\source\DscResource.DocGenerator\output\ReleaseNotes.md'
        Built Module Subdirectory  = 'C:\source\DscResource.DocGenerator\output\'
        Module Manifest Path (src) = 'C:\source\DscResource.DocGenerator\source\DscResource.DocGenerator.psd1'
        Versioned Output Directory = 'True'
        Built Module Manifest      = 'C:\source\DscResource.DocGenerator\output\DscResource.DocGenerator\0.10.2\DscResource.DocGenerator.psd1'
        Built Module Base          = 'C:\source\DscResource.DocGenerator\output\DscResource.DocGenerator\0.10.2'
        Module Version             = '0.10.2-fix0001'
        Module Version Folder      = '0.10.2'
        Pre-release Tag            = 'fix0001'
        Built Module Root Script   = 'C:\source\DscResource.DocGenerator\output\DscResource.DocGenerator\0.10.2\DscResource.DocGenerator.psm1'

        Pester Output Folder       = 'C:\source\DscResource.DocGenerator\output\testResults
        Help Source Folder         = 'C:\source\DscResource.DocGenerator\docs'
        Help output Folder         = 'C:\source\DscResource.DocGenerator\output\help'
        Help output Version Folder = 'C:\source\DscResource.DocGenerator\output\help\0.10.2-fix0001'
        Help output Culture path   = 'C:\source\DscResource.DocGenerator\output\help\0.10.2-fix0001\en-US'
        Docs output folder path    = 'C:\source\DscResource.DocGenerator\output\docs'
        Copy MAML to Built Module  = 'True'
No existing help locale folder found. Adding default 'en-US'
Updating help for locale 'en-US'
            $env:PSModulePath = 'C:\source\DscResource.DocGenerator\output\RequiredModules;C:\source\DscResource.DocGenerator\output;C:\Users\johan.ljunggren\Documents\PowerShell\Modules;C:\Program Files\PowerShell\Modules;c:\program files\powershell\7\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules;c:\Users\johan.ljunggren\.vscode\extensions\ms-vscode.powershell-2021.12.0\modules'
            $targetModule = Import-Module -Name 'DscResource.DocGenerator' -ErrorAction Stop -Passthru

            try
            {
                Update-MarkdownHelpModule -Path 'C:\source\DscResource.DocGenerator\docs\en-US' -Force -ErrorAction 'Stop'
            }
            catch
            {
                $newMarkdownHelpParams = @{
                    Module                = 'DscResource.DocGenerator'
                    OutputFolder          = 'C:\source\DscResource.DocGenerator\docs\en-US'
                    AlphabeticParamsOrder = $True
                    WithModulePage        = $True
                    ExcludeDontShow       = $True
                    Force                 = $true
                    ErrorAction           = 'Stop'
                    Locale                = 'en-US'
                    HelpVersion           = '0.10.2-fix0001'
                    Metadata              = @{GeneratedBy = "Sampler update_help_source task"}
                }

                New-MarkdownHelp @newMarkdownHelpParams
            }
            $env:PSModulePath = 'C:\source\DscResource.DocGenerator\output\RequiredModules;C:\source\DscResource.DocGenerator\output;C:\Users\johan.ljunggren\Documents\PowerShell\Modules;C:\Program Files\PowerShell\Modules;c:\program files\powershell\7\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules;c:\Users\johan.ljunggren\.vscode\extensions\ms-vscode.powershell-2021.12.0\modules'
            $targetModule = Import-Module -Name 'DscResource.DocGenerator' -ErrorAction Stop -Passthru

            try
            {
                Update-MarkdownHelpModule -Path 'C:\source\DscResource.DocGenerator\docs\en-US' -Force -ErrorAction 'Stop'
            }
            catch
            {
                $newMarkdownHelpParams = @{
                    Module                = 'DscResource.DocGenerator'
                    OutputFolder          = 'C:\source\DscResource.DocGenerator\docs\en-US'
                    AlphabeticParamsOrder = $True
                    WithModulePage        = $True
                    ExcludeDontShow       = $True
                    Force                 = $true
                    ErrorAction           = 'Stop'
                    Locale                = 'en-US'
                    HelpVersion           = '0.10.2-fix0001'
                    Metadata              = @{GeneratedBy = "Sampler update_help_source task"}
                }

                New-MarkdownHelp @newMarkdownHelpParams
            }
Done /Update_markdown_help_source 00:00:02.9092442
Build succeeded. 1 tasks, 0 errors, 0 warnings 00:00:04.5170263
johlju commented 2 years ago

@falkheiland can you provide more information on how to reproduce this? Do you have a public repo where it possible to reproduce it?

falkheiland commented 2 years ago

@johlju i tried to recreate the issue, but can not. i have no idea what changed (probably something on my client), but it is working now w/o an error. thanks for the help, the issue can be closed, i think.

johlju commented 2 years ago

Closing this as per previous comment. Please reopen or comment if this happens again, and is reproducible.