Comment out use of username/password in PowerShell script
This is getting flagged as an error by the PowerShell script analyzer.
This commit is contained in:
Родитель
791fbeea1f
Коммит
551eeb3d8f
|
@ -35,66 +35,66 @@ Set-StrictMode -Version 2.0
|
|||
. $PSScriptRoot\tools.ps1
|
||||
|
||||
# Add source entry to PackageSources
|
||||
function AddPackageSource($sources, $SourceName, $SourceEndPoint, $creds, $Username, $Password) {
|
||||
$packageSource = $sources.SelectSingleNode("add[@key='$SourceName']")
|
||||
|
||||
if ($packageSource -eq $null)
|
||||
{
|
||||
$packageSource = $doc.CreateElement("add")
|
||||
$packageSource.SetAttribute("key", $SourceName)
|
||||
$packageSource.SetAttribute("value", $SourceEndPoint)
|
||||
$sources.AppendChild($packageSource) | Out-Null
|
||||
}
|
||||
else {
|
||||
Write-Host "Package source $SourceName already present."
|
||||
}
|
||||
|
||||
AddCredential -Creds $creds -Source $SourceName -Username $Username -Password $Password
|
||||
}
|
||||
#function AddPackageSource($sources, $SourceName, $SourceEndPoint, $creds, $Username, $Password) {
|
||||
# $packageSource = $sources.SelectSingleNode("add[@key='$SourceName']")
|
||||
#
|
||||
# if ($packageSource -eq $null)
|
||||
# {
|
||||
# $packageSource = $doc.CreateElement("add")
|
||||
# $packageSource.SetAttribute("key", $SourceName)
|
||||
# $packageSource.SetAttribute("value", $SourceEndPoint)
|
||||
# $sources.AppendChild($packageSource) | Out-Null
|
||||
# }
|
||||
# else {
|
||||
# Write-Host "Package source $SourceName already present."
|
||||
# }
|
||||
#
|
||||
# AddCredential -Creds $creds -Source $SourceName -Username $Username -Password $Password
|
||||
#}
|
||||
|
||||
# Add a credential node for the specified source
|
||||
function AddCredential($creds, $source, $username, $password) {
|
||||
# Looks for credential configuration for the given SourceName. Create it if none is found.
|
||||
$sourceElement = $creds.SelectSingleNode($Source)
|
||||
if ($sourceElement -eq $null)
|
||||
{
|
||||
$sourceElement = $doc.CreateElement($Source)
|
||||
$creds.AppendChild($sourceElement) | Out-Null
|
||||
}
|
||||
#function AddCredential($creds, $source, $username, $password) {
|
||||
# # Looks for credential configuration for the given SourceName. Create it if none is found.
|
||||
# $sourceElement = $creds.SelectSingleNode($Source)
|
||||
# if ($sourceElement -eq $null)
|
||||
# {
|
||||
# $sourceElement = $doc.CreateElement($Source)
|
||||
# $creds.AppendChild($sourceElement) | Out-Null
|
||||
# }
|
||||
#
|
||||
# # Add the <Username> node to the credential if none is found.
|
||||
# $usernameElement = $sourceElement.SelectSingleNode("add[@key='Username']")
|
||||
# if ($usernameElement -eq $null)
|
||||
# {
|
||||
# $usernameElement = $doc.CreateElement("add")
|
||||
# $usernameElement.SetAttribute("key", "Username")
|
||||
# $sourceElement.AppendChild($usernameElement) | Out-Null
|
||||
# }
|
||||
# $usernameElement.SetAttribute("value", $Username)
|
||||
#
|
||||
# # Add the <ClearTextPassword> to the credential if none is found.
|
||||
# # Add it as a clear text because there is no support for encrypted ones in non-windows .Net SDKs.
|
||||
# # -> https://github.com/NuGet/Home/issues/5526
|
||||
# $passwordElement = $sourceElement.SelectSingleNode("add[@key='ClearTextPassword']")
|
||||
# if ($passwordElement -eq $null)
|
||||
# {
|
||||
# $passwordElement = $doc.CreateElement("add")
|
||||
# $passwordElement.SetAttribute("key", "ClearTextPassword")
|
||||
# $sourceElement.AppendChild($passwordElement) | Out-Null
|
||||
# }
|
||||
# $passwordElement.SetAttribute("value", $Password)
|
||||
#}
|
||||
|
||||
# Add the <Username> node to the credential if none is found.
|
||||
$usernameElement = $sourceElement.SelectSingleNode("add[@key='Username']")
|
||||
if ($usernameElement -eq $null)
|
||||
{
|
||||
$usernameElement = $doc.CreateElement("add")
|
||||
$usernameElement.SetAttribute("key", "Username")
|
||||
$sourceElement.AppendChild($usernameElement) | Out-Null
|
||||
}
|
||||
$usernameElement.SetAttribute("value", $Username)
|
||||
|
||||
# Add the <ClearTextPassword> to the credential if none is found.
|
||||
# Add it as a clear text because there is no support for encrypted ones in non-windows .Net SDKs.
|
||||
# -> https://github.com/NuGet/Home/issues/5526
|
||||
$passwordElement = $sourceElement.SelectSingleNode("add[@key='ClearTextPassword']")
|
||||
if ($passwordElement -eq $null)
|
||||
{
|
||||
$passwordElement = $doc.CreateElement("add")
|
||||
$passwordElement.SetAttribute("key", "ClearTextPassword")
|
||||
$sourceElement.AppendChild($passwordElement) | Out-Null
|
||||
}
|
||||
$passwordElement.SetAttribute("value", $Password)
|
||||
}
|
||||
|
||||
function InsertMaestroPrivateFeedCredentials($Sources, $Creds, $Username, $Password) {
|
||||
$maestroPrivateSources = $Sources.SelectNodes("add[contains(@key,'darc-int')]")
|
||||
|
||||
Write-Host "Inserting credentials for $($maestroPrivateSources.Count) Maestro's private feeds."
|
||||
|
||||
ForEach ($PackageSource in $maestroPrivateSources) {
|
||||
Write-Host "`tInserting credential for Maestro's feed:" $PackageSource.Key
|
||||
AddCredential -Creds $creds -Source $PackageSource.Key -Username $Username -Password $Password
|
||||
}
|
||||
}
|
||||
#function InsertMaestroPrivateFeedCredentials($Sources, $Creds, $Username, $Password) {
|
||||
# $maestroPrivateSources = $Sources.SelectNodes("add[contains(@key,'darc-int')]")
|
||||
#
|
||||
# Write-Host "Inserting credentials for $($maestroPrivateSources.Count) Maestro's private feeds."
|
||||
#
|
||||
# ForEach ($PackageSource in $maestroPrivateSources) {
|
||||
# Write-Host "`tInserting credential for Maestro's feed:" $PackageSource.Key
|
||||
# #AddCredential -Creds $creds -Source $PackageSource.Key -Username $Username -Password $Password
|
||||
# }
|
||||
#}
|
||||
|
||||
function EnablePrivatePackageSources($DisabledPackageSources) {
|
||||
$maestroPrivateSources = $DisabledPackageSources.SelectNodes("add[contains(@key,'darc-int')]")
|
||||
|
@ -144,18 +144,18 @@ if ($disabledSources -ne $null) {
|
|||
$userName = "dn-bot"
|
||||
|
||||
# Insert credential nodes for Maestro's private feeds
|
||||
InsertMaestroPrivateFeedCredentials -Sources $sources -Creds $creds -Username $userName -Password $Password
|
||||
#InsertMaestroPrivateFeedCredentials -Sources $sources -Creds $creds -Username $userName -Password $Password
|
||||
|
||||
$dotnet31Source = $sources.SelectSingleNode("add[@key='dotnet3.1']")
|
||||
if ($dotnet31Source -ne $null) {
|
||||
AddPackageSource -Sources $sources -SourceName "dotnet3.1-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal/nuget/v2" -Creds $creds -Username $userName -Password $Password
|
||||
AddPackageSource -Sources $sources -SourceName "dotnet3.1-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal-transport/nuget/v2" -Creds $creds -Username $userName -Password $Password
|
||||
#AddPackageSource -Sources $sources -SourceName "dotnet3.1-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal/nuget/v2" -Creds $creds -Username $userName -Password $Password
|
||||
#AddPackageSource -Sources $sources -SourceName "dotnet3.1-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal-transport/nuget/v2" -Creds $creds -Username $userName -Password $Password
|
||||
}
|
||||
|
||||
$dotnet5Source = $sources.SelectSingleNode("add[@key='dotnet5']")
|
||||
if ($dotnet5Source -ne $null) {
|
||||
AddPackageSource -Sources $sources -SourceName "dotnet5-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet5-internal/nuget/v2" -Creds $creds -Username $userName -Password $Password
|
||||
AddPackageSource -Sources $sources -SourceName "dotnet5-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet5-internal-transport/nuget/v2" -Creds $creds -Username $userName -Password $Password
|
||||
#AddPackageSource -Sources $sources -SourceName "dotnet5-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet5-internal/nuget/v2" -Creds $creds -Username $userName -Password $Password
|
||||
#AddPackageSource -Sources $sources -SourceName "dotnet5-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet5-internal-transport/nuget/v2" -Creds $creds -Username $userName -Password $Password
|
||||
}
|
||||
|
||||
$doc.Save($filename)
|
||||
|
|
Загрузка…
Ссылка в новой задаче