Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 28 additions & 20 deletions pkg/client/ecr/ecr.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,35 +57,43 @@ func (c *Client) Tags(ctx context.Context, host, repo, image string) ([]api.Imag

repoName := util.JoinRepoImage(repo, image)

images, err := client.DescribeImages(ctx, &ecr.DescribeImagesInput{
tags := map[string]api.ImageTag{}
input := &ecr.DescribeImagesInput{
RepositoryName: &repoName,
RegistryId: aws.String(id),
})

if err != nil {
return nil, fmt.Errorf("failed to describe images: %s", err)
}

tags := map[string]api.ImageTag{}
for _, img := range images.ImageDetails {
// Base data shared across tags
base := api.ImageTag{
SHA: *img.ImageDigest,
Timestamp: *img.ImagePushedAt,
for {
images, err := client.DescribeImages(ctx, input)
if err != nil {
return nil, fmt.Errorf("failed to describe images: %s", err)
}
Comment on lines +67 to 70

// Continue early if no tags available
if len(img.ImageTags) == 0 {
tags[base.SHA] = base
continue
for _, img := range images.ImageDetails {
// Base data shared across tags
base := api.ImageTag{
SHA: *img.ImageDigest,
Timestamp: *img.ImagePushedAt,
}

// Continue early if no tags available
if len(img.ImageTags) == 0 {
tags[base.SHA] = base
continue
}

for _, tag := range img.ImageTags {
current := base // copy the base
current.Tag = tag // set tag value

util.BuildTags(tags, tag, &current)
}
}

for _, tag := range img.ImageTags {
current := base // copy the base
current.Tag = tag // set tag value

util.BuildTags(tags, tag, &current)
if images.NextToken == nil {
break
}
input.NextToken = images.NextToken
Comment on lines +93 to +96
}

return util.TagMaptoList(tags), nil
Expand Down
Loading