RamblingCookieMonster / BuildHelpers

Helper functions for PowerShell CI/CD scenarios
MIT License
215 stars 47 forks source link

Fix(Invoke-Git.ps1): Add support for network drives #69

Closed JefeDavis closed 2 years ago

JefeDavis commented 6 years ago

This commit would allow Invoke-Git to be used with PSDrives and network drives

RamblingCookieMonster commented 6 years ago

Hiyo!

Good catch, makes sense to me. Leaving this open for another day or two, will merge if there are no objections.

Cheers!

JefeDavis commented 5 years ago

Thanks man! I also added support for modules with powercli dependencies in runspaces, usually it errors out saying the drives are already in use, reimporting does the trick for some reason

JefeDavis commented 5 years ago

Hey there! Wondering if we can get this merged soon

RamblingCookieMonster commented 5 years ago

Hiyo! Sorry, I’m slow!

On a phone, my only concern was how PowerShell handles types in catch statements. Would that cause any trouble in a system without PowerCLI (or whatever module that comes from), in the odd event that it errored and hit the catch? Will do a quick test early this week if I find time!

JefeDavis commented 5 years ago

My reasoning was that the catch just retries the import again which if for some reason that didn't work, it would fail to import the module and error out the same way it does now. And the catch itself is tied to the specific exception of drives being already in use, so if another module has that same issue this fix would either work for them or they would be in the same situation as they already are

JefeDavis commented 5 years ago

Hey there! Just wondering if there's any update, waiting on these changes for my build pipeline

JefeDavis commented 5 years ago

Hey @RamblingCookieMonster just wanted to know if this can be merged soon, I'd like to start using it in my pipeline but it's unusable without this fix

RamblingCookieMonster commented 5 years ago

Hiyo! Yeah, figured this would be the case - if a system doesn't have PowerCLI, that code will complain if any error is thrown, given that VMware.VimAutomation.ViCore.Cmdlets.Provider.Exceptions.DriveException doesn't exist.

Feel free to submit the PR without that error handling, or with modified error handling that detects $_s type name in the catch block (not with the built in language, just use an if statement or something like that), and runs again if it was VMware.VimAutomation.ViCore.Cmdlets.Provider.Exceptions.DriveException.

Cheers!

JefeDavis commented 5 years ago

Something like that?

JefeDavis commented 5 years ago

looks like AppVeyor is having some issues

RamblingCookieMonster commented 5 years ago

Closer! That still fails - instead of using types, just need to use strings, e.g. something like this might work in the catch block:

$_.gettype().fullname -eq 'VMware.VimAutomation.ViCore.Cmdlets.Provider.Exceptions.DriveException'

JefeDavis commented 5 years ago

I think i have it now, what do you think?

JefeDavis commented 5 years ago

Hey there! Any chance we can merge this?

JefeDavis commented 5 years ago

Hey there! Any update on if we can merge this?

JefeDavis commented 5 years ago

Hey @RamblingCookieMonster, Just wondering if we can merge this now?