Skip to content

Comment out the logic of geting gallery version. #12144

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 16, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 51 additions & 49 deletions tools/VersionController/Models/VersionBumper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,11 @@ public void BumpAllVersions()
public Tuple<string, bool> GetOldVersion()
{
string version;
string localVersion = null, psVersion = null, testVersion = null;
string localVersion = null;
// string localVersion = null, psVersion = null, testVersion = null;
bool isPreview;
bool localPreview = false, psPreview = false, testPreview = false;
bool localPreview = false;
// bool localPreview = false, psPreview = false, testPreview = false;
var moduleName = _fileHelper.ModuleName;

using (PowerShell powershell = PowerShell.Create())
Expand All @@ -98,53 +100,53 @@ public Tuple<string, bool> GetOldVersion()
version = localVersion;
isPreview = localPreview;

using (PowerShell powetshell = PowerShell.Create())
{
powetshell.AddScript("Register-PackageSource -Name PSGallery -Location https://www.powershellgallery.com/api/v2 -ProviderName PowerShellGet");
powetshell.AddScript("Find-Module -Name " + moduleName + " -AllowPrerelease -Repository PSGallery -AllVersions");
var cmdletResult = powetshell.Invoke();
if (cmdletResult.Count != 0)
{
var psVersionImformation = cmdletResult[0].ToString();
Regex reg = new Regex("Version=(.*?)(-|;)");
Match match = reg.Match(psVersionImformation);
psVersion = match.Groups[1].Value;
psPreview = Regex.IsMatch(psVersionImformation, "preview");
}
}
if (psVersion == null)
{
psVersion = "0.1.0";
}
if (new AzurePSVersion(psVersion) > new AzurePSVersion(version))
{
version = psVersion;
isPreview = psPreview;
}

using (PowerShell powetshell = PowerShell.Create())
{
powetshell.AddScript("Register-PackageSource -Name TestGallery -Location https://www.poshtestgallery.com/api/v2 -ProviderName PowerShellGet");
powetshell.AddScript("Find-Module -Name " + moduleName + " -AllowPrerelease -Repository TestGallery -AllVersions");
var cmdletResult = powetshell.Invoke();
if (cmdletResult.Count != 0)
{
var testVersionImformation = cmdletResult[0].ToString();
Regex reg = new Regex("Version=(.*?)(-|;)");
Match match = reg.Match(testVersionImformation);
testVersion = match.Groups[1].Value;
testPreview = Regex.IsMatch(testVersionImformation, "preview");
}
}
if (testVersion == null)
{
testVersion = "0.1.0";
}
if (new AzurePSVersion(testVersion) > new AzurePSVersion(version))
{
version = testVersion;
isPreview = testPreview;
}
// using (PowerShell powetshell = PowerShell.Create())
// {
// powetshell.AddScript("Register-PackageSource -Name PSGallery -Location https://www.powershellgallery.com/api/v2 -ProviderName PowerShellGet");
// powetshell.AddScript("Find-Module -Name " + moduleName + " -AllowPrerelease -Repository PSGallery -AllVersions");
// var cmdletResult = powetshell.Invoke();
// if (cmdletResult.Count != 0)
// {
// var psVersionImformation = cmdletResult[0].ToString();
// Regex reg = new Regex("Version=(.*?)(-|;)");
// Match match = reg.Match(psVersionImformation);
// psVersion = match.Groups[1].Value;
// psPreview = Regex.IsMatch(psVersionImformation, "preview");
// }
// }
// if (psVersion == null)
// {
// psVersion = "0.1.0";
// }
// if (new AzurePSVersion(psVersion) > new AzurePSVersion(version))
// {
// version = psVersion;
// isPreview = psPreview;
// }

// using (PowerShell powetshell = PowerShell.Create())
// {
// powetshell.AddScript("Register-PackageSource -Name TestGallery -Location https://www.poshtestgallery.com/api/v2 -ProviderName PowerShellGet");
// powetshell.AddScript("Find-Module -Name " + moduleName + " -AllowPrerelease -Repository TestGallery -AllVersions");
// var cmdletResult = powetshell.Invoke();
// if (cmdletResult.Count != 0)
// {
// var testVersionImformation = cmdletResult[0].ToString();
// Regex reg = new Regex("Version=(.*?)(-|;)");
// Match match = reg.Match(testVersionImformation);
// testVersion = match.Groups[1].Value;
// testPreview = Regex.IsMatch(testVersionImformation, "preview");
// }
// }
// if (testVersion == null)
// {
// testVersion = "0.1.0";
// }
// if (new AzurePSVersion(testVersion) > new AzurePSVersion(version))
// {
// version = testVersion;
// isPreview = testPreview;
// }

return Tuple.Create(version, isPreview);
}
Expand Down