Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-27875

Add ability to skip the default build step triggered by downstream build step such as Jenkins release-plugin

      Hi

      we would like to use Jenkins release-plugin[1] to run maven release for Jenkins Maven freestyle job. This plugin works by configuring the Jenkins release-plugin pre-build step with a top level maven build with –B release:prepare release:perform. This big drawback is after the successful pre-build step, it also runs the default build step(usually with clean deploy). This means the build time is double.

      To solve the issue[2][3], we need a way to get downstream build step(ie Jenkins release plugin) to notify Jenkins-core to skip the default build steps

      Here are the proposes implementations
      1. Introduce a ‘release build step’, once it is executed and return back to Jenkins core[4] with an instance of Environment [5]
      2. Set the return Environment instance to null, or introduce a new flag in the Environment class .
      3. Jenkins core’s Build.java ( and related concrete class ) skip the default build step base on the status of the return Environment instance or the status of the new flag

      A pull request will follow

      By doing the change in Jenkins core the same problem in “M2Release plugin” can also be addressed. Thus providing a leverage to release plugin.

      Thanks
      1)https://wiki.jenkins-ci.org/display/JENKINS/Release+Plugin
      2)https://issues.jenkins-ci.org/browse/JENKINS-11120
      3)https://issues.jenkins-ci.org/browse/JENKINS-27723
      4)https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/model/Build.java
      5)https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/model/Environment.java

          [JENKINS-27875] Add ability to skip the default build step triggered by downstream build step such as Jenkins release-plugin

          James Nord added a comment -

          Note: m2release plugin doesn't have this issue as it doesn't execute maven again, (that is it replaces the maven goals with the release goals, rather than running them up-front.)

          James Nord added a comment - Note: m2release plugin doesn't have this issue as it doesn't execute maven again, (that is it replaces the maven goals with the release goals, rather than running them up-front.)

          James Nord added a comment -

          Isn't this already solvable by using the Conditional BuildStep plugin?

          James Nord added a comment - Isn't this already solvable by using the Conditional BuildStep plugin?

          dan tran added a comment -

          HI James, currently we cannot use m2release since we only use freestyle project(long story), could you point to the code where m2release swaps the project goals, perhaps we can do the same for release-plugin without touching the core

          Now that you mentioned Conditional BuildStep plugin, it may be possible, but i think my request looks much cleaner specially from UI perspective. Just one check box

          dan tran added a comment - HI James, currently we cannot use m2release since we only use freestyle project(long story), could you point to the code where m2release swaps the project goals, perhaps we can do the same for release-plugin without touching the core Now that you mentioned Conditional BuildStep plugin, it may be possible, but i think my request looks much cleaner specially from UI perspective. Just one check box

          James Nord added a comment -

          Hi Dan,
          Unfortunately the code is specific to the maven project type. http://javadoc.jenkins-ci.org/hudson/maven/MavenArgumentInterceptorAction.html

          James Nord added a comment - Hi Dan, Unfortunately the code is specific to the maven project type. http://javadoc.jenkins-ci.org/hudson/maven/MavenArgumentInterceptorAction.html

            petehayes Peter Hayes
            hshah Harsh Shah
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: