-
Notifications
You must be signed in to change notification settings - Fork 388
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
PSScriptAnalyzer 1.24.0 broken in CI/CD pipeline: The term 'Invoke-ScriptAnalyzer' is not recognized as a name of a cmdlet, function, script file, or executable program. #2087
Comments
Confirmed rolling back to 1.23.0 solves the isssue. |
@ggiesen What is your PowerShell version? The minimum PowerShell 7 version also got increased to 7.4.7, which was released on January 23. PowerShell support policy states that a new patch release must be updated to within a month to stay within support, therefore 7.4.7 was chosen as the oldest supported PowerShell 7 release. |
PSGallery still says minimum version is 5.1. I tried using 1.23.0 instead but got an error that it was looking for PowerShell version 7.4.6.500 (which is the same error I see for 1.24.0. Do you know which version of PS Script Analyzer was the last version to work for earlier versions of PowerShell? This is the error I am getting in my pipeline when trying to run Invoke-ScriptAnalyzer: I did just try 1.22.0 as well and got the same error, but this was working a couple of weeks ago. I am starting to suspect that my error may not be related to this new version, but just in case there is a relation I wanted to post it here. (Hopefully final edit): I realized that it must have still been seeing the newer version and so specified to import version 1.22.0 (as well as the install specifically). This now made my pipeline work. |
7.4.2, which is the version in the 'latest' powershell container image in the Microsoft Artifact Registry: https://mcr.microsoft.com/en-us/artifact/mar/powershell/about |
@bergmeister @andyleejordan there is no powershell 7.4.7 docker container.
Why did you include a breaking change in a minor version release? |
The minimum version overall is 5.1, which is also known as Windows PowerShell. The minimum PowerShell 7.x (used to be called Core) version is 7.4.7 by reference of the System.Management.Automation, it might allow up down to 7.4.6 but this version isn't recommended anyway as already out of support as all PowerShell 7.x version need to be on the latest patch version within a month of release |
Then I suggest to open an issue in PowerShell because my understanding is that each nee patch version needs to be updated to within a month and therefore don't see why PSScriptAnalyzer should support them. cc @andyleejordan @StevenBucher98 @SydneyhSmith
|
If you look at past releases, most of the have breaking changes and don't remember that it was ever declared that semantic versioning is followed, hence the major version of 1 as breaking changes weren't big enough or new feature sets that different. The reason why this breaking change was made after many years of delay is that there a)is a very small subset of users affected by it and b) users can choose alternatives, such as running it on another PowerShell version by using PowerShell 7 or another machine and compatibility rules have been added to lint specifically on older PS versions
|
@bergmeister to clarify, PSScriptAnalyzer 1.24.0 is currently broken for all powershell docker users. |
On a side note, your pipeline will complete faster and possibly even avoid this issue if you run all three of those commands in a single PowerShell instance (instead of running pwsh three times). Try using this instead. (I also added NoProfile to the pwsh execution and explicitly specified the PSGallery repository to reduce noise in the verbose output.) pwsh -NoProfile -Command { Set-PSRepository -ErrorAction Stop -InstallationPolicy Trusted -Name PSGallery -Verbose ; Install-Module -Name PSScriptAnalyzer -Repository PSGallery -Verbose ; Invoke-ScriptAnalyzer -EnableExit -Recurse -Path . } |
@ggiesen @floh96 @colinwebster-hc |
This bump is unnecessary as it also break existing pipeline... I had to pin script analyzer version at 1.23.0 for now. |
Hi all, finally I could at least share with you about the Docker images being out of date.
Please see PowerShell/Announcements#75 And I confirmed following those instructions will yield up-to-date Docker images you can drop into your pipeline, both stable and LTS:
As for updating the SDK package, my hands are a bit tied. I need to keep dependencies updated, and this being a dev tool, I can't reasonably ask for an exception not to update to our minimum supported version. I'm sorry about that! |
Before submitting a bug report:
Steps to reproduce
Expected behavior
Actual behavior
If an unexpected error was thrown then please report the full error details using e.g.
$error[0] | Select-Object *
Environment data
Using mcr.microsoft.com/powershell:latest container
The text was updated successfully, but these errors were encountered: