Skip to content

Migrate all ORAS CLI usage to OrasDotNet#2050

Open
lbussell wants to merge 7 commits intodotnet:mainfrom
lbussell:orasdotnet
Open

Migrate all ORAS CLI usage to OrasDotNet#2050
lbussell wants to merge 7 commits intodotnet:mainfrom
lbussell:orasdotnet

Conversation

@lbussell
Copy link
Copy Markdown
Member

Fixes #1318. Since we use dependabot, this also fixes #1313.

lbussell and others added 4 commits March 27, 2026 15:53
- 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>
@lbussell lbussell requested a review from Copilot March 27, 2026 23:10
@lbussell lbussell requested a review from a team as a code owner March 27, 2026 23:10
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>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 for oras 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 ILifecycleMetadataService methods backed by OrasDotNetService, 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.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use ORAS .NET Library instead of ORAS CLI ORAS tooling should be kept up to date

2 participants