Migrate all ORAS CLI usage to OrasDotNet#2050
Open
lbussell wants to merge 7 commits intodotnet:mainfrom
Open
Conversation
- Add Annotations property to ReferrerInfo record - Populate referrer annotations from OrasDotNet descriptors in GetReferrersAsync - Add AttachArtifactAsync method to IOrasService for creating referrer artifacts - Implement AttachArtifactAsync in OrasDotNetService using Packer.PackManifestAsync Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Make ILifecycleMetadataService async with Task<Manifest?> returns - Remove isDryRun and ILogger parameters (callers handle dry-run, logger injected via ctor) - Rewrite LifecycleMetadataService to use IOrasService instead of IOrasClient - Update AnnotateEolDigestsCommand for async (Parallel.ForEachAsync) - Update GenerateEolAnnotationDataCommandBase for async - Update CleanAcrImagesCommand.HasExpiredEol to async Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Convert mock setups from out-param pattern to ReturnsAsync pattern - Update method names: IsDigestAnnotatedForEol -> IsDigestAnnotatedForEolAsync - Update method names: AnnotateEolDigest -> AnnotateEolDigestAsync - Remove ILogger from mock parameters - All 451 tests passing Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Delete OrasClient.cs (IOrasClient interface and OrasClient class) - Delete Models/Oras/OrasDiscoverData.cs (CLI JSON output model) - Remove IOrasClient DI registration from ImageBuilder.cs - Remove empty Models/Oras/ directory All ORAS operations now use the OrasDotNet library via IOrasService. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The oras CLI executable is no longer needed since all ORAS operations now use the OrasDotNet library directly. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR migrates Image Builder’s remaining ORAS interactions from invoking the oras CLI to using the OrasProject.Oras (.NET) library, primarily to remove the need for pinning/updating a CLI tool in the build image and to align with issues #1318/#1313.
Changes:
- Removes the legacy
IOrasClient/CLI-based ORAS code paths and JSON models used fororas discover. - Extends the ORAS .NET service to support attaching referrer artifacts with annotations and exposes that via
IOrasService. - Refactors lifecycle/EOL annotation workflows to use async
ILifecycleMetadataServicemethods backed byOrasDotNetService, updating commands and tests accordingly.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/ImageBuilder/OrasClient.cs | Removes legacy CLI-based ORAS client. |
| src/ImageBuilder/Models/Oras/OrasDiscoverData.cs | Removes CLI oras discover JSON model. |
| src/ImageBuilder/Oras/IOrasService.cs | Adds AttachArtifactAsync to support pushing annotation-only referrer artifacts. |
| src/ImageBuilder/Oras/OrasDotNetService.cs | Implements AttachArtifactAsync and enriches referrer results with annotations. |
| src/ImageBuilder/Oras/ReferrerInfo.cs | Extends referrer info to carry optional manifest annotations. |
| src/ImageBuilder/LifecycleMetadataService.cs | Reworks EOL discovery/attachment to use IOrasService async APIs. |
| src/ImageBuilder/ILifecycleMetadataService.cs | Updates lifecycle metadata API to async methods returning Manifest?. |
| src/ImageBuilder/ImageBuilder.cs | Removes DI registration for IOrasClient; continues registering OrasDotNetService. |
| src/ImageBuilder/Commands/GenerateEolAnnotationDataCommandBase.cs | Uses async lifecycle checks during digest filtering. |
| src/ImageBuilder/Commands/CleanAcrImagesCommand.cs | Switches EOL expiry logic to async lifecycle check. |
| src/ImageBuilder/Commands/AnnotateEolDigestsCommand.cs | Switches EOL annotation flow to async lifecycle APIs. |
| src/ImageBuilder.Tests/*.cs | Updates mocks/verifications to the new async lifecycle APIs. |
src/ImageBuilder.Tests/GenerateEolAnnotationDataForPublishCommandTests.cs
Show resolved
Hide resolved
Combine the before/after log calls into a single post-operation message with all details: reference, digest, artifactType, annotations, elapsed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Use TryGetValue for EndOfLifeAnnotation lookups in HasExpiredEolAsync and AnnotateDigestAsync to avoid KeyNotFoundException - Use TryParse for DateTimeOffset in HasExpiredEolAsync for robustness - Add ArgumentException.ThrowIfNullOrWhiteSpace(digest) guards to both LifecycleMetadataService public methods The (Manifest)null cast in tests is kept as-is because the file has #nullable disable, making (Manifest?)null a compile error (CS8632). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #1318. Since we use dependabot, this also fixes #1313.