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

Invoking properties / promotions / promotion twice results in inconsistent configuration

      When creating jobs via DSL we run them though a chain of decorators, relying heavily on the intelligent append/replace behavior of dsl elements.

      This works fine e.g. for the archiveArtifacts publisher.

      However when one invokes the promotion call twice like this:

                  job.with {
                              properties{
                                          promotions {
                                                  promotion {
                                                          name "First promotion"
      //...
                                                  }
                                          }
                              } 
                  }
      
                  job.with {              
                              properties{
                                          promotions {
                                                  promotion {
                                                          name "Second promotion"
      //...
                                                  }
                                          }
                              }                 
                   }       
      

       
      The result is:

      • if one views the web ui confiuguration form only the "Second promotion" is displayed
      • if one views the Promotion Status (buildUrl/promotion/) for the build or for the whole job only the "First promotion" is displayed
      • there are two "Promotion Status" links in the job sidebar and two badges (or how you call that) on the job status page
      • there is only a single "Promotion Status" link and badge on the build status page

          [JENKINS-43340] Invoking properties / promotions / promotion twice results in inconsistent configuration

          Merging the above code into a single promotions invocation fixes it:

                      job.with {
                                  properties{
                                              promotions {
                                                      promotion {
                                                              name "First promotion"
          //...
                                                      }
                                                      promotion {
                                                              name "Second promotion"
          //...
                                                      }
                                              }
                                  }                 
                       }       
          

          it's not that easy in our real setup though as the promotions are added by different parts of our code

          Jakub Bochenski added a comment - Merging the above code into a single promotions invocation fixes it: job.with { properties{ promotions { promotion { name "First promotion" //... } promotion { name "Second promotion" //... } } } } it's not that easy in our real setup though as the promotions are added by different parts of our code

          Oleg Nenashev added a comment -

          Should be fixed by somebody as a part of JENKINS-44837

          Oleg Nenashev added a comment - Should be fixed by somebody as a part of JENKINS-44837

            Unassigned Unassigned
            jbochenski Jakub Bochenski
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: