From 800b8a3b76674bec82aeb843e7392a3b96fd26bc Mon Sep 17 00:00:00 2001 From: Ben Broderick Phillips Date: Wed, 29 Jun 2022 16:15:24 -0400 Subject: [PATCH] Only update/override powershell module path when in CI on module script import --- eng/common/scripts/Helpers/PSModule-Helpers.ps1 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/eng/common/scripts/Helpers/PSModule-Helpers.ps1 b/eng/common/scripts/Helpers/PSModule-Helpers.ps1 index fae40d650e4f..1a2a0a90083e 100644 --- a/eng/common/scripts/Helpers/PSModule-Helpers.ps1 +++ b/eng/common/scripts/Helpers/PSModule-Helpers.ps1 @@ -1,7 +1,7 @@ $DefaultPSRepositoryUrl = "https://www.powershellgallery.com/api/v2" $global:CurrentUserModulePath = "" -function Update-PSModulePath() +function Update-PSModulePathForCI() { # Information on PSModulePath taken from docs # https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_psmodulepath @@ -101,4 +101,6 @@ function Install-ModuleIfNotInstalled() return $modules[0] } -Update-PSModulePath +if ($null -ne $env:SYSTEM_TEAMPROJECTID) { + Update-PSModulePathForCI +}