Skip to content

Commit

Permalink
Add --project-name flag to olmcatalog gen-csv
Browse files Browse the repository at this point in the history
At present `operator-sdk gen-csv` command takes the base driectory name
as the operator name while generating CSV

This patch adds a flag `--project-name` to specify the operator name
while generating CSV using `operator-sdk gen-csv` command

The default value (when flag is absent) is base directory name as before

Signed-off-by: Nikhil Thomas <nikthoma@redhat.com>
  • Loading branch information
nikhil-thomas committed Jun 19, 2019
1 parent 166a073 commit b43078e
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions cmd/operator-sdk/olmcatalog/gen-csv.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ import (
)

var (
csvVersion string
fromVersion string
csvConfigPath string
updateCRDs bool
csvVersion string
fromVersion string
csvConfigPath string
updateCRDs bool
absProjectPath = projutil.MustGetwd()
projectName = filepath.Base(absProjectPath)
)

func newGenCSVCmd() *cobra.Command {
Expand All @@ -54,6 +56,7 @@ Configure CSV generation by writing a config file 'deploy/olm-catalog/csv-config
}

genCSVCmd.Flags().StringVar(&csvVersion, "csv-version", "", "Semantic version of the CSV")
genCSVCmd.Flags().StringVar(&projectName, "project-name", projectName, "Operator name to use while generating CSV")
genCSVCmd.MarkFlagRequired("csv-version")
genCSVCmd.Flags().StringVar(&fromVersion, "from-version", "", "Semantic version of an existing CSV to use as a base")
genCSVCmd.Flags().StringVar(&csvConfigPath, "csv-config", "", "Path to CSV config file. Defaults to deploy/olm-catalog/csv-config.yaml")
Expand All @@ -71,10 +74,9 @@ func genCSVFunc(cmd *cobra.Command, args []string) error {
return err
}

absProjectPath := projutil.MustGetwd()
cfg := &input.Config{
AbsProjectPath: absProjectPath,
ProjectName: filepath.Base(absProjectPath),
ProjectName: projectName,
}
if projutil.IsOperatorGo() {
cfg.Repo = projutil.CheckAndGetProjectGoPkg()
Expand Down

0 comments on commit b43078e

Please sign in to comment.