Skip to content

Commit 7cd48c7

Browse files
Mohit-Chakrabortyannelo-msftazure-sdkbenbp
authored
[ACR] Add upload/download code for blobs and manifests (Azure#27383)
* new branch for OCI Blobs additions * add ContentDescriptor and swagger transfrom to set manifest Content-Type * more swagger transforms * make OciManifest a public type * Add UploadManifest(Manifest) overload * add generated API listing * remove unused options types. add strongly-typed overload for stream. support only OCI manifest format * update api * API tweaks * make upload artifact succeed * record the successful test run * Support Upload and Download manifest * api updates * remove abstract base Manifest class from public API * change approach to validation for blob download * light tidy * more tidy up * test cleanup * remove unused type * update docstrings * combine file paths differently * make test data available * pr fb * remove manifest stream upload methods * update changelog and project version * update API listing * update changelog * Increment version for containerregistry releases (Azure#23836) Increment package version after release of Azure.Containers.ContainerRegistry * [ACR] Add an overload for `UploadManifest()` that takes a `Stream` as input (Azure#24685) * Add an overload for `UploadManifest()` that takes a `Stream` as input * Add an overload for `DownloadManifest()` that takes a tag or a digest as input * Remove `DownloadManifest()` overload that takes a digest parameter * Implement `IDisposable` on `Stream` containing result types Validate manifest digest in `UploadManifest` methods * Update Changelog * Ensure that `Digest` is always populated in `DownloadManifestResult` * Extract digest from response if needed for validation * Use the `using` syntax to dispose objects Remove an errant '.' in the README * Avoid computing digest twice Co-authored-by: Anne Thompson <[email protected]> * Transform swagger to upload stream as manifest * Copy stream locally to avoid working with a closed stream Reset stream position when neeed * Extract content digest from header for validation Add test to upload manifest with tag and download by tag and digest * Reset downloaded manifest stream before returning Add test to validate that downloadStream.Position = 0 Co-authored-by: Anne Thompson <[email protected]> * [ACR] Verify Audience must be set in Options (Azure#24889) * Increment version for containerregistry releases (Azure#24910) Increment package version after release of Azure.Containers.ContainerRegistry * [ACR] Support anon access in ACR blob client (Azure#25087) * Support anon access in ACR blob client * Incorporate analyzer suggestions * Use https for sparse checkout command (Azure#25067) Co-authored-by: Ben Broderick Phillips <[email protected]> * Update cspell.json from main Co-authored-by: Azure SDK Bot <[email protected]> Co-authored-by: Ben Broderick Phillips <[email protected]> * [ACR] Mark version 1.1.0-beta.3 in release (Azure#25156) * Increment version for containerregistry releases (Azure#25237) Increment package version after release of Azure.Containers.ContainerRegistry * Use `ResponseError` when creating `RequestFailedException` * Add `GetTagPropertiesCollection()` on `RegistryArtifact` * Update test session records * Update test session records * Temporarily mark `CanUploadBlob()` test as ignored * Update test session records for `CanUploadOciManifest()` * Sanitize 'access_token' and 'refresh_token' from request and response headers * Clean-up `CanUploadBlob()` test session records * Revert sanitizing the entire 'refresh_token' and 'access_token' * Regenerate test session records after fix in Core test recording code * Create test session record for `CanUploadBlob()` test The test passes on .NET 6.0 * Remove download-blob step in the `CanUploadBlob()` test * Undo temporary changes made to test service behavior * Fix order of entries in Changelog * Update session records for `CanUploadBlob()` test * Add `Tag` as an optional param to `UploadManifestOptions` * Update public API * Ignore comparison of 'Accept' header values * Update release date of preview package Co-authored-by: Anne Thompson <[email protected]> Co-authored-by: Azure SDK Bot <[email protected]> Co-authored-by: Ben Broderick Phillips <[email protected]>
1 parent fa1a1f0 commit 7cd48c7

File tree

142 files changed

+25071
-8071
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

142 files changed

+25071
-8071
lines changed

sdk/containerregistry/Azure.Containers.ContainerRegistry/CHANGELOG.md

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,53 @@
11
# Release History
22

3-
## 1.1.0-beta.1 (Unreleased)
3+
## 1.1.0-beta.4 (2022-04-05)
44

55
### Features Added
66

7-
### Breaking Changes
8-
9-
### Bugs Fixed
10-
11-
### Other Changes
7+
- Unifies features from the earlier preview releases with the latest stable release.
128

139
## 1.0.0 (2022-01-11)
1410

1511
### Features Added
1612

1713
- Adds stable features and bug fixes from the earlier preview releases.
14+
1815
### Breaking Changes
1916

2017
- Renamed `ArtifactManifestOrderBy` to `ArtifactManifestOrder`.
2118
- Renamed `ArtifactTagOrderBy` to `ArtifactTagOrder`.
2219

23-
2420
## 1.0.0-beta.5 (2021-11-18)
2521

2622
### Features Added
2723
- Updated the supported service version to "2021-07-01".
2824
- Added support to create instances of `ArtifactManifestProperties` using the `ContainerRegistryModelFactory`.
2925

26+
## 1.1.0-beta.3 (2021-11-09)
27+
28+
### Features Added
29+
30+
- Added support for [anonymous pull access](https://docs.microsoft.com/azure/container-registry/anonymous-pull-access#configure-anonymous-pull-access) using the `ContainerRegistryBlobClient`
31+
32+
## 1.1.0-beta.2 (2021-10-13)
33+
34+
### Features Added
35+
36+
- Added an overload for `UploadManifest(Async) method that takes the manifest `Stream` as an input.
37+
- Added methods in `ContainerRegistryModelFactory` that create instances of `DownloadBlobResult`, `DownloadManifestResult`, `UploadBlobResult` and `UploadManifestResult` for mocking.
38+
- Added `DownloadManifestOptions` type to allow callers to pass-in either a tag or a digest in `DownloadManifest(Async)`.
39+
- Added `ManifestStream` as a property in `DownloadManifestResult` that contains the raw manifest stream from the service response.
40+
41+
### Breaking Changes
42+
43+
- Changed `DownloadManifest(Async)` method to take `DownloadManifestOptions` as an input parameter. This allows callers to pass-in either a tag or a digest as the manifest identifier.
44+
45+
## 1.1.0-beta.1 (2021-09-07)
46+
47+
### Features Added
48+
49+
- Added `ContainerRegistryBlobClient` with methods to upload and download OCI Manifests and artifact blobs, to enable implementation of push/pull for OCI artifacts.
50+
3051
## 1.0.0-beta.4 (2021-08-10)
3152

3253
### Breaking Changes

sdk/containerregistry/Azure.Containers.ContainerRegistry/api/Azure.Containers.ContainerRegistry.netstandard2.0.cs

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,10 @@ public static partial class ContainerRegistryModelFactory
160160
public static Azure.Containers.ContainerRegistry.ArtifactManifestProperties ArtifactManifestProperties(string registryLoginServer = null, string repositoryName = null, string digest = null, long? sizeInBytes = default(long?), System.DateTimeOffset createdOn = default(System.DateTimeOffset), System.DateTimeOffset lastUpdatedOn = default(System.DateTimeOffset), Azure.Containers.ContainerRegistry.ArtifactArchitecture? architecture = default(Azure.Containers.ContainerRegistry.ArtifactArchitecture?), Azure.Containers.ContainerRegistry.ArtifactOperatingSystem? operatingSystem = default(Azure.Containers.ContainerRegistry.ArtifactOperatingSystem?), System.Collections.Generic.IEnumerable<Azure.Containers.ContainerRegistry.ArtifactManifestPlatform> relatedArtifacts = null, System.Collections.Generic.IEnumerable<string> tags = null, bool? canDelete = default(bool?), bool? canWrite = default(bool?), bool? canList = default(bool?), bool? canRead = default(bool?)) { throw null; }
161161
public static Azure.Containers.ContainerRegistry.ArtifactTagProperties ArtifactTagProperties(string registryLoginServer = null, string repositoryName = null, string name = null, string digest = null, System.DateTimeOffset createdOn = default(System.DateTimeOffset), System.DateTimeOffset lastUpdatedOn = default(System.DateTimeOffset), bool? canDelete = default(bool?), bool? canWrite = default(bool?), bool? canList = default(bool?), bool? canRead = default(bool?)) { throw null; }
162162
public static Azure.Containers.ContainerRegistry.ContainerRepositoryProperties ContainerRepositoryProperties(string registryLoginServer = null, string name = null, System.DateTimeOffset createdOn = default(System.DateTimeOffset), System.DateTimeOffset lastUpdatedOn = default(System.DateTimeOffset), int manifestCount = 0, int tagCount = 0, bool? canDelete = default(bool?), bool? canWrite = default(bool?), bool? canList = default(bool?), bool? canRead = default(bool?)) { throw null; }
163+
public static Azure.Containers.ContainerRegistry.Specialized.DownloadBlobResult DownloadBlobResult(string digest = null, System.IO.Stream content = null) { throw null; }
164+
public static Azure.Containers.ContainerRegistry.Specialized.DownloadManifestResult DownloadManifestResult(string digest = null, Azure.Containers.ContainerRegistry.Specialized.OciManifest manifest = null, System.IO.Stream manifestStream = null) { throw null; }
165+
public static Azure.Containers.ContainerRegistry.Specialized.UploadBlobResult UploadBlobResult(string digest = null) { throw null; }
166+
public static Azure.Containers.ContainerRegistry.Specialized.UploadManifestResult UploadManifestResult(string digest = null) { throw null; }
163167
}
164168
public partial class ContainerRepository
165169
{
@@ -206,9 +210,107 @@ protected RegistryArtifact() { }
206210
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Containers.ContainerRegistry.ArtifactManifestProperties>> GetManifestPropertiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
207211
public virtual Azure.Response<Azure.Containers.ContainerRegistry.ArtifactTagProperties> GetTagProperties(string tag, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
208212
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Containers.ContainerRegistry.ArtifactTagProperties>> GetTagPropertiesAsync(string tag, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
213+
public virtual Azure.Pageable<Azure.Containers.ContainerRegistry.ArtifactTagProperties> GetTagPropertiesCollection(Azure.Containers.ContainerRegistry.ArtifactTagOrder orderBy = Azure.Containers.ContainerRegistry.ArtifactTagOrder.None, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
214+
public virtual Azure.AsyncPageable<Azure.Containers.ContainerRegistry.ArtifactTagProperties> GetTagPropertiesCollectionAsync(Azure.Containers.ContainerRegistry.ArtifactTagOrder orderBy = Azure.Containers.ContainerRegistry.ArtifactTagOrder.None, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
209215
public virtual Azure.Response<Azure.Containers.ContainerRegistry.ArtifactManifestProperties> UpdateManifestProperties(Azure.Containers.ContainerRegistry.ArtifactManifestProperties value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
210216
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Containers.ContainerRegistry.ArtifactManifestProperties>> UpdateManifestPropertiesAsync(Azure.Containers.ContainerRegistry.ArtifactManifestProperties value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
211217
public virtual Azure.Response<Azure.Containers.ContainerRegistry.ArtifactTagProperties> UpdateTagProperties(string tag, Azure.Containers.ContainerRegistry.ArtifactTagProperties value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
212218
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Containers.ContainerRegistry.ArtifactTagProperties>> UpdateTagPropertiesAsync(string tag, Azure.Containers.ContainerRegistry.ArtifactTagProperties value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
213219
}
214220
}
221+
namespace Azure.Containers.ContainerRegistry.Specialized
222+
{
223+
public partial class ContainerRegistryBlobClient
224+
{
225+
protected ContainerRegistryBlobClient() { }
226+
public ContainerRegistryBlobClient(System.Uri endpoint, Azure.Core.TokenCredential credential, string repository) { }
227+
public ContainerRegistryBlobClient(System.Uri endpoint, Azure.Core.TokenCredential credential, string repository, Azure.Containers.ContainerRegistry.ContainerRegistryClientOptions options) { }
228+
public ContainerRegistryBlobClient(System.Uri endpoint, string repository) { }
229+
public ContainerRegistryBlobClient(System.Uri endpoint, string repository, Azure.Containers.ContainerRegistry.ContainerRegistryClientOptions options) { }
230+
public virtual System.Uri Endpoint { get { throw null; } }
231+
public virtual string RepositoryName { get { throw null; } }
232+
public virtual Azure.Response DeleteBlob(string digest, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
233+
public virtual System.Threading.Tasks.Task<Azure.Response> DeleteBlobAsync(string digest, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
234+
public virtual Azure.Response DeleteManifest(string digest, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
235+
public virtual System.Threading.Tasks.Task<Azure.Response> DeleteManifestAsync(string digest, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
236+
public virtual Azure.Response<Azure.Containers.ContainerRegistry.Specialized.DownloadBlobResult> DownloadBlob(string digest, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
237+
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Containers.ContainerRegistry.Specialized.DownloadBlobResult>> DownloadBlobAsync(string digest, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
238+
public virtual Azure.Response<Azure.Containers.ContainerRegistry.Specialized.DownloadManifestResult> DownloadManifest(Azure.Containers.ContainerRegistry.Specialized.DownloadManifestOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
239+
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Containers.ContainerRegistry.Specialized.DownloadManifestResult>> DownloadManifestAsync(Azure.Containers.ContainerRegistry.Specialized.DownloadManifestOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
240+
public virtual Azure.Response<Azure.Containers.ContainerRegistry.Specialized.UploadBlobResult> UploadBlob(System.IO.Stream stream, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
241+
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Containers.ContainerRegistry.Specialized.UploadBlobResult>> UploadBlobAsync(System.IO.Stream stream, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
242+
public virtual Azure.Response<Azure.Containers.ContainerRegistry.Specialized.UploadManifestResult> UploadManifest(Azure.Containers.ContainerRegistry.Specialized.OciManifest manifest, Azure.Containers.ContainerRegistry.Specialized.UploadManifestOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
243+
public virtual Azure.Response<Azure.Containers.ContainerRegistry.Specialized.UploadManifestResult> UploadManifest(System.IO.Stream manifestStream, Azure.Containers.ContainerRegistry.Specialized.UploadManifestOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
244+
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Containers.ContainerRegistry.Specialized.UploadManifestResult>> UploadManifestAsync(Azure.Containers.ContainerRegistry.Specialized.OciManifest manifest, Azure.Containers.ContainerRegistry.Specialized.UploadManifestOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
245+
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Containers.ContainerRegistry.Specialized.UploadManifestResult>> UploadManifestAsync(System.IO.Stream manifestStream, Azure.Containers.ContainerRegistry.Specialized.UploadManifestOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
246+
}
247+
public partial class DownloadBlobResult : System.IDisposable
248+
{
249+
internal DownloadBlobResult() { }
250+
public System.IO.Stream Content { get { throw null; } }
251+
public string Digest { get { throw null; } }
252+
public void Dispose() { }
253+
}
254+
public partial class DownloadManifestOptions
255+
{
256+
public DownloadManifestOptions(string tag = null, string digest = null) { }
257+
public string Digest { get { throw null; } }
258+
public string Tag { get { throw null; } }
259+
}
260+
public partial class DownloadManifestResult : System.IDisposable
261+
{
262+
internal DownloadManifestResult() { }
263+
public string Digest { get { throw null; } }
264+
public Azure.Containers.ContainerRegistry.Specialized.OciManifest Manifest { get { throw null; } }
265+
public System.IO.Stream ManifestStream { get { throw null; } }
266+
public void Dispose() { }
267+
}
268+
public partial class OciAnnotations
269+
{
270+
public OciAnnotations() { }
271+
public System.Collections.Generic.IDictionary<string, object> AdditionalProperties { get { throw null; } }
272+
public string Authors { get { throw null; } set { } }
273+
public System.DateTimeOffset? CreatedOn { get { throw null; } set { } }
274+
public string Description { get { throw null; } set { } }
275+
public string Documentation { get { throw null; } set { } }
276+
public string Licenses { get { throw null; } set { } }
277+
public string Name { get { throw null; } set { } }
278+
public string Revision { get { throw null; } set { } }
279+
public string Source { get { throw null; } set { } }
280+
public string Title { get { throw null; } set { } }
281+
public string Url { get { throw null; } set { } }
282+
public string Vendor { get { throw null; } set { } }
283+
public string Version { get { throw null; } set { } }
284+
}
285+
public partial class OciBlobDescriptor
286+
{
287+
public OciBlobDescriptor() { }
288+
public Azure.Containers.ContainerRegistry.Specialized.OciAnnotations Annotations { get { throw null; } set { } }
289+
public string Digest { get { throw null; } set { } }
290+
public string MediaType { get { throw null; } set { } }
291+
public long? Size { get { throw null; } set { } }
292+
}
293+
public partial class OciManifest
294+
{
295+
public OciManifest() { }
296+
public Azure.Containers.ContainerRegistry.Specialized.OciAnnotations Annotations { get { throw null; } }
297+
public Azure.Containers.ContainerRegistry.Specialized.OciBlobDescriptor Config { get { throw null; } set { } }
298+
public System.Collections.Generic.IList<Azure.Containers.ContainerRegistry.Specialized.OciBlobDescriptor> Layers { get { throw null; } }
299+
public int? SchemaVersion { get { throw null; } set { } }
300+
}
301+
public partial class UploadBlobResult
302+
{
303+
internal UploadBlobResult() { }
304+
public string Digest { get { throw null; } }
305+
}
306+
public partial class UploadManifestOptions
307+
{
308+
public UploadManifestOptions(string tag = null) { }
309+
public string Tag { get { throw null; } }
310+
}
311+
public partial class UploadManifestResult
312+
{
313+
internal UploadManifestResult() { }
314+
public string Digest { get { throw null; } }
315+
}
316+
}

0 commit comments

Comments
 (0)