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

Builds get double promotions after promotion has been renamed

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved (View Workflow)
    • Minor
    • Resolution: Fixed
    • promoted-builds-plugin
    • None
    • Jenkins ver. 1.421
      Jenkins Promoted Builds Plugin 2.2

    Description

      When a promotion is renamed, all subsequent promotions of the new name will also promote it with the old name.

      To reproduce, I did the following:

      1. Create a job test-downstream, leave all settings as-is.
      2. Create a job test-upstream, and set the following:
        • Promote builds when ...
          • Name: First promotion
          • When the following downstream projects build successfully: test-downstream
        • Post-build actions, build other projects: test-downstream
      3. Save settings, and then click Configure again.
      4. Change the name of the promotion from First promotion to Second promotion.
      5. Save.
      6. Run the build of test-upstream, wait for the build of test-upstream and test-downstream to complete (about 10s with quiet periods etc).

      Now you'll observe that the new build has two gold stars: First promotion and Second promotion. Going to /job/test-upstream/1/promotion/ will show First promotion as "Pending promotion" for some reason. It shouldn't be there at all!

      Attachments

        Issue Links

          Activity

            jorgenpt Jørgen Tjernø created issue -
            jorgenpt Jørgen Tjernø made changes -
            Field Original Value New Value
            Description When a promotion is renamed, all subsequent promotions of the new name will also promote it with the old name.

            To reproduce, I did the following:
            Create a job test-downstream, leave all settings as-is.
            Create a job test-upstream, and set the following:
              Promote builds when ...
                Name: First promotion
                When the following downstream projects build successfully: test-downstream
              Post-build actions, build other projects: test-downstream

            Now save settings, and then click Configure again. Change First promotion to Second promotion and save. Run the build of test-upstream, wait for the build of test-upstream and test-downstream to complete (about 10s with quiet periods etc), observe that the new build has two gold stars: First promotion *and* Second promotion. Going to {{/job/test-upstream/1/promotion/}} will show First promotion as "Pending promotion" for some reason.
              
            When a promotion is renamed, all subsequent promotions of the new name will also promote it with the old name.

            To reproduce, I did the following:
            # Create a job test-downstream, leave all settings as-is.
            # Create a job test-upstream, and set the following:
            #* Promote builds when ...
            #** Name: ??First promotion??
            #** When the following downstream projects build successfully: ??test-downstream??
            #* Post-build actions, build other projects: ??test-downstream??
            # Save settings, and then click Configure again.
            # Change the name of the promotion from ??First promotion?? to ??Second promotion??.
            # Save.
            # Run the build of test-upstream, wait for the build of test-upstream and test-downstream to complete (about 10s with quiet periods etc).

            Now you'll observe that the new build has two gold stars: First promotion *and* Second promotion. Going to {{/job/test-upstream/1/promotion/}} will show First promotion as "Pending promotion" for some reason. It shouldn't be there at all!
            ndeloof Nicolas De Loof made changes -
            Link This issue is related to JENKINS-8783 [ JENKINS-8783 ]
            ndeloof Nicolas De Loof added a comment - proposed fix https://github.com/jenkinsci/promoted-builds-plugin/pull/14

            This seems like a hack or workaround rather than a fix - why is there disabled promotion there to begin with? Shouldn't the old one be deleted when it's renamed?

            jorgenpt Jørgen Tjernø added a comment - This seems like a hack or workaround rather than a fix - why is there disabled promotion there to begin with? Shouldn't the old one be deleted when it's renamed?

            Code changed in jenkins
            User: Nicolas De Loof
            Path:
            src/main/java/hudson/plugins/promoted_builds/PromotionProcess.java
            http://jenkins-ci.org/commit/promoted-builds-plugin/b0c0504e3d76b59389e72e6925ae15b5f93e8c70
            Log:
            [FIXED JENKINS-10423] don't run promotionProcess that are disabled

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Nicolas De Loof Path: src/main/java/hudson/plugins/promoted_builds/PromotionProcess.java http://jenkins-ci.org/commit/promoted-builds-plugin/b0c0504e3d76b59389e72e6925ae15b5f93e8c70 Log: [FIXED JENKINS-10423] don't run promotionProcess that are disabled
            scm_issue_link SCM/JIRA link daemon made changes -
            Resolution Fixed [ 1 ]
            Status Open [ 1 ] Resolved [ 5 ]

            Code changed in jenkins
            User: Stephen Connolly
            Path:
            src/main/java/hudson/plugins/promoted_builds/PromotionProcess.java
            http://jenkins-ci.org/commit/promoted-builds-plugin/b2f7cedb25664a5a85f075c99b14f674105360fc
            Log:
            Merge pull request #14 from ndeloof/master

            fix for JENKINS-10423

            Compare: https://github.com/jenkinsci/promoted-builds-plugin/compare/314089c...b2f7ced

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: src/main/java/hudson/plugins/promoted_builds/PromotionProcess.java http://jenkins-ci.org/commit/promoted-builds-plugin/b2f7cedb25664a5a85f075c99b14f674105360fc Log: Merge pull request #14 from ndeloof/master fix for JENKINS-10423 Compare: https://github.com/jenkinsci/promoted-builds-plugin/compare/314089c...b2f7ced
            dogfood dogfood added a comment -

            Integrated in plugins_promoted-builds #57
            [FIXED JENKINS-10423] don't run promotionProcess that are disabled

            Nicolas De Loof :
            Files :

            • src/main/java/hudson/plugins/promoted_builds/PromotionProcess.java
            dogfood dogfood added a comment - Integrated in plugins_promoted-builds #57 [FIXED JENKINS-10423] don't run promotionProcess that are disabled Nicolas De Loof : Files : src/main/java/hudson/plugins/promoted_builds/PromotionProcess.java

            @Jørgen

            It depends on why the promotion process was renamed.

            If the promotion process is renamed, you may want to retain the old promotions with the old name, or you may want to rename all the old promotions too. In reality JENKINS-8783 should be fixed by adding a three button confirm rather than [Yes]/[No] it should be [Rename process and all previous promotions of this process]/[Rename process leaving all previous promotions with the old name]/[No]

            That would make it clear why/how you can have disabled processes left lying around after a rename IMHO

            stephenconnolly Stephen Connolly added a comment - @Jørgen It depends on why the promotion process was renamed. If the promotion process is renamed, you may want to retain the old promotions with the old name, or you may want to rename all the old promotions too. In reality JENKINS-8783 should be fixed by adding a three button confirm rather than [Yes] / [No] it should be [Rename process and all previous promotions of this process] / [Rename process leaving all previous promotions with the old name] / [No] That would make it clear why/how you can have disabled processes left lying around after a rename IMHO

            Oh, thanks Stephen, now it makes much more sense to me. I didn't realize that it leaves the old promotions with the old name when you rename. Thanks for the fix!

            jorgenpt Jørgen Tjernø added a comment - Oh, thanks Stephen, now it makes much more sense to me. I didn't realize that it leaves the old promotions with the old name when you rename. Thanks for the fix!

            I'm seeing this happen again on v2.22 of this plugin.

            We renamed a promotion process and it resulted in double stars. We changed the name back and added a 2nd identical promotion process with the new name and deleted the old one. Still results in double stars. This is happening with a job that is inside one of the new folders. I don't know if that makes a difference or not.

            mpeters Michael Peters added a comment - I'm seeing this happen again on v2.22 of this plugin. We renamed a promotion process and it resulted in double stars. We changed the name back and added a 2nd identical promotion process with the new name and deleted the old one. Still results in double stars. This is happening with a job that is inside one of the new folders. I don't know if that makes a difference or not.
            mpeters Michael Peters made changes -
            Resolution Fixed [ 1 ]
            Status Resolved [ 5 ] Reopened [ 4 ]
            gradalajage Kyle Estes added a comment - - edited

            I saw this in v2.19. I thought updating to latest might fix it, but it continues to happen in v2.23.1. Like mpeters this is happening for a job in a folder.

            gradalajage Kyle Estes added a comment - - edited I saw this in v2.19. I thought updating to latest might fix it, but it continues to happen in v2.23.1. Like mpeters this is happening for a job in a folder.
            aheritier Arnaud Héritier made changes -
            Link This issue is related to JENKINS-12799 [ JENKINS-12799 ]

            This is not related to the usage of folders (the same problem exists without it).

            Workaround:

            • Open you job configuration
            • Add new promotion with the previous name before the renaming. They can be empty. Myself I just checked "Promote immediately once the build is complete"
            • Save your configuration
            • Open you job configuration a second time
            • Remove the promotion with the old name
            • Save your configuration

            Your job should now work correctly without breaking old promotions and the object model.

            The issue will be fixed by JENKINS-27716 in promotion plugin > 2.23.1 if you are running on Jenkins >= 1.585

            aheritier Arnaud Héritier added a comment - This is not related to the usage of folders (the same problem exists without it). Workaround: Open you job configuration Add new promotion with the previous name before the renaming. They can be empty. Myself I just checked "Promote immediately once the build is complete" Save your configuration Open you job configuration a second time Remove the promotion with the old name Save your configuration Your job should now work correctly without breaking old promotions and the object model. The issue will be fixed by JENKINS-27716 in promotion plugin > 2.23.1 if you are running on Jenkins >= 1.585
            aheritier Arnaud Héritier made changes -
            Resolution Fixed [ 1 ]
            Status Reopened [ 4 ] Resolved [ 5 ]
            aheritier Arnaud Héritier made changes -
            Link This issue is related to JENKINS-27716 [ JENKINS-27716 ]
            rtyler R. Tyler Croy made changes -
            Workflow JNJira [ 140615 ] JNJira + In-Review [ 189154 ]

            People

              Unassigned Unassigned
              jorgenpt Jørgen Tjernø
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: