Skip to content

Commit

Permalink
Bug 1801064: Deprecate Pipelines in new-app/build
Browse files Browse the repository at this point in the history
Add a warning to `oc new-app` and `oc new-build` if a Jenkins pipeline
strategy build was created.
  • Loading branch information
adambkaplan committed Feb 11, 2020
1 parent ee05f83 commit bfe27ca
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion pkg/cli/newapp/newapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ func NewCmdNewApplication(name, baseName string, f kcmdutil.Factory, streams gen
cmd.Flags().StringArrayVar(&o.Config.BuildEnvironmentFiles, "build-env-file", o.Config.BuildEnvironmentFiles, "File containing key-value pairs of environment variables to set into each build image.")
cmd.MarkFlagFilename("build-env-file")
cmd.Flags().StringVar(&o.Config.Name, "name", o.Config.Name, "Set name to use for generated application artifacts")
cmd.Flags().Var(&o.Config.Strategy, "strategy", "Specify the build strategy to use if you don't want to detect (docker|pipeline|source).")
cmd.Flags().Var(&o.Config.Strategy, "strategy", "Specify the build strategy to use if you don't want to detect (docker|pipeline|source). NOTICE: the pipeline strategy is deprecated; consider using Jenkinsfiles directly on Jenkins or OpenShift Pipelines.")
cmd.Flags().StringP("labels", "l", "", "Label to set in all resources for this application.")
cmd.Flags().BoolVar(&o.Config.IgnoreUnknownParameters, "ignore-unknown-parameters", o.Config.IgnoreUnknownParameters, "If true, will not stop processing if a provided parameter does not exist in the template.")
cmd.Flags().BoolVar(&o.Config.InsecureRegistry, "insecure-registry", o.Config.InsecureRegistry, "If true, indicates that the referenced Docker images are on insecure registries and should bypass certificate checking")
Expand Down Expand Up @@ -457,6 +457,9 @@ func (o *AppOptions) RunNewApp() error {
installing = append(installing, t)
}
case *buildv1.BuildConfig:
if t.Spec.Strategy.Type == buildv1.JenkinsPipelineBuildStrategyType {
fmt.Fprintf(out, "%sNOTICE: the JenkinsPipeline strategy is deprecated; consider using Jenkinsfiles directly on Jenkins or OpenShift Pipelines.\n", indent)
}
triggered := false
for _, trigger := range t.Spec.Triggers {
switch trigger.Type {
Expand Down
5 changes: 4 additions & 1 deletion pkg/cli/newbuild/newbuild.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func NewCmdNewBuild(name, baseName string, f kcmdutil.Factory, streams genericcl
cmd.Flags().MarkHidden("build-env-file")
cmd.Flags().StringArrayVar(&o.Config.BuildEnvironmentFiles, "env-file", o.Config.BuildEnvironmentFiles, "File containing key-value pairs of environment variables to set into each container.")
cmd.MarkFlagFilename("env-file")
cmd.Flags().Var(&o.Config.Strategy, "strategy", "Specify the build strategy to use if you don't want to detect (docker|pipeline|source).")
cmd.Flags().Var(&o.Config.Strategy, "strategy", "Specify the build strategy to use if you don't want to detect (docker|pipeline|source). NOTICE: the pipeline strategy is deprecated; consider using Jenkinsfiles directly on Jenkins or OpenShift Pipelines.")
cmd.Flags().StringVarP(&o.Config.Dockerfile, "dockerfile", "D", o.Config.Dockerfile, "Specify the contents of a Dockerfile to build directly, implies --strategy=docker. Pass '-' to read from STDIN.")
cmd.Flags().StringArrayVar(&o.Config.BuildArgs, "build-arg", o.Config.BuildArgs, "Specify a key-value pair to pass to Docker during the build.")
cmd.Flags().BoolVar(&o.Config.BinaryBuild, "binary", o.Config.BinaryBuild, "Instead of expecting a source URL, set the build to expect binary contents. Will disable triggers.")
Expand Down Expand Up @@ -228,6 +228,9 @@ func (o *BuildOptions) RunNewBuild() error {
for _, item := range result.List.Items {
switch t := item.(type) {
case *buildv1.BuildConfig:
if t.Spec.Strategy.Type == buildv1.JenkinsPipelineBuildStrategyType {
fmt.Fprintf(out, "%sNOTICE: the JenkinsPipeline strategy is deprecated; consider using Jenkinsfiles directly on Jenkins or OpenShift Pipelines.\n", indent)
}
if len(t.Spec.Triggers) > 0 && t.Spec.Source.Binary == nil {
fmt.Fprintf(out, "%sBuild configuration %q created and build triggered.\n", indent, t.Name)
fmt.Fprintf(out, "%sRun '%s logs -f bc/%s' to stream the build progress.\n", indent, o.BaseName, t.Name)
Expand Down

0 comments on commit bfe27ca

Please sign in to comment.