jenkins.io
jenkins.io copied to clipboard
Microsoft PowerShell Support for Pipeline page - TODO: Put a summary here
Problem with the Microsoft PowerShell Support for Pipeline page, source file
The page provides code examples without explaining that these use the scripted pipeline syntax. E.g.:
node {
def msg = powershell(returnStdout: true, script: 'Write-Output "PowerShell is mighty!"')
println msg
}
Possible Solution
Add a note to the code sections that these use scripted syntax explaining the need to use a script{} block in declarative pipelines.
Or if there is a way to use this in declarative pipelines with a script block provide examples of that as well.
Blog posts typically don't get updated after the fact.
Wonder if its worth adding something like "For up to date syntax make sure to check out your installations syntax generator" or something
Sorry for the late reply. I fully understand that it is impossible to keep years of blog posts up to date. Unfortunately these blog posts come up in search results so the amount of posts with (partially) no-longer-correct or no-longer-best-practice information is outweighing the number of posts with up-to-date information.
Perhaps outdated blog posts should be archived so they don't show up in search results? However I was unable to find another document describing how to capture the various Powershell Streams in a pipeline.
Adding information referring to the syntax generator certainly would be useful for some cases but the example in this ticket is not covered by the syntax generator. It is important that users know that the script block is required in declarative pipelines for bits of code like this.
I have created the PR #5541 which adds a simple note. Does this help in resolving this issue?