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

@@ -32,7 +32,7 @@ var pullArtifactCmd = &cobra.Command{
Long: `The pull artifact command downloads and extracts the OCI artifact content to the given path.
The pull command uses the credentials from '~/.docker/config.json'.`,
Example: `# Pull an OCI artifact created by flux from GHCR
flux pull artifact ghcr.io/org/manifests/app:v0.0.1 --output ./path/to/local/manifests
flux pull artifact oci://ghcr.io/org/manifests/app:v0.0.1 --output ./path/to/local/manifests
`,
RunE: pullArtifactCmdRun,
}
@@ -50,9 +50,9 @@ func init() {
func pullArtifactCmdRun(cmd *cobra.Command, args []string) error {
if len(args) < 1 {
return fmt.Errorf("artifact name is required")
return fmt.Errorf("artifact URL is required")
}
url := args[0]
ociURL := args[0]
if pullArtifactArgs.output == "" {
return fmt.Errorf("invalid output path %s", pullArtifactArgs.output)
@@ -62,6 +62,11 @@ func pullArtifactCmdRun(cmd *cobra.Command, args []string) error {
return fmt.Errorf("invalid output path %s", pullArtifactArgs.output)
}
url, err := oci.ParseArtifactURL(ociURL)
if err != nil {
return err
}
ctx, cancel := context.WithTimeout(context.Background(), rootArgs.timeout)
defer cancel()