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

Promotion Plugin: promotion should fail if any actions are not performed

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • other
    • None
    • Platform: All, OS: All

      The promotion plugin show (when configuring a promotion) a number of possible
      actions to perform when a build is promoted. Many of the actions which are
      listed and can be configured do not actually run upon a promotion.

      Primarily this occurs when the BuildStep extends BuildStepCompatibilityLayer and
      does not override perform(AbstractBuild, Launcher, BuildListener) method so the
      BuildStep uses the implementation in BuildStepCompatibilityLayer which checks to
      see if the build is an instanceof Build, and then because it is not for a
      promotion build simply returns true without doing anything.

      Attached patch checks for actions which do not actually run (during promotion
      not during configuration) and

      • fails the action if it does not actually run because it is using
        BuildStepCompatibilityLayer perform(AbstractBuild,...) method
      • make promotion page more explicit about failed promotions by adding red/blue
        baloons.

      -also correctly build other projects (fixes Issue 1765) when that action is used
      (**)

      As an alternative fix mechanism, maybe BuildStepCompatibilityLayer should return
      false rather than true when the build is not a Build (but some other form of
      AbstractBuild). However that involves changes to the core, not the plugin, and
      could have implications elsewhere which I do not have sufficient familiarity
      with the codebase to explore.

      Also I was unable to find a way to not show the zombie actions (those that claim
      to work but do nothing) in the configuration screen. That would be a better
      mechanism if possble.

        • It was simplest to include both fixes in the same patch since they overlap.
          If required I could separate the two patches out, but would need to do one then
          wait for it to be committed, then supply the other. Let me know if that is
          required and which order.

          [JENKINS-2597] Promotion Plugin: promotion should fail if any actions are not performed

          brucechapman added a comment -

          blocks master issue (2576) for promotion actions not running, as well as 1765
          which is also fixed by (soon to be) attached patch.

          brucechapman added a comment - blocks master issue (2576) for promotion actions not running, as well as 1765 which is also fixed by (soon to be) attached patch.

          brucechapman added a comment -

          Created an attachment (id=430)
          Patch relative to plugins/promoted-builds

          brucechapman added a comment - Created an attachment (id=430) Patch relative to plugins/promoted-builds

          brucechapman added a comment -

          Patch attached. This patch also adds loging for the promotion build so that the
          steps (actions) can be seen in the build log and explain why the promotion
          succeeded or failed.

          brucechapman added a comment - Patch attached. This patch also adds loging for the promotion build so that the steps (actions) can be seen in the build log and explain why the promotion succeeded or failed.

          brucechapman added a comment -

          I can do this myself now

          brucechapman added a comment - I can do this myself now

          brucechapman added a comment -

          assigning to me.

          brucechapman added a comment - assigning to me.

          brucechapman added a comment -

          1765 portion has been committed separately.

          brucechapman added a comment - 1765 portion has been committed separately.

          Code changed in hudson
          User: : brucechapman
          Path:
          trunk/hudson/plugins/promoted-builds/src/main/java/hudson/plugins/promoted_builds/Promotion.java
          trunk/hudson/plugins/promoted-builds/src/main/resources/hudson/plugins/promoted_builds/PromotedBuildAction/index.jelly
          http://fisheye4.cenqua.com/changelog/hudson/?cs=14256
          Log:
          [FIX JENKINS-2597]Promotion should fail if any actions are not performed

          • fails the action if it does not actually run because it is using
            BuildStepCompatibilityLayer's perform(AbstractBuild,...) method (which does nothing but returns true)
          • make promotion page more explicit about failed promotions by adding red/blue
            balloons.
          • some logging so user can see that what actions failed and what succeeded.

          SCM/JIRA link daemon added a comment - Code changed in hudson User: : brucechapman Path: trunk/hudson/plugins/promoted-builds/src/main/java/hudson/plugins/promoted_builds/Promotion.java trunk/hudson/plugins/promoted-builds/src/main/resources/hudson/plugins/promoted_builds/PromotedBuildAction/index.jelly http://fisheye4.cenqua.com/changelog/hudson/?cs=14256 Log: [FIX JENKINS-2597] Promotion should fail if any actions are not performed fails the action if it does not actually run because it is using BuildStepCompatibilityLayer's perform(AbstractBuild,...) method (which does nothing but returns true) make promotion page more explicit about failed promotions by adding red/blue balloons. some logging so user can see that what actions failed and what succeeded.

          brucechapman added a comment -

          patch applied

          brucechapman added a comment - patch applied

            brucechapman brucechapman
            brucechapman brucechapman
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: