Skip to content

Commit 36fc884

Browse files
authored
fix Get-AzContainerRegistryManifest returns only 100 results (#23664)
1 parent d1f1caf commit 36fc884

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

src/ContainerRegistry/ContainerRegistry/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
* Fixed bug in `Get-AzContainerRegistryManifest` returns only 100 results [#22922]
2122

2223
## Version 4.1.2
2324
* Upgraded Azure.Core to 1.35.0.

src/ContainerRegistry/ContainerRegistry/Models/ContainerRegistryDataPlaneClient.cs

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
using Microsoft.Azure.Commands.Common.Strategies;
2727
using Microsoft.Azure.Commands.ContainerRegistry.Track2Models;
2828
using Azure;
29+
using Azure.Core.Serialization;
2930

3031
namespace Microsoft.Azure.Commands.ContainerRegistry
3132
{
@@ -168,9 +169,35 @@ public PSRepositoryAttribute UpdateRepository(string repository, PSChangeableAtt
168169
return GetRepository(repository);
169170
}
170171

171-
public PSAcrManifest ListManifest(string repository)
172+
public PSAcrManifest ListManifest(string repositoryName)
172173
{
173-
return new ContainerRegistryManifestListOperation(this, repository).ProcessRequest();
174+
ContainerRepository repository = _track2Client.GetRepository(repositoryName);
175+
Pageable<ArtifactManifestProperties> properties = repository.GetAllManifestProperties();
176+
PSAcrManifest result = new PSAcrManifest();
177+
IEnumerable<Page<ArtifactManifestProperties>> pages = properties.AsPages();
178+
result.ManifestsAttributes = new List<PSManifestAttributeBase>();
179+
foreach (Page<ArtifactManifestProperties> page in pages)
180+
{
181+
Response httpPageResponse = page.GetRawResponse();
182+
dynamic pageContent = httpPageResponse.Content.ToDynamicFromJson(JsonPropertyNames.CamelCase);
183+
result.ImageName = pageContent.ImageName;
184+
result.Registry = pageContent.registry;
185+
// Iterate over items in Manifests collection
186+
foreach (dynamic property in pageContent.Manifests)
187+
{
188+
List<string> tagList = new List<string>();
189+
if (property.Tags != null)
190+
{
191+
tagList.AddRange((List<string>)property.Tags);
192+
}
193+
result.ManifestsAttributes.Add(new PSManifestAttributeBase(property.Digest, property.ImageSize, property.CreatedTime, property.LastUpdateTime,
194+
property.Architecture, property.Os,property.MediaType, property.ConfigMediaType, tagList,
195+
new PSChangeableAttribute(property.ChangeableAttributes.DeleteEnabled, property.ChangeableAttributes.WriteEnabled, property.ChangeableAttributes.ListEnabled, property.ChangeableAttributes.ReadEnabled)));
196+
}
197+
}
198+
199+
200+
return result;
174201
}
175202

176203
public PSManifestAttribute GetManifest(string repository, string manifest)

0 commit comments

Comments
 (0)