-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[New Feature]: Warn before removing an entire package from repo #136983
Comments
[Policy] Area-Validation-Pipelines @stephengillie - Could you please remove the Package-Update and Error-Hash-Mismatch labels? |
Also, out of curiosity, is this something that can be achieved through your automation? Example of it being #136974 (comment) |
Yes, I can build a check that will verify if previous manifest versions exist before removing. Not all approvals go through my system, but most do. We have a ceiling in the form of API calls, but I'm working to mitigate that as well. |
@stephengillie - When querying which versions exist, you could directly interact with the Source.msix package to extract the database file and run queries against that directly. It won’t contain any of the manifest content, but will give you a list of the PackageIdentifiers, versions, publishers, commands, and a few other pieces of data. You could use that to check for the number of parts within a version string, how many versions of a package exist, and it can give you the PathParts required to directly fetch the latest manifest to check for AppsAndFeaturesEntries, all without hitting the GitHub API |
I added a Function Get-ManifestListing {
param(
$PackageIdentifier,
$Version = (Find-WinGetPackage $PackageIdentifier | Where-Object {$_.id -eq $PackageIdentifier}).version,
$Path = ($PackageIdentifier -replace "[.]","/"),
$FirstLetter = ($PackageIdentifier[0].tostring().tolower()),
$Uri = "https://api.github.com/repos/microsoft/winGet-pkgs/contents/manifests/$FirstLetter/$Path/$Version/",
[Switch]$Versions
)
If ($Versions) {
$Uri = "https://api.github.com/repos/microsoft/winGet-pkgs/contents/manifests/$FirstLetter/$Path/"
}
try{
$out = (Invoke-GitHubRequest -Uri $Uri -JSON).name
}catch{
$out = "Error"
}
return $out -replace "$($PackageIdentifier)[.]",""
} I know that I have both |
Script in action: #136730 (comment)
|
It may be faster, but if its pushing you up against your rate limits then it may not be worth it. I think it would be rare that a true race condition where changes which have been merged but not published would impact the results of an index check. In fact, only one comes to mind - When there are two or more versions of a package and they are all being removed, using source.msix wouldn’t update between the removals. But, this race condition still exists querying GitHub directly if the manual checks for both PRs are run close enough together that neither PR is merged before the checks of the other is completed |
@stephengillie suppose I'm removing |
It's true that PS C:\ManVal> Find-WinGetPackage TeamViewer.TeamViewer
Name Id Version Source
---- -- ------- ------
TeamViewer TeamViewer.TeamViewer 15.50.5 winget
TeamViewer Host TeamViewer.TeamViewer.Host 15.50.5 winget Which is why I filter for the exact $Version = (Find-WinGetPackage $PackageIdentifier | Where-Object {$_.id -eq $PackageIdentifier}).version, But the PackageIdentifier itself is parsed directly from user input: $Path = ($PackageIdentifier -replace "[.]","/"), |
Description of the new feature/enhancement
Inspired by #120261 (comment)
If a package only has a single version in the repo, and that is getting removed in a PR, the pipelines should warn the author / moderators in the PR. Most packages that have a single version in the repo are ones that use a "vanity" URL. Because of hash mismatches / 404 URLs, those tend to get auto-removed by wingetbot or other automations set up by community contributors.
This offers a bad UX to end-users that get confused as to why the package was entirely removed from the repo. In reality, the package may simply require an update to address the hash mismatch or URL issue. The validation pipelines should have ways to protect against this scenario. Retaining the package in the repository, albeit with an outdated hash / URL means that the contributors can report against the correct problem and request a package update.
Proposed technical implementation details (optional)
No response
The text was updated successfully, but these errors were encountered: