-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Implement workload redirects #18166
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
Merged
sfoslund
merged 26 commits into
dotnet:release/6.0.1xx-preview7
from
mhutch:workload-redirects
Jul 19, 2021
Merged
Implement workload redirects #18166
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
f9d957f
Eliminate redundant existence checks in workload resolver
mhutch b8ade8e
Implement workload redirects
mhutch a22e8d0
Fix 'avaliable' typo
mhutch e7a3eb2
Allow deferred opening of workload manifest stream
mhutch cf013d2
Add workload resolver method to determine updated workloads
mhutch 3374ec9
Replace workload TempDirResolver with more generic OverlayResolver
mhutch 0a8238c
Improve diagnosability of manifest conflicts
mhutch accd669
Improve workload composition errors
mhutch ed81dd4
Nullability checks in workload manifest reader tests
mhutch 3d64056
Stronger typing of workload/pack ids in public API
mhutch a6cd134
Disable workload redirects for now
mhutch 0254d95
Improve WorkloadResolver.GetPacksInWorkload
mhutch 15d527f
Fix available workloads returned by resolver
mhutch 619304d
Include workload ID in exception when resolver cannot find it
mhutch d867fef
Hide WorkloadResolver.GetPackPath in favor of ResolvePackPath
mhutch 536f67c
When suggesting workloads, only consider available workloads
mhutch e4b36e3
Localize remaining workload composition errors
mhutch d75137c
Simplify WorkloadResolver.GetInstalledManifests
mhutch c9d64aa
Fix ResolvePackPath returning empty workload pack ids
mhutch 48720b8
Check updated composition error messages in workload tests
mhutch 0537ca7
Don't assume missing workload packs can always be satisfied
mhutch f4ed4c7
Fix accidental removal that broke workload search tests
mhutch b736168
Fix error message argument indices
dsplaisted 4d4f3ef
Fix workload mocks to use correct manifest IDs
dsplaisted 9f15943
Update test now that mock workload manifest has right ID
dsplaisted 88fc6b4
Generate correct error message when trying to install a workload whic…
dsplaisted File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add workload resolver method to determine updated workloads
- Loading branch information
commit cf013d21529987a77e79e072186ebe0b9c159527
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -415,6 +415,47 @@ public IEnumerable<WorkloadDefinition> GetAvailableWorkloads() | |
| return _workloads.Values; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Determines which of the installed workloads has updates available in the advertising manifests. | ||
| /// </summary> | ||
| /// <param name="advertisingManifestResolver">A resolver that composes the advertising manifests with the installed manifests that do not have corresponding advertising manifests</param> | ||
| /// <param name="existingWorkloads">The IDs of all of the installed workloads</param> | ||
| /// <returns></returns> | ||
| public IEnumerable<WorkloadId> GetUpdatedWorkloads(WorkloadResolver advertisingManifestResolver, IEnumerable<WorkloadId> installedWorkloads) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks great, I'll update the existing code to start using it when this is checked in. |
||
| { | ||
| foreach(var workloadId in installedWorkloads) | ||
| { | ||
| var existingWorkload = _workloads[workloadId]; | ||
| var existingPacks = GetPacksInWorkload(existingWorkload).ToHashSet(); | ||
| var updatedWorkload = advertisingManifestResolver._workloads[workloadId]; | ||
| var updatedPacks = advertisingManifestResolver.GetPacksInWorkload(updatedWorkload); | ||
|
|
||
| if (!existingPacks.SetEquals(updatedPacks) || existingPacks.Any(p=> PackHasChanged(_packs[p], advertisingManifestResolver._packs[p]))) | ||
| { | ||
| yield return workloadId; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| private bool PackHasChanged(WorkloadPack oldPack, WorkloadPack newPack) | ||
| { | ||
| var existingPackResolvedId = ResolveId(oldPack); | ||
| var newPackResolvedId = ResolveId(newPack); | ||
| if (existingPackResolvedId is null && newPackResolvedId is null) | ||
| { | ||
| return false; // pack still aliases to nothing | ||
| } | ||
| else if (existingPackResolvedId is null || newPackResolvedId is null || !existingPackResolvedId.Value.Equals(newPackResolvedId.Value)) | ||
| { | ||
| return true; // alias has changed | ||
| } | ||
| if (!string.Equals(oldPack.Version, newPack.Version, StringComparison.OrdinalIgnoreCase)) | ||
| { | ||
| return true; // version has changed | ||
| } | ||
| return false; | ||
| } | ||
|
|
||
| public class PackInfo | ||
| { | ||
| public PackInfo(string id, string version, WorkloadPackKind kind, string path, string resolvedPackageId) | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a new logic? WorkloadManifestUpdater.CalculateManifestUpdates is doing similar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is to replace it. This one handles redirects and cross-manifest dependencies.