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

Overriding build goal while performing a release

    Details

    • Similar Issues:

      Description

      The current release plugin performs a build twice when a release is done. It does one build using the default build goal and then it builds again using the release goal. I am trying to override the default build goal and just perform the release goal at time of release. To do so we need to have the release goal input from the user so have added one more field in the configuration environment. Kindly see the attached image.

      Thought this option is available in pre release menu but still it does not override the default build and performs two builds at time of release which take more time.

        Attachments

          Issue Links

            Activity

            Hide
            dantran dan tran added a comment -

            I need this as well. The current plugin we need to insert -B release:prepare release:perform to a pre-release step, the release ended up to build twice ( run the release and run the normal job) which make to build twice longer, and it is also very hacky. Harsh's proposal fits my need, and make maven release very nature to this plugin.

            Show
            dantran dan tran added a comment - I need this as well. The current plugin we need to insert -B release:prepare release:perform to a pre-release step, the release ended up to build twice ( run the release and run the normal job) which make to build twice longer, and it is also very hacky. Harsh's proposal fits my need, and make maven release very nature to this plugin.
            Hide
            hshah Harsh Shah added a comment -

            We found a way to have the jenkins release-plugin to notify Jenkins core to skip the default build

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

            This means we need help from Jenkins core dev to add new capability in Jenkins core to skip the default build step. Will file an RFE with Jenkins core

            Thanks

            [1] https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/model/Build.java

            [2] https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/model/Environment.java

            Show
            hshah Harsh Shah added a comment - We found a way to have the jenkins release-plugin to notify Jenkins core to skip the default build 1. Introduce a ‘release build step’, once it is executed and return back to Jenkins core [1] with an instance of Environment [2] 2. Set the return Environment instance to null, or introduce an new flag in the environment class which notifies to override the default build. 3. Jenkins core’s Build.java ( and related concrete class ) skip the default build step base on the status of the return Env instance or the status of the new flag This means we need help from Jenkins core dev to add new capability in Jenkins core to skip the default build step. Will file an RFE with Jenkins core Thanks [1] https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/model/Build.java [2] https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/model/Environment.java
            Hide
            ntshako Hannes Kogler added a comment - - edited

            @Harsh
            I don't exactly know what you mean but it sounds like a complicated workaround

            I would also prefer to get it really fixed in a clean way instead!
            VOTE

            Show
            ntshako Hannes Kogler added a comment - - edited @Harsh I don't exactly know what you mean but it sounds like a complicated workaround I would also prefer to get it really fixed in a clean way instead! VOTE
            Hide
            dantran dan tran added a comment -
            Show
            dantran dan tran added a comment - see JENKINS-27875
            Hide
            dantran dan tran added a comment -

            @Hannes, Environment class ( see the Build Environment UI) is the handshake object between build job and jenkins core, so it makes sense to put some way to notify the core via Environment

            Could you elaborate more on 'work around'?? is it from UI or from the backend? In UI, perhaps we can simplify it by just adding one more flat 'skip default build' and have the pre release step to do the maven release

            Show
            dantran dan tran added a comment - @Hannes, Environment class ( see the Build Environment UI) is the handshake object between build job and jenkins core, so it makes sense to put some way to notify the core via Environment Could you elaborate more on 'work around'?? is it from UI or from the backend? In UI, perhaps we can simplify it by just adding one more flat 'skip default build' and have the pre release step to do the maven release
            Hide
            hshah Harsh Shah added a comment - - edited

            @Hannes, the environment class in Jenkins core can have one more method with a return type boolean which by default always returns false. The method can be override in the release wrapper class of the release plugin. When the release wrapper class of the release plugin returns a new environment. We override the boolean method to return true if the default build needs to be override. I hope this give you some details.

            The option to override the default build can be provided in the UI too.

            Show
            hshah Harsh Shah added a comment - - edited @Hannes, the environment class in Jenkins core can have one more method with a return type boolean which by default always returns false. The method can be override in the release wrapper class of the release plugin. When the release wrapper class of the release plugin returns a new environment. We override the boolean method to return true if the default build needs to be override. I hope this give you some details. The option to override the default build can be provided in the UI too.

              People

              • Assignee:
                Unassigned
                Reporter:
                hshah Harsh Shah
              • Votes:
                2 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: