Skip to content

The verification logic of VersionValidator is out-of-date #13434

@BethanyZhou

Description

@BethanyZhou

Description

During the process of bumping version, the script will validate existing modules whether indeed need to updated.

Its current logic judges based on checking the required version url of module if exists.

For example, https://www.powershellgallery.com/packages/Az.Accounts/2.1.4 should not exist because the current Az.Accounts version is 2.1.2.

But seems PSGallery changes its behaviour, the url of required module will be redirected to the latest version url of module.

So the httpstatus will always be ok.

private bool DoesUrlExists(string url)
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = WebRequestMethods.Http.Head;
try
{
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
if (response.StatusCode == HttpStatusCode.OK)
{
return true;
}

Maybe we need update the verification logic or skip this step for efficiency.

Cost

Metadata

Metadata

Assignees

Labels

EngineeringP2feature-requestThis issue requires a new behavior in the product in order be resolved.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions