From f8b36322329524dd3784de964a5ec16b6fa20796 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 21 Nov 2024 14:47:25 +0000 Subject: [PATCH 1/2] build(deps): Bump Microsoft.NET.Test.Sdk from 17.11.1 to 17.12.0 in /tests/OrasProject.Oras.Tests (#166) --- tests/OrasProject.Oras.Tests/OrasProject.Oras.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/OrasProject.Oras.Tests/OrasProject.Oras.Tests.csproj b/tests/OrasProject.Oras.Tests/OrasProject.Oras.Tests.csproj index 108d7df..f71d4cd 100644 --- a/tests/OrasProject.Oras.Tests/OrasProject.Oras.Tests.csproj +++ b/tests/OrasProject.Oras.Tests/OrasProject.Oras.Tests.csproj @@ -13,7 +13,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all - + From abdecc339ce58ae70850f7f3de78553422854af1 Mon Sep 17 00:00:00 2001 From: "Lixia (Sylvia) Lei" Date: Mon, 25 Nov 2024 14:36:13 +0800 Subject: [PATCH 2/2] refactor: overload DoPushAsync (#165) Signed-off-by: Lixia (Sylvia) Lei --- .../Registry/Remote/ManifestStore.cs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/OrasProject.Oras/Registry/Remote/ManifestStore.cs b/src/OrasProject.Oras/Registry/Remote/ManifestStore.cs index 549a02b..2819907 100644 --- a/src/OrasProject.Oras/Registry/Remote/ManifestStore.cs +++ b/src/OrasProject.Oras/Registry/Remote/ManifestStore.cs @@ -133,17 +133,17 @@ public async Task ExistsAsync(Descriptor target, CancellationToken cancell } /// - /// Pushes the content, matching the expected descriptor. + /// Pushes the manifest content, matching the expected descriptor. /// /// /// /// /// public async Task PushAsync(Descriptor expected, Stream content, CancellationToken cancellationToken = default) - => await InternalPushAsync(expected, content, expected.Digest, cancellationToken).ConfigureAwait(false); + => await PushAsync(expected, content, expected.Digest, cancellationToken).ConfigureAwait(false); /// - /// PushReferenceASync pushes the manifest with a reference tag. + /// Pushes the manifest content with a reference tag. /// /// /// @@ -152,8 +152,8 @@ public async Task PushAsync(Descriptor expected, Stream content, CancellationTok /// public async Task PushAsync(Descriptor expected, Stream content, string reference, CancellationToken cancellationToken = default) { - var contentReference = Repository.ParseReference(reference).ContentReference!; - await InternalPushAsync(expected, content, contentReference, cancellationToken).ConfigureAwait(false); + var remoteReference = Repository.ParseReference(reference); + await DoPushAsync(expected, content, remoteReference, cancellationToken).ConfigureAwait(false); } /// @@ -163,9 +163,8 @@ public async Task PushAsync(Descriptor expected, Stream content, string referenc /// /// /// - private async Task InternalPushAsync(Descriptor expected, Stream stream, string contentReference, CancellationToken cancellationToken) + private async Task DoPushAsync(Descriptor expected, Stream stream, Reference remoteReference, CancellationToken cancellationToken) { - var remoteReference = Repository.ParseReference(contentReference); var url = new UriFactory(remoteReference, Repository.Options.PlainHttp).BuildRepositoryManifest(); var request = new HttpRequestMessage(HttpMethod.Put, url); request.Content = new StreamContent(stream); @@ -206,7 +205,7 @@ public async Task TagAsync(Descriptor descriptor, string reference, Cancellation { var remoteReference = Repository.ParseReference(reference); using var contentStream = await FetchAsync(descriptor, cancellationToken).ConfigureAwait(false); - await InternalPushAsync(descriptor, contentStream, remoteReference.ContentReference!, cancellationToken).ConfigureAwait(false); + await DoPushAsync(descriptor, contentStream, remoteReference, cancellationToken).ConfigureAwait(false); } ///