diff --git a/cmd/lvh/kernels/catalog.go b/cmd/lvh/kernels/catalog.go index 06fbac2..933b691 100644 --- a/cmd/lvh/kernels/catalog.go +++ b/cmd/lvh/kernels/catalog.go @@ -16,12 +16,14 @@ const ( kernelTagRegex = `^(.+)-([0-9]+\.[0-9]+|main)$` - ciCommand = "ci" - ciHelp = "use CI repositories instead of main ones" + repoCommand = "repo" + repoHelp = "specify the OCI repository to pull the image from" ) func catalogCommand() *cobra.Command { - var ci bool + var ( + repo string + ) cmd := &cobra.Command{ Use: "catalog [version]", @@ -36,15 +38,13 @@ Examples: lvh kernels catalog 6.6 # Retrieve the latest tags available for version bpf-next - lvh kernels catalog bpf-next | tail -n 2`, + lvh kernels catalog bpf-next | tail -n 2 + + # Retrieve the latest CI-generated images for version bpf-next + lvh kernels catalog bpf-next --repo quay.io/lvh-images/kernel-images-ci`, RunE: func(cmd *cobra.Command, args []string) error { re := regexp.MustCompile(kernelTagRegex) - repo := kernelImageRepository - if ci { - repo = fmt.Sprintf("%s-ci", repo) - } - rawTagList, err := crane.ListTags(repo) if err != nil { return err @@ -97,7 +97,7 @@ Examples: }, } - cmd.Flags().BoolVar(&ci, ciCommand, false, ciHelp) + cmd.Flags().StringVar(&repo, repoCommand, kernelImageRepository, repoHelp) return cmd } diff --git a/cmd/lvh/kernels/pull.go b/cmd/lvh/kernels/pull.go index a544202..3aa15d8 100644 --- a/cmd/lvh/kernels/pull.go +++ b/cmd/lvh/kernels/pull.go @@ -16,8 +16,10 @@ import ( ) func pullCommand() *cobra.Command { - var platform string - var ci bool + var ( + platform string + repo string + ) cmd := &cobra.Command{ Use: "pull ", @@ -38,7 +40,10 @@ Examples: lvh kernels pull 5.10-main --dir mykernels # Pull the latest tags available for version 5.15 without using 5.15-main - lvh kernels pull $(lvh kernels catalog 5.15 | tail -n 2 | head -n 1)`, + lvh kernels pull $(lvh kernels catalog 5.15 | tail -n 2 | head -n 1) + + # Pull the latest CI-generated images for version bpf-next + lvh kernels pull bpf-next-main --repo quay.io/lvh-images/kernel-images-ci`, Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { re := regexp.MustCompile(kernelTagRegex) @@ -52,11 +57,6 @@ Examples: return fmt.Errorf("platform is malformed, it must be /: %s", platform) } - repo := kernelImageRepository - if ci { - repo = fmt.Sprintf("%s-ci", repo) - } - srcImage := fmt.Sprintf("%s:%s", repo, args[0]) dstTarFile := fmt.Sprintf("%s.tar", args[0]) @@ -78,7 +78,7 @@ Examples: cmd.Flags().StringVarP(&platform, "platform", "p", runtime.GOOS+"/"+runtime.GOARCH, "platform for the kernel image /") cmd.Flags().StringVarP(&dirName, dirNameCommand, "d", ".", dirNameHelp) - cmd.Flags().BoolVar(&ci, ciCommand, false, ciHelp) + cmd.Flags().StringVar(&repo, repoCommand, kernelImageRepository, repoHelp) return cmd }