diff --git a/README.md b/README.md index f17c6e0..650cdeb 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ This is a Golang implementation of [openshift4-mirror](https://repo1.dso.mil/platform-one/distros/red-hat/ocp4/openshift4-mirror). The purpose behind this was to make distribution easier. -Executable files can be downloaded from the [releases page](https://github.com/Shanedell/openshift4-mirror-go/releases). Also a docker image ghcr.io/shanedell/openshift4-mirror-go. +Executable files can be downloaded from the [releases page](https://github.com/shanedell/openshift4-mirror-go/releases). Also a docker image ghcr.io/shanedell/openshift4-mirror-go. ## Options diff --git a/cmd/build.go b/cmd/build.go index 3e665c6..0c20daa 100644 --- a/cmd/build.go +++ b/cmd/build.go @@ -3,8 +3,8 @@ package cmd import ( "errors" - "github.com/Shanedell/openshift4-mirror-go/pkg/app" - "github.com/Shanedell/openshift4-mirror-go/pkg/utils" + "github.com/shanedell/openshift4-mirror-go/pkg/app" + "github.com/shanedell/openshift4-mirror-go/pkg/utils" "github.com/spf13/cobra" ) diff --git a/cmd/bundle.go b/cmd/bundle.go index 5d32d7b..fbc6c2b 100644 --- a/cmd/bundle.go +++ b/cmd/bundle.go @@ -3,8 +3,8 @@ package cmd import ( "fmt" - "github.com/Shanedell/openshift4-mirror-go/pkg/app" - "github.com/Shanedell/openshift4-mirror-go/pkg/utils" + "github.com/shanedell/openshift4-mirror-go/pkg/app" + "github.com/shanedell/openshift4-mirror-go/pkg/utils" "github.com/spf13/cobra" ) diff --git a/cmd/prune.go b/cmd/prune.go index 0517962..b048170 100644 --- a/cmd/prune.go +++ b/cmd/prune.go @@ -3,8 +3,8 @@ package cmd import ( "errors" - "github.com/Shanedell/openshift4-mirror-go/pkg/app" - "github.com/Shanedell/openshift4-mirror-go/pkg/utils" + "github.com/shanedell/openshift4-mirror-go/pkg/app" + "github.com/shanedell/openshift4-mirror-go/pkg/utils" "github.com/spf13/cobra" ) @@ -14,6 +14,7 @@ var ( pruneType string opmVersion string targetImage string + folderName string ) var pruneHelp = "prune the Red Hat Operator index image" @@ -68,6 +69,14 @@ func NewPruneCommand() *cobra.Command { "complete image name to tag final image as.", ) + pruneCommand.PersistentFlags().StringVarP( + &folderName, + "folder-name", + "f", + "pruned-catalog", + "folder name for the pruned catalog", + ) + return pruneCommand } @@ -92,6 +101,7 @@ func pruneMain(_ *cobra.Command, _ []string) error { PruneType: pruneType, OpmVersion: opmVersion, TargetImage: targetImage, + FolderName: folderName, } return app.PruneIndexImage( diff --git a/cmd/shell.go b/cmd/shell.go index c33425f..a6759a5 100644 --- a/cmd/shell.go +++ b/cmd/shell.go @@ -3,8 +3,8 @@ package cmd import ( "errors" - "github.com/Shanedell/openshift4-mirror-go/pkg/app" - "github.com/Shanedell/openshift4-mirror-go/pkg/utils" + "github.com/shanedell/openshift4-mirror-go/pkg/app" + "github.com/shanedell/openshift4-mirror-go/pkg/utils" "github.com/spf13/cobra" ) diff --git a/debug.Dockerfile b/debug.Dockerfile index 9e67483..71bdffd 100644 --- a/debug.Dockerfile +++ b/debug.Dockerfile @@ -15,7 +15,7 @@ ENV LANGUAGE=en_US.UTF-8 LABEL \ name="openshift4-mirror-go" \ description="Utility for mirroring OpenShift 4 content" \ - maintainer="Shanedell" + maintainer="shanedell" USER root diff --git a/go.mod b/go.mod index f0436f6..6c68b0c 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/Shanedell/openshift4-mirror-go +module github.com/shanedell/openshift4-mirror-go go 1.18 diff --git a/main.go b/main.go index 46098cf..ee5e11e 100644 --- a/main.go +++ b/main.go @@ -1,6 +1,6 @@ package main -import "github.com/Shanedell/openshift4-mirror-go/cmd" +import "github.com/shanedell/openshift4-mirror-go/cmd" func main() { cmd.Run() diff --git a/pkg/app/bundle.go b/pkg/app/bundle.go index bf69941..341708f 100644 --- a/pkg/app/bundle.go +++ b/pkg/app/bundle.go @@ -4,8 +4,8 @@ import ( "os" "path/filepath" - "github.com/Shanedell/openshift4-mirror-go/pkg/download" - "github.com/Shanedell/openshift4-mirror-go/pkg/utils" + "github.com/shanedell/openshift4-mirror-go/pkg/download" + "github.com/shanedell/openshift4-mirror-go/pkg/utils" ) func Bundle(bundleDataIn *utils.BundleDataType) error { diff --git a/pkg/app/prune.go b/pkg/app/prune.go index 2222439..488362a 100644 --- a/pkg/app/prune.go +++ b/pkg/app/prune.go @@ -8,8 +8,8 @@ import ( "runtime" "strings" - "github.com/Shanedell/openshift4-mirror-go/pkg/download" - "github.com/Shanedell/openshift4-mirror-go/pkg/utils" + "github.com/shanedell/openshift4-mirror-go/pkg/download" + "github.com/shanedell/openshift4-mirror-go/pkg/utils" ) func cleanupOpmFiles(osName string) { diff --git a/pkg/app/prune_file.go b/pkg/app/prune_file.go index 625319e..24992d1 100644 --- a/pkg/app/prune_file.go +++ b/pkg/app/prune_file.go @@ -5,7 +5,7 @@ import ( "os" "path/filepath" - "github.com/Shanedell/openshift4-mirror-go/pkg/utils" + "github.com/shanedell/openshift4-mirror-go/pkg/utils" ) func createIndexFile(imageToPrune string, osName string, jqArgs string, prunedCatalogIndexFile string) error { @@ -41,7 +41,7 @@ func createDockerFile(containerRuntimePath string, osName string, prunedCatalogF return runOpmCommand(cmd, osName, containerRuntimePath, true) } -func buildImage(imageName string, containerRuntime string, containerRuntimePath string, osName string) error { +func buildImage(imageName string, containerRuntime string, containerRuntimePath string, osName string, prunedCatalogFolder string) error { cmd := utils.CreateCommand( containerRuntime, "build", @@ -49,13 +49,13 @@ func buildImage(imageName string, containerRuntime string, containerRuntimePath "-f", "configs.Dockerfile", ".", ) - cmd.Dir = "pruned-catalog" + cmd.Dir = prunedCatalogFolder return runOpmCommand(cmd, osName, containerRuntimePath, true) } func pruneFile(pruneData *utils.PruneDataType, containerRuntime string, containerRuntimePath string, osName string) error { - prunedCatalogFolder := "pruned-catalog/configs" + prunedCatalogFolder := fmt.Sprintf("%s/configs", pruneData.FolderName) prunedCatalogIndexFile := fmt.Sprintf("%s/index.json", prunedCatalogFolder) jqArgs := "" @@ -92,7 +92,7 @@ func pruneFile(pruneData *utils.PruneDataType, containerRuntime string, containe utils.Logger.Info("Finished creating dockerfile...") utils.Logger.Infof("Building image %s...\n", pruneData.TargetImage) - err = buildImage(pruneData.TargetImage, containerRuntime, containerRuntimePath, osName) + err = buildImage(pruneData.TargetImage, containerRuntime, containerRuntimePath, osName, pruneData.FolderName) if err != nil { return err } diff --git a/pkg/app/runtime.go b/pkg/app/runtime.go index 77f19f7..060c6b4 100644 --- a/pkg/app/runtime.go +++ b/pkg/app/runtime.go @@ -7,7 +7,7 @@ import ( "runtime" "strings" - "github.com/Shanedell/openshift4-mirror-go/pkg/utils" + "github.com/shanedell/openshift4-mirror-go/pkg/utils" ) func GetContainerRuntime() string { diff --git a/pkg/download/catalogs.go b/pkg/download/catalogs.go index 0e8cd97..0dd271a 100644 --- a/pkg/download/catalogs.go +++ b/pkg/download/catalogs.go @@ -5,7 +5,7 @@ import ( "path/filepath" "regexp" - "github.com/Shanedell/openshift4-mirror-go/pkg/utils" + "github.com/shanedell/openshift4-mirror-go/pkg/utils" ) // this function is mostly to get the catalog source and image content source policy files diff --git a/pkg/download/clients.go b/pkg/download/clients.go index b1cbb2a..7bc7e12 100644 --- a/pkg/download/clients.go +++ b/pkg/download/clients.go @@ -5,7 +5,7 @@ import ( "path/filepath" "strings" - "github.com/Shanedell/openshift4-mirror-go/pkg/utils" + "github.com/shanedell/openshift4-mirror-go/pkg/utils" ) func Clients() error { diff --git a/pkg/download/opm.go b/pkg/download/opm.go index 7616e4f..dbb7b8b 100644 --- a/pkg/download/opm.go +++ b/pkg/download/opm.go @@ -6,7 +6,7 @@ import ( "runtime" "strings" - "github.com/Shanedell/openshift4-mirror-go/pkg/utils" + "github.com/shanedell/openshift4-mirror-go/pkg/utils" ) func OpmScript(osName string, version string) error { diff --git a/pkg/download/release.go b/pkg/download/release.go index ef95c28..4d83afb 100644 --- a/pkg/download/release.go +++ b/pkg/download/release.go @@ -4,7 +4,7 @@ import ( "fmt" "path/filepath" - "github.com/Shanedell/openshift4-mirror-go/pkg/utils" + "github.com/shanedell/openshift4-mirror-go/pkg/utils" ) func Release() error { diff --git a/pkg/download/rhcos.go b/pkg/download/rhcos.go index e760e7c..4b8ff87 100644 --- a/pkg/download/rhcos.go +++ b/pkg/download/rhcos.go @@ -5,7 +5,7 @@ import ( "path/filepath" "strings" - "github.com/Shanedell/openshift4-mirror-go/pkg/utils" + "github.com/shanedell/openshift4-mirror-go/pkg/utils" ) func rhcosFilename() (string, error) { diff --git a/pkg/utils/structs.go b/pkg/utils/structs.go index 43b23cc..ce52dbc 100644 --- a/pkg/utils/structs.go +++ b/pkg/utils/structs.go @@ -41,4 +41,5 @@ type PruneDataType struct { OpmVersion string PruneType string TargetImage string + FolderName string }