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 support for remaining manifest v1.1 fields #1427

Merged
merged 11 commits into from
Sep 4, 2021

Conversation

yao-msft
Copy link
Contributor

@yao-msft yao-msft commented Sep 2, 2021

Change

  • Added more fields to manifest v1.1 schema
  • Added yaml parsing support for new fields
  • Added rest support for new fields

Validation

Added unit tests and also tested manually.

Microsoft Reviewers: Open in CodeFlow

@yao-msft yao-msft requested a review from a team as a code owner September 2, 2021 04:45
},
"AppsAndFeaturesEntries": {
"$ref": "#/definitions/AppsAndFeaturesEntries"
},
"Installers": {
"type": "array",
Copy link
Contributor

@jedieaston jedieaston Sep 2, 2021

Choose a reason for hiding this comment

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

Should the length of the installers array be bumped to 1024 here, per #967? #Resolved

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, thanks for catching that!

@denelon denelon linked an issue Sep 2, 2021 that may be closed by this pull request
"type": [ "boolean", "null" ],
"description": "Indicates whether the installer requires an install location provided"
},
"RequireExplicitUpgrade": {
Copy link
Contributor Author

@yao-msft yao-msft Sep 2, 2021

Choose a reason for hiding this comment

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

RequireExplicitUpgrade

Also add RequireElevation field #Resolved

Copy link
Member

Choose a reason for hiding this comment

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

I think we need an enum for that, but I cannot remember exactly the reasoning for that. But at least at a minimum there are both elevation required installers and elevation rejecting installers. So it would be better to have an enum value that we can set ElevationBehavior or something like that.

Copy link
Member

Choose a reason for hiding this comment

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

More thoughts on values for it:

ElevationRequired // intended to indicate that the caller must be elevated because the installer will not elevate itself
ElevatesSelf
RestrictsSelf // Better word than restrict?
RestrictedRequired

Then we could add more as we find need of them. For instance ElevationRequiredForSilent was a problem for MSI before we fixed it, but I know that for instance WebView2 falls into this category currently. It self elevates for its normal unattended pattern, but does not for a silent install (basically same as msiexec behavior).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Per offline chat, we'll do an enum of elevationRequired, elevationProhibited and elevatesSelf

Copy link
Member

@JohnMcPMS JohnMcPMS left a comment

Choose a reason for hiding this comment

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

Didn't look at REST code; letting @ashpatil-msft look at that part.


if (manifestVersion >= ManifestVer{ s_ManifestVersionV1_1 })
{
std::vector<FieldProcessInfo> fields_v1_1 =
Copy link
Member

@JohnMcPMS JohnMcPMS Sep 3, 2021

Choose a reason for hiding this comment

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

I don't see anywhere that we are limiting what the server will accept. Letting manifests into winget-pkgs when the feature behind them has not yet been implemented will likely lead to failures. Either now because someone relies on it for a package and it doesn't actually do anything or in the future when we start using it and find that we wanted validation to prevent some case that is now already present.

It feels like we should have:

  1. Add new version to client to allow for local testing; full validation fails if any 1.1 fields are present even if manifest is 1.1
  2. As we add functionality and validation, we start allowing fields that are ready #Resolved

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Evaluated 1 by 1 offline and we're ok with them for now

constexpr std::string_view Markets = "Markets"sv;
constexpr std::string_view AllowedMarkets = "AllowedMarkets"sv;
constexpr std::string_view ExcludedMarkets = "ExcludedMarkets"sv;
constexpr std::string_view ElevationRequirement = "ElevationRequirement"sv;
Copy link
Contributor

Choose a reason for hiding this comment

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

ElevationRequirement

Didnt see this in the Rest Schema 1.1. Was this missed and needs to be added there?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this(From comments above) and expected return codes(Flor's) are 2 new fields added after our v1.1 schema review meeting, we'll have to update the rest spec later.

installer.Markets.ExcludedMarkets = V1_0::Json::ManifestDeserializer::ConvertToManifestStringArray(
JsonHelper::GetRawStringArrayFromJsonNode(marketsNode.value().get(), JsonHelper::GetUtilityString(ExcludedMarkets)));
installer.Markets.AllowedMarkets = V1_0::Json::ManifestDeserializer::ConvertToManifestStringArray(
JsonHelper::GetRawStringArrayFromJsonNode(marketsNode.value().get(), JsonHelper::GetUtilityString(AllowedMarkets)));
Copy link
Contributor

@ashpatil-msft ashpatil-msft Sep 3, 2021

Choose a reason for hiding this comment

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

Do we throw error if both are given?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it's in the manifestvalidation.cpp

Copy link
Contributor

@ashpatil-msft ashpatil-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:

@yao-msft yao-msft merged commit 3a4d007 into microsoft:master Sep 4, 2021
@yao-msft yao-msft deleted the manifest110merged branch September 4, 2021 00:05
@denelon denelon linked an issue Sep 17, 2021 that may be closed by this pull request
@denelon denelon linked an issue Oct 1, 2021 that may be closed by this pull request
2 tasks
@denelon
Copy link
Contributor

denelon commented Oct 1, 2021

Related to #1243

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment