Skip to content
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

Add database for tracking pins and base implementation for pin commands #2769

Merged
merged 23 commits into from Jan 12, 2023

Conversation

florelis
Copy link
Member

@florelis florelis commented Dec 15, 2022

This adds a database for tracking pins and a basic implementation of the pin commands to add, remove and list them. The implementation for the database is roughly copied from the database for portable packages.

  • Added a new index schema IPinningIndex and a v1.0 implementation for it. The database contains a single table, where each pin is a separate row. The fields for each pin are
    • package ID, source ID - These two form the key used to look up pins
    • pin type - pinning/blocking/gating
    • version - only for gating pins
      A package available from multiple sources could have multiple independent pins. The operations allowed are adding a pin (pin add), updating a pin (pin add --force), removing a pin (pin remove), getting all pins (pin list), resetting all pins (pin reset --force), and getting a single pin (to be used on update/install).
  • Added workflow tasks to implement the pin commands with the basic functionality of adding, removing and querying.

What is missing from this PR:

  • All the logic for version gating
  • Respecting the pins in the install/update/import commands
  • Make the pin commands apply to all sources for a package, instead of a single one
  • Some rules to auto-remove pins (e.g. on uninstall, and maybe at some points if the packages are no longer available/installed).

Related to #476 and #2611 but does not resolve them yet

Microsoft Reviewers: Open in CodeFlow

@florelis
Copy link
Member Author

This thing's full of TODOs, many of them intentionally left for the future, but do tell me if there's any I should resolve for this PR.

@github-actions

This comment has been minimized.

# Conflicts:
#	src/AppInstallerCLITests/AppInstallerCLITests.vcxproj.filters
#	src/AppInstallerCommonCore/AppInstallerCommonCore.vcxproj
#	src/AppInstallerCommonCore/AppInstallerCommonCore.vcxproj.filters
#	src/AppInstallerCommonCore/Public/AppInstallerRuntime.h
@florelis florelis marked this pull request as ready for review December 20, 2022 22:21
@florelis florelis requested a review from a team as a code owner December 20, 2022 22:21
src/AppInstallerCommonCore/Public/winget/Pin.h Outdated Show resolved Hide resolved
src/AppInstallerCLICore/Workflows/PinFlow.cpp Outdated Show resolved Hide resolved
src/AppInstallerCLICore/Workflows/PinFlow.cpp Outdated Show resolved Hide resolved
src/AppInstallerCLICore/Workflows/PinFlow.cpp Show resolved Hide resolved
src/AppInstallerCLICore/Workflows/PinFlow.cpp Outdated Show resolved Hide resolved
src/AppInstallerCLICore/Workflows/PinFlow.cpp Show resolved Hide resolved
Co-authored-by: yao-msft <50888816+yao-msft@users.noreply.github.com>
@github-actions

This comment has been minimized.

@github-actions

This comment was marked as resolved.

florelis and others added 2 commits January 9, 2023 16:25
…nningIndexInterface_1_0.cpp

Co-authored-by: yao-msft <50888816+yao-msft@users.noreply.github.com>
Co-authored-by: yao-msft <50888816+yao-msft@users.noreply.github.com>
@github-actions

This comment has been minimized.

{
Resource::String::SearchId,
Resource::String::SearchSource,
Resource::String::SearchVersion,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resource::String::SearchVersion,

Do you think the column name "Version" should be more specific to indicate it's a gated version?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need it. I believe a user would easily understand what we mean if the header is "Version" and the value is something like "1.2.*". I also didn't actually use "gated version" in any of the resource strings, just in logs and names in the code, so it's not something they'd have seen elsewhere.

Copy link
Contributor

@yao-msft yao-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@florelis florelis merged commit f395a39 into microsoft:master Jan 12, 2023
@florelis florelis deleted the pinningImplementation branch January 12, 2023 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants