Skip to content
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

Use encodedCommand in Invoke-InNewProcress for P-tests #2267

Merged
merged 1 commit into from Mar 31, 2023

Conversation

fflaten
Copy link
Collaborator

@fflaten fflaten commented Nov 16, 2022

PR Summary

Invoke-InNewProcress helper-method in P-tests is broken in PowerShell 7.3 because 7.3 now keeps the backslash previously used to escape quotes in the provided scriptblock.

Replacing with encodedCommand (base64) to avoid version-specific logic.

Fixes broken CI mentioned in #2264 (comment) . Some runs use prerelease CI-images with PowerShell 7.3 which makes CI inconsistent atm.

PR Checklist

  • PR has meaningful title
  • Summary describes changes
  • PR is ready to be merged
    • If not, use the arrow next to Create Pull Request to mark it as a draft. PR can be marked Ready for review when it's ready.
  • Tests are added/update (if required)
  • Documentation is updated/added (if required)

@fflaten
Copy link
Collaborator Author

fflaten commented Nov 16, 2022

Likely caused by this https://learn.microsoft.com/en-us/powershell/scripting/learn/experimental-features?view=powershell-7.3#psnativecommandargumentpassing

@nohwnd Any issues with using powershell -encodedCommand? Might be flagged by some security teams etc, but this only affects our P-tests so hopefully okay. Let me know if I should switch to a workaround in the link above.

@fflaten
Copy link
Collaborator Author

fflaten commented Nov 16, 2022

Ubuntu 20.04 and Windows 2019 tests ran with the new image with 7.3 = all good.

@fflaten
Copy link
Collaborator Author

fflaten commented Dec 4, 2022

Looks like MS/Github pinned PS 7.2 LTS in newer images atm due to issue like we had, but we should still do something to support future images and local builds using PS7.3+

@fflaten fflaten added the Bug label Mar 30, 2023
@nohwnd nohwnd merged commit 3d05da0 into pester:main Mar 31, 2023
@fflaten fflaten deleted the fix-ci-ps73 branch March 31, 2023 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants