Skip to content

Commit 1dbbf81

Browse files
authored
Fix the issue of using Azure Artifacts (Azure#27497)
1 parent 7f7d547 commit 1dbbf81

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

Diff for: tools/VersionController/Models/ModuleHelper.cs

+6-3
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,21 @@ internal static List<AzurePSVersion> GetAllVersionsFromGallery(string moduleName
4646
{
4747
string repository = System.Environment.GetEnvironmentVariable("DEFAULT_PS_REPOSITORY_NAME");
4848
findModuleScript = @"
49-
$secpasswd = ConvertTo-SecureString $Env:DEFAULT_PS_REPOSITORY_PASSWORD -AsPlainText -Force
50-
$credential = New-Object System.Management.Automation.PSCredential ($Env:DEFAULT_PS_REPOSITORY_USER, $secpasswd)
51-
Find-PSResource -Name " + moduleName + " -Repository " + repository + " -Credential $credential -Prerelease";
49+
$AccessTokenSecureString = $env:SYSTEM_ACCESS_TOKEN | ConvertTo-SecureString -AsPlainText -Force;
50+
$credentialsObject = [pscredential]::new('ONEBRANCH_TOKEN', $AccessTokenSecureString);
51+
Find-PSResource -Name " + moduleName + " -Repository " + repository + " -Credential $credentialsObject -Prerelease";
5252
}
5353
else
5454
{
5555
string repository = "PSGallery";
5656
findModuleScript = $"Find-PSResource -Name {moduleName} -Repository {repository} -Prerelease";
5757
}
58+
59+
System.Console.WriteLine($"Find module script: {findModuleScript}");
5860

5961
powershell.AddScript(findModuleScript);
6062
var cmdletResult = powershell.Invoke();
63+
System.Console.WriteLine($"Cmdlet result count: {cmdletResult.Count}");
6164
foreach (var versionInformation in cmdletResult)
6265
{
6366
System.Console.WriteLine(versionInformation);

Diff for: tools/VersionController/Models/VersionBumper.cs

+1
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ public void BumpAllVersions()
8484
{
8585
_newVersion = IsNewModule() ? _oldVersion : GetBumpedVersion();
8686
}
87+
Console.WriteLine("_assignedVersion: " + _assignedVersion);
8788
if (MinimalVersion != null && MinimalVersion > new AzurePSVersion(_newVersion))
8889
{
8990
Console.WriteLine($"Adjust version from {_newVersion} to {MinimalVersion} due to MinimalVersion.csv");

0 commit comments

Comments
 (0)