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

Promotions created with job DSL are not visible

      I have a very simple promotion:

                promotion {
                    name('Production')
                    icon("star-gold")
                    conditions {
                        manual('teamA,teamB')
                    }
                    actions {
                      copyArtifacts('$PROMOTED_JOB_NAME') {
                        includePatterns('envInject.properties')
                        buildSelector {
                            buildNumber('$PROMOTED_NUMBER')
                        }
                       }
                        downstreamParameterized {
                          trigger("Dist-To-Prod"){
                            block {
                                buildStepFailure('never')
                                failure('FAILURE')
                                unstable('UNSTABLE')
                            }
                            parameters {
                              propertiesFile('envInject.properties',true)
                            }
                          }
                        }
                    }
                }
      

      When I go to the generated job promotion status, I don't see anything.
      If I go to the job configuration, and without changing anything, click on "Save", the promotions become visible.

      Looking the promotion XML, it seems like the isVisible element is missing.

      Am I missing something?

          [JENKINS-40262] Promotions created with job DSL are not visible

          Imri Zvik created issue -
          Imri Zvik made changes -
          Description Original: I have a very simple promotion:
          {code}
                    promotion {
                        name('Production')
                        icon("star-gold")
                        visible(true)
                        conditions {
                            manual('teamA,teamB')
                        }
                        actions {
                          copyArtifacts('$PROMOTED_JOB_NAME') {
                            includePatterns('envInject.properties')
                            buildSelector {
                                buildNumber('$PROMOTED_NUMBER')
                            }
                           }
                            downstreamParameterized {
                              trigger("Dist-To-Prod"){
                                block {
                                    buildStepFailure('never')
                                    failure('FAILURE')
                                    unstable('UNSTABLE')
                                }
                                parameters {
                                  propertiesFile('envInject.properties',true)
                                }
                              }
                            }
                        }
                    }
          {code}

          When I go to the generated job promotion status, I don't see anything.
          If I go to the job configuration, and without changing anything, click on "Save", the promotions become visible.

          Looking the promotion XML, it seems like the isVisible element is missing.

          Am I missing something?
          New: I have a very simple promotion:
          {code}
                    promotion {
                        name('Production')
                        icon("star-gold")
                        conditions {
                            manual('teamA,teamB')
                        }
                        actions {
                          copyArtifacts('$PROMOTED_JOB_NAME') {
                            includePatterns('envInject.properties')
                            buildSelector {
                                buildNumber('$PROMOTED_NUMBER')
                            }
                           }
                            downstreamParameterized {
                              trigger("Dist-To-Prod"){
                                block {
                                    buildStepFailure('never')
                                    failure('FAILURE')
                                    unstable('UNSTABLE')
                                }
                                parameters {
                                  propertiesFile('envInject.properties',true)
                                }
                              }
                            }
                        }
                    }
          {code}

          When I go to the generated job promotion status, I don't see anything.
          If I go to the job configuration, and without changing anything, click on "Save", the promotions become visible.

          Looking the promotion XML, it seems like the isVisible element is missing.

          Am I missing something?

          Imri Zvik added a comment -

          Imri Zvik added a comment - It seems like https://github.com/jenkinsci/promoted-builds-plugin/pull/76 and https://github.com/jenkinsci/promoted-builds-plugin/pull/82 didn't take each other into account.
          Daniel Spilker made changes -
          Assignee Original: Daniel Spilker [ daspilker ] New: Oleg Nenashev [ oleg_nenashev ]

          Redirecting to oleg_nenashev because this seems to be an issue in the Promoted Builds plugin.

          Daniel Spilker added a comment - Redirecting to oleg_nenashev because this seems to be an issue in the Promoted Builds plugin.

          Imri Zvik added a comment -

          Looking into this more carefully, it seems that this is actually a duplicate of JENKINS-41029, and maybe another small bug

          In my specific case, I had promotions both in the template (using()) and in the DSL it self.
          This resulted this badly formatted XML:

              <properties>
                  <hudson.plugins.promoted__builds.JobPropertyImpl plugin="promoted-builds@2.29-SNAPSHOT">
                      <activeProcessNames>
                          <string>from_template</string>
                      </activeProcessNames>
                  </hudson.plugins.promoted__builds.JobPropertyImpl>
                  <hudson.plugins.promoted__builds.JobPropertyImpl plugin="promoted-builds@2.29-SNAPSHOT">
                      <activeProcessNames>
                          <string>from_dsl</string>
                      </activeProcessNames>
                  </hudson.plugins.promoted__builds.JobPropertyImpl>
              </properties>
          

          Also, the "from_dsl" promotion got copied fully into the generated job, but the "from_template" was only copied into the xml.
          When you try to go to promotion in the UI in this state, the screen will be empty.
          Going into the job configuration, and clicking on save will remove the first promotion (from template), and will make the "from_dsl" one visible.

          Imri Zvik added a comment - Looking into this more carefully, it seems that this is actually a duplicate of JENKINS-41029 , and maybe another small bug In my specific case, I had promotions both in the template (using()) and in the DSL it self. This resulted this badly formatted XML: <properties> <hudson.plugins.promoted__builds.JobPropertyImpl plugin= "promoted-builds@2.29-SNAPSHOT" > <activeProcessNames> <string>from_template</string> </activeProcessNames> </hudson.plugins.promoted__builds.JobPropertyImpl> <hudson.plugins.promoted__builds.JobPropertyImpl plugin= "promoted-builds@2.29-SNAPSHOT" > <activeProcessNames> <string>from_dsl</string> </activeProcessNames> </hudson.plugins.promoted__builds.JobPropertyImpl> </properties> Also, the "from_dsl" promotion got copied fully into the generated job, but the "from_template" was only copied into the xml. When you try to go to promotion in the UI in this state, the screen will be empty. Going into the job configuration, and clicking on save will remove the first promotion (from template), and will make the "from_dsl" one visible.
          Imri Zvik made changes -
          Link New: This issue duplicates JENKINS-41029 [ JENKINS-41029 ]
          Imri Zvik made changes -
          Resolution New: Duplicate [ 3 ]
          Status Original: Open [ 1 ] New: Closed [ 6 ]
          Oleg Nenashev made changes -
          Epic Link New: JENKINS-44837 [ 182897 ]

            oleg_nenashev Oleg Nenashev
            imriz Imri Zvik
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: