Azure / azure-sdk-tools

Tools repository leveraged by the Azure SDK team.
MIT License
112 stars 177 forks source link

Use pre-installed Az PowerShell module rather than downloading from PSGallery #1051

Closed scbedd closed 3 years ago

scbedd commented 4 years ago

Last night we saw the following error.

Now, the pshell installer module already retries an download/install 3 times if it hits an exception. The issue here is that the repository threw a false-negative, which ended up crashing our pipeline.

Whether wrapping the entire script in a retry-loop is the solution, I'll leave up to the implementer.

weshaggard commented 4 years ago

This goes a little larger then smok-tests I've see it fail for normal live test runs as well. We need to come up with some way to reduce this error path when powershell gallery isn't responsive.

weshaggard commented 4 years ago

Looks like at least hosted image already includes these PS modules (https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md#azure-powershell-modules) and we should try to use those instead of always doing a force install. From a quick look it seems windows and linux have 4.7 and mac has 4.6.1 and as long as those versions are enough we should just use those instead of install anything.

weshaggard commented 4 years ago

@heaths do you remember why we do a force install? (https://github.com/Azure/azure-sdk-tools/blob/master/eng/common/TestResources/setup-az-modules.yml#L24) as opposed to using the versions on the machine?

heaths commented 4 years ago

The force install has nothing to do with overriding what's installed. It's because you're prompted, by default, unless you pass -Force. If you want to use what's there, first do a get-module -list <whatever> to see if it's installed and, if not, you can install it. When I wrote these, I didn't realize the modules were on the image.

mikeharder commented 3 years ago

Fixed by #1137