Refactor openshift buildconfig CLI options.

- Remove --buildconfig, -bc option. Create buildconfig if service has build info
- Rename --branch to --build-branch
- Rename --repo to --build-repo
This commit is contained in:
Ratnadeep Debnath
2016-12-28 17:00:33 +05:30
parent fa724fe12d
commit 6f3e670af1
5 changed files with 29 additions and 34 deletions
+7 -3
View File
@@ -63,7 +63,8 @@ func ValidateFlags(bundle string, args []string, cmd *cobra.Command, opt *kobjec
// OpenShift specific flags
deploymentConfig := cmd.Flags().Lookup("deployment-config").Changed
buildConfig := cmd.Flags().Lookup("build-config").Changed
buildRepo := cmd.Flags().Lookup("build-repo").Changed
buildBranch := cmd.Flags().Lookup("build-branch").Changed
// Kubernetes specific flags
chart := cmd.Flags().Lookup("chart").Changed
@@ -90,8 +91,11 @@ func ValidateFlags(bundle string, args []string, cmd *cobra.Command, opt *kobjec
if deploymentConfig {
logrus.Fatalf("--deployment-config is an OpenShift only flag")
}
if buildConfig {
logrus.Fatalf("--build-config is an Openshift only flag")
if buildRepo {
logrus.Fatalf("--build-repo is an Openshift only flag")
}
if buildBranch {
logrus.Fatalf("--build-branch is an Openshift only flag")
}
}
+2 -3
View File
@@ -33,9 +33,8 @@ type ConvertOptions struct {
CreateRC bool
CreateDS bool
CreateDeploymentConfig bool
CreateBuildConfig bool
Repo string
Branch string
BuildRepo string
BuildBranch string
CreateChart bool
GenerateYaml bool
EmptyVols bool
+2 -2
View File
@@ -305,8 +305,8 @@ func (o *OpenShift) Transform(komposeObject kobject.KomposeObject, opt kobject.C
objects = append(objects, o.initImageStream(name, service))
}
if opt.CreateBuildConfig && service.Build != "" {
objects = append(objects, initBuildConfig(name, service, opt.InputFile, opt.Repo, opt.Branch)) // Openshift BuildConfigs
if service.Build != "" {
objects = append(objects, initBuildConfig(name, service, opt.InputFile, opt.BuildRepo, opt.BuildBranch)) // Openshift BuildConfigs
}
// If ports not provided in configuration we will not make service