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 rest api 1.1 interface #1396

Merged
merged 22 commits into from
Aug 31, 2021
Merged

Conversation

yao-msft
Copy link
Contributor

@yao-msft yao-msft commented Aug 24, 2021

  • Added support for market
  • Added support for source agreements
  • Added support for msstore type
  • Minor changes to workflow ui

Next pr will be the manifest v1.1 integration.

Microsoft Reviewers: Open in CodeFlow

@yao-msft yao-msft requested a review from a team as a code owner August 24, 2021 20:16
@ashpatil-msft
Copy link
Contributor

ashpatil-msft commented Aug 27, 2021

        bool Add(SourceDetails& details, IProgressCallback&) override final

I thought we spoke that Add would also make a call to /information endpoint. Isnt that the case? or is it something that will be added later?


In reply to: 907442626


In reply to: 907442626


In reply to: 907442626


In reply to: 907442626


In reply to: 907442626


Refers to: src/AppInstallerRepositoryCore/Rest/RestSourceFactory.cpp:27 in 3a19d8f. [](commit_id = 3a19d8f, deletion_comment = False)

@ashpatil-msft
Copy link
Contributor

        bool Add(SourceDetails& details, IProgressCallback&) override final

Just saw you are having a workflow task


In reply to: 907442626


Refers to: src/AppInstallerRepositoryCore/Rest/RestSourceFactory.cpp:27 in 3a19d8f. [](commit_id = 3a19d8f, deletion_comment = False)

@@ -78,7 +79,22 @@ namespace AppInstaller::CLI
Workflow::EnsureRunningAsAdmin <<
Workflow::GetSourceList <<
Workflow::CheckSourceListAgainstAdd <<
Workflow::AddSource;
Workflow::AddSource <<
Workflow::OpenSourceForSourceAdd <<
Copy link
Contributor

@ashpatil-msft ashpatil-msft Aug 27, 2021

Choose a reason for hiding this comment

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

OpenSourceForSourceAdd

Why not call OpenSource workflow task? #Resolved

Copy link
Member

Choose a reason for hiding this comment

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

Indeed, this workflow is awkward. If the process crashes then the source can be left configured (but presumably not accepted).

I would think it possible to OpenSourceFromDetails in order to work with the agreement, then add the source with an indication of acceptance.

@@ -56,6 +57,7 @@ namespace AppInstaller::CLI
Workflow::ReportExecutionStage(Workflow::ExecutionStage::Discovery) <<
Workflow::OpenSource <<
Workflow::OpenCompositeSource(Repository::PredefinedSource::Installed) <<
Workflow::HandleSourceAgreements <<
Copy link
Member

@JohnMcPMS JohnMcPMS Aug 27, 2021

Choose a reason for hiding this comment

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

If this is just going to have to go in after every source open, should it not just be part of the workflow task itself. #Resolved

@@ -78,7 +79,22 @@ namespace AppInstaller::CLI
Workflow::EnsureRunningAsAdmin <<
Workflow::GetSourceList <<
Workflow::CheckSourceListAgainstAdd <<
Workflow::AddSource;
Workflow::AddSource <<
Workflow::OpenSourceForSourceAdd <<
Copy link
Member

Choose a reason for hiding this comment

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

Indeed, this workflow is awkward. If the process crashes then the source can be left configured (but presumably not accepted).

I would think it possible to OpenSourceFromDetails in order to work with the agreement, then add the source with an indication of acceptance.

@@ -653,6 +673,12 @@ namespace AppInstaller::CLI::Workflow
}

void ReportManifestIdentity(Execution::Context& context)
Copy link
Member

@JohnMcPMS JohnMcPMS Aug 27, 2021

Choose a reason for hiding this comment

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

In what cases are we now not reporting the version? #Pending

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Mainly show command will handle versioning differently depending on what arguments are passed in

std::vector<ValidationError> ValidateManifest(const Manifest& manifest);
void ValidateManifestLocalization(const ManifestVer& manifestVersion, const ManifestLocalization& localization, std::vector<ValidationError>& resultErrors);
// validateForRead: bool indicating the validation is performed during reading a manifest, which is less restrictive
std::vector<ValidationError> ValidateManifest(const Manifest& manifest, bool validateForRead = false);
Copy link
Member

@JohnMcPMS JohnMcPMS Aug 27, 2021

Choose a reason for hiding this comment

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

I thought that we called that fullValidation before. It this different? #Resolved

std::vector<std::string> UnsupportedQueryParameters;
std::vector<std::string> RequiredQueryParameters;

std::string GetErrorFieldsMessage(const std::vector<std::string>& input) const noexcept
Copy link
Member

@JohnMcPMS JohnMcPMS Aug 27, 2021

Choose a reason for hiding this comment

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

These should be moved to cpp. #Resolved

}

return "UnknownMatchField"sv;
}

inline PackageMatchField StringToPackageMatchField(std::string_view field)
Copy link
Member

@JohnMcPMS JohnMcPMS Aug 27, 2021

Choose a reason for hiding this comment

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

Both should be moved to cpp as well. #Resolved

Label(std::move(label)), Text(std::move(text)), Url(std::move(url)) {}
};

struct SourceInformation
Copy link
Member

@JohnMcPMS JohnMcPMS Aug 27, 2021

Choose a reason for hiding this comment

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

Comment on what this is. #Resolved

@@ -190,4 +226,10 @@ namespace AppInstaller::Repository
// Return value indicates whether the named source was found.
// Passing an empty string drops all sources.
bool DropSource(std::string_view name);

// Checks the source agreements and return a list that needs user acceptance.
std::vector<SourceDetails> CheckSourceAgreements(const std::vector<SourceDetails>& sources);
Copy link
Member

@JohnMcPMS JohnMcPMS Aug 27, 2021

Choose a reason for hiding this comment

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

Why do these operate on vectors? You can get all of the sources from GetAvailableSources and can operate on them one at a time. #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.

Per offline chat, we'll make agreement checking one by one

};

// List of fields that require user agreements.
enum class ImplicitAgreementField : int
Copy link
Member

@JohnMcPMS JohnMcPMS Aug 27, 2021

Choose a reason for hiding this comment

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

If this is to be a flags enum, you should call that out. I would even suggest in the name. #Resolved

<value>Do you agree to all the source agreements terms?</value>
</data>
<data name="SourceAgreementsNotAgreedTo" xml:space="preserve">
<value>Source agreements not agreed to. Execution cancelled.</value>
Copy link
Contributor Author

@yao-msft yao-msft Aug 27, 2021

Choose a reason for hiding this comment

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

Source agreements not agreed to. Execution cancelled.<

please agree or remove #Resolved

{
if (version == Version_1_0_0)
{
return std::make_unique<Schema::V1_0::Interface>(api);
}

else if (version == Version_1_1_0)
Copy link
Contributor

@ashpatil-msft ashpatil-msft Aug 30, 2021

Choose a reason for hiding this comment

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

version == Version_1_1_0)

We should make this >= 1.1.0 and < 1.2.0 no? Because if we make a 1.1.* change, we should support it with this client #Resolved

continue;
}

if (searchRequest.Filters.end() != std::find_if(searchRequest.Filters.begin(), searchRequest.Filters.end(), [&](const PackageMatchFilter& filter) { return filter.Field == matchField; }))
Copy link
Contributor

@ashpatil-msft ashpatil-msft Aug 30, 2021

Choose a reason for hiding this comment

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

searchRequest.Filters

For searchRequest inclusions, should we modify the search request to not have the unsupported package Match fields? #Resolved

{
if (WI_IsFlagSet(context.GetFlags(), Execution::ContextFlag::SkipAgreementsAcceptance))
Copy link
Contributor

@jamespik jamespik Aug 30, 2021

Choose a reason for hiding this comment

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

Why is this an option?

I understand command line to auto accept agreement, but one should never be able to add a source and SKIP the agreement? #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.

SkipAgreementAcceptance is not a command line option, it's a flag set by ComContext, where for Com flow, we should skip agreement checks

Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps we shouldn't call this skip agreements, but something like "User already agreed to agreements".

Copy link
Contributor

Choose a reason for hiding this comment

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

@denelon RE naming.

Copy link
Contributor

Choose a reason for hiding this comment

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

Naming things is hard. I'm not sure how one would "read" this code. I agree we don't want this to be perceived as a way to programmatically skip agreements. I think the intent is either to indicate that we don't need to prompt because the agreement had already been accepted by the user or by the IT Administrator when set by policy.

AgreementPreviouslyAccepted ?

<data name="LicenseNotAgreedTo" xml:space="preserve">
<value>License not agreed to. Installation cancelled.</value>
<data name="PackageAgreementsNotAgreedTo" xml:space="preserve">
<value>Package agreements not agreed to. Execution cancelled.</value>
Copy link
Contributor

@jamespik jamespik Aug 30, 2021

Choose a reason for hiding this comment

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

"Execution cancelled" seems like a wierd way to phrase this to me. #Resolved

Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps "Operation"?

<value>Failed to open the added source</value>
</data>
<data name="AcceptSourceAgreementsArgumentDescription" xml:space="preserve">
<value>Accept all source agreements during source operations</value>
Copy link
Contributor

@jamespik jamespik Aug 30, 2021

Choose a reason for hiding this comment

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

Some of these have ending punctuation. others do not. Intended? #ByDesign

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This one is for argument description, it aligns with other argument description, it does not have the ending period.

@ghost ghost added Needs-Author-Feedback Issue needs attention from issue or PR author and removed Needs-Author-Feedback Issue needs attention from issue or PR author labels Aug 30, 2021
<value>Do you agree to all the source agreements terms?</value>
</data>
<data name="SourceAgreementsNotAgreedTo" xml:space="preserve">
<value>One or more of the source agreements not agreed to. Operation cancelled. Please accept the source agreements or remove the corresponding sources.</value>
Copy link
Contributor

Choose a reason for hiding this comment

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

are?

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 3a12003 into microsoft:master Aug 31, 2021
sreadingMSFT added a commit to sreadingMSFT/winget-cli that referenced this pull request Aug 31, 2021
* Fix bad merge (microsoft#1408)

* Add support for rest api 1.1 interface (microsoft#1396)

Added support for market
Added support for source agreements
Added support for msstore type
Minor changes to workflow ui
Next pr will be the manifest v1.1 integration.

* Remove the packagedAPI experimental feature flag (microsoft#1419)

* Integrating custom header with V1.1 changes (microsoft#1422)

Integrating custom header with V1.1 changes

* Expose pass through header through com interface. (microsoft#1420)

* Add custom header.

* Update behavior for composites.

* Revert line ending changes.

* Add comment.

* Update composite behavior.

* Fix error code

* Update Loggers to support multiple Win32 app installs in single process (microsoft#1399)

* Update Loggers to support multi threaded processing of Win32 app install requests in WPMServer

Co-authored-by: JohnMcPMS <[email protected]>
Co-authored-by: yao-msft <[email protected]>
Co-authored-by: Ashwini Patil <[email protected]>
Co-authored-by: sachintaMSFT <[email protected]>
@denelon denelon linked an issue Aug 31, 2021 that may be closed by this pull request
@denelon
Copy link
Contributor

denelon commented Oct 1, 2021

Related to #1243

@denelon denelon linked an issue Oct 1, 2021 that may be closed by this pull request
@denelon denelon mentioned this pull request Oct 1, 2021
sreadingMSFT added a commit that referenced this pull request Oct 20, 2021
…1373)

* Add c# in proc winrt wrapper and projection

* Add wrapper implementation and project

* Override factory to return objects.

* Fix unreferenced parameters.

* Guid name updates.

* Undo unneccessary changes.

* Remove projection.

* Spelling changes.

* Simplify packaged test csproj file.

* Update guids\packagereference versions.

* Remove anycpu

* Append defines instead of overriding.

* Attempt switch to packages.config for nuget

* Add packagereference back.

* Try packages.config again.

* Try direct restore of csproj

* Try workaround solutiondir issue

* Try fix bundleplatforms.

* Change outputpath

* Remove output path

* Make client and server have separate lib names.

* Add output path back.

* Merge build break fix to allow pipeline run.

* Move test package to its own solution.

* Microsoft.Management.Deployment.Client buildchange

* Merge local master to comtesting (#16)

* Fix bad merge (#1408)

* Add support for rest api 1.1 interface (#1396)

Added support for market
Added support for source agreements
Added support for msstore type
Minor changes to workflow ui
Next pr will be the manifest v1.1 integration.

* Remove the packagedAPI experimental feature flag (#1419)

* Integrating custom header with V1.1 changes (#1422)

Integrating custom header with V1.1 changes

* Expose pass through header through com interface. (#1420)

* Add custom header.

* Update behavior for composites.

* Revert line ending changes.

* Add comment.

* Update composite behavior.

* Fix error code

* Update Loggers to support multiple Win32 app installs in single process (#1399)

* Update Loggers to support multi threaded processing of Win32 app install requests in WPMServer

Co-authored-by: JohnMcPMS <[email protected]>
Co-authored-by: yao-msft <[email protected]>
Co-authored-by: Ashwini Patil <[email protected]>
Co-authored-by: sachintaMSFT <[email protected]>

* Remove unneccessary cpp files

* Run Com Interface tests

* Add appxrecipe to spelling

* Update test path

* Update test paths.

* Remove test adapter dll from testassembly

* Add powershell task to install wingetdev

* Add runsettings file to publish logs.

* Test installing package in vstest

* Try newer windows server.

* Try enable com tracing for tests.

* Try direct run of vstest

* Fix install script to call add script.

* Fix appxpackages path.

* Fix path again, remove trace

* Extract unsigned package for loose register

* reenable tracing

* Include server in packagedtests

* Remove build dependency on wingetserver project

* Try tracelog comtracing.

* Fix powershell args.

* Handle variable azure src dir paths.

* Make Dll version of com server and use for tests

* Fix library name parameter.

* Remove com tracing. Fix test.

* Fix copyright and spelling.

* Try decrease build disk size.

Co-authored-by: JohnMcPMS <[email protected]>
Co-authored-by: yao-msft <[email protected]>
Co-authored-by: Ashwini Patil <[email protected]>
Co-authored-by: sachintaMSFT <[email protected]>
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