Skip to content

Add support for remaining manifest v1.1 fields - #1427

Merged
yao-msft merged 11 commits into
microsoft:masterfrom
yao-msft:manifest110merged
Sep 4, 2021
Merged

yao-msft merged 11 commits into
microsoft:masterfrom
yao-msft:manifest110merged

Conversation

@yao-msft

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

Copy link
Copy Markdown
Contributor

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
"$ref": "#/definitions/AppsAndFeaturesEntries"
},
"Installers": {
"type": "array",

@jedieaston Easton Pillay (jedieaston) Sep 2, 2021 •

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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 Demitrius Nelon (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": {

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

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

@JohnMcPMS JohnMcPMS left a comment

Copy link
Copy Markdown
Member

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 Ashwini Patil (@ashpatil-msft) look at that part.


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

@JohnMcPMS JohnMcPMS Sep 3, 2021 •

Copy link
Copy Markdown
Member

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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)));

@ashpatil-msft Ashwini Patil (ashpatil-msft) Sep 3, 2021 •

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

:shipit:

@denelon

Copy link
Copy Markdown
Collaborator

Related to #1243

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

Labels

None yet

Projects

None yet

5 participants