Files
abra/pkg/client/registry.go
decentral1se 8a51acae5f
All checks were successful
continuous-integration/drone/push Build is passing
feat: translation support
See #483
2025-08-19 12:47:20 +02:00

31 lines
701 B
Go

package client
import (
"context"
"errors"
"fmt"
"github.com/containers/image/docker"
"github.com/containers/image/types"
"github.com/distribution/reference"
"github.com/leonelquinteros/gotext"
)
// GetRegistryTags retrieves all tags of an image from a container registry.
func GetRegistryTags(img reference.Named) ([]string, error) {
var tags []string
ref, err := docker.ParseReference(fmt.Sprintf("//%s", img))
if err != nil {
return tags, errors.New(gotext.Get("failed to parse image %s, saw: %s", img, err.Error()))
}
ctx := context.Background()
tags, err = docker.GetRepositoryTags(ctx, &types.SystemContext{}, ref)
if err != nil {
return tags, err
}
return tags, nil
}