1
0
mirror of synced 2026-02-13 13:06:56 +00:00

Add oci:// prefix

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
This commit is contained in:
Stefan Prodan
2022-07-06 19:02:39 +03:00
parent adc7981f22
commit 8049634e4d
13 changed files with 100 additions and 23 deletions

View File

@@ -30,7 +30,7 @@ var listArtifactsCmd = &cobra.Command{
Long: `The list command fetches the tags and their metadata from a remote OCI repository.
The list command uses the credentials from '~/.docker/config.json'.`,
Example: `# list the artifacts stored in an OCI repository
flux list artifact ghcr.io/org/manifests/app
flux list artifact oci://ghcr.io/org/manifests/app
`,
RunE: listArtifactsCmdRun,
}
@@ -41,13 +41,18 @@ func init() {
func listArtifactsCmdRun(cmd *cobra.Command, args []string) error {
if len(args) < 1 {
return fmt.Errorf("artifact repository is required")
return fmt.Errorf("artifact repository URL is required")
}
url := args[0]
ociURL := args[0]
ctx, cancel := context.WithTimeout(context.Background(), rootArgs.timeout)
defer cancel()
url, err := oci.ParseArtifactURL(ociURL)
if err != nil {
return err
}
metas, err := oci.List(ctx, url)
if err != nil {
return err