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

Flexible publish plugin doesn't always instantiate correct child plugin

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Major Major
    • None
    • Windows, Jenkins LTS 1.596.3. Flexible Publish 0.15.2

      I have discovered that some plugins provide inconsistent behavior with the flexible publish plugin and have isolated a specific use case that may be helpful for debugging and discussion.

      (Keep in mind that I have very little knowledge of the internal workings of Jenkins, so take some of my technical assumptions below within that context)

      Problem
      Using the flexible publish plugin to conditionally set the "Description" of a build using the Description Setter plugin seems to work correctly so long as you provide a single conditional operation to the flexible publish plugin, but when more conditional actions are added subsequent instances of the description setter plugin do not expose all of their available options on the Jenkins UI. In this example case, the first instance exposes an "Advanced..." button allowing the customization of extra parameters not presented in the default list of options, where as subsequent instances do not provide such a button. See the attached sample.png for a visual.

      Closer examination of the XML generated by the Jenkins UI reveals that the Flexible Publish plugin is making reference to two different Jenkins plugins / classes for these divergent instances. In this example, the first instance of the Description Setter action is using a "DescriptionSetterPublisher" object, where as all subsequent instances are using a "DescriptionSetterBuilder" object, which may help shed some light on the problem. Below is a snippet from the config.xml for the job configuration presented in the attached screenshot:

      <org.jenkins__ci.plugins.flexible__publish.FlexiblePublisher plugin="flexible-publish@0.15.2">
          <publishers>
              <org.jenkins__ci.plugins.flexible__publish.ConditionalPublisher>
                  <condition class="org.jenkins_ci.plugins.run_condition.logic.Not" plugin="run-condition@1.0">
                      <condition class="org.jenkins_ci.plugins.run_condition.core.BooleanCondition">
                          <token>${IS_CLEAN_BUILD}</token>
                      </condition>
                  </condition>
                  <publisherList>
                      <hudson.plugins.descriptionsetter.DescriptionSetterPublisher plugin="description-setter@1.10">
                          <regexp/>
                          <regexpForFailed/>
                          <description>OracleVersion: ${OracleVersion}</description>
                          <descriptionForFailed>OracleVersion: ${OracleVersion} </descriptionForFailed>
                          <setForMatrix>false</setForMatrix>
                      </hudson.plugins.descriptionsetter.DescriptionSetterPublisher>
                  </publisherList>
                  <runner class="org.jenkins_ci.plugins.run_condition.BuildStepRunner$Fail" plugin="run-condition@1.0"/>
                  <executionStrategy class="org.jenkins_ci.plugins.flexible_publish.strategy.FailAtEndExecutionStrategy"/>
              </org.jenkins__ci.plugins.flexible__publish.ConditionalPublisher>
              
              <org.jenkins__ci.plugins.flexible__publish.ConditionalPublisher>
                  <condition class="org.jenkins_ci.plugins.run_condition.core.BooleanCondition" plugin="run-condition@1.0">
                      <token>${IS_CLEAN_BUILD}</token>
                  </condition>
                  <publisherList>
                      <hudson.plugins.descriptionsetter.DescriptionSetterBuilder plugin="description-setter@1.10">
                          <regexp/>
                          <description>OracleVersion: both</description>
                      </hudson.plugins.descriptionsetter.DescriptionSetterBuilder>
                  </publisherList>
                  <runner class="org.jenkins_ci.plugins.run_condition.BuildStepRunner$Fail" plugin="run-condition@1.0"/>
                  <executionStrategy class="org.jenkins_ci.plugins.flexible_publish.strategy.FailAtEndExecutionStrategy"/>
              </org.jenkins__ci.plugins.flexible__publish.ConditionalPublisher>
          </publishers>
      </org.jenkins__ci.plugins.flexible__publish.FlexiblePublisher>
      

      Based on this information, it appears as though somehow the Flexible Publisher correctly instantiates the first child object - since the options that are presented on the UI do appear to be complete and correct in this case - but subsequent instances are not correctly instantiated for some reason.

      I am assuming here that the underlying problem is some inherent implementation problem in the Flexible Publish plugin, however I suppose it could be a problem with the Description Setter plugin as well. I probably should mention that I have found similar behavior with other Jenkins plugins when used under the Flexible Publisher which does seem to reinforce my assumption. Also, given the fact the first instance of a child plugin under Flexible Publish does get instantiated correctly it suggests that the interaction between the two does work correctly in some cases which again seems to reinforce my assumption since if the link between the publisher and the child plugins were broken I would expect them to never work which is clearly not the case.

        1. build_vs_postbuild_options.png
          26 kB
          Kevin Phillips
        2. duplicate_actions_example.png
          37 kB
          Kevin Phillips
        3. post_build_actions.png
          39 kB
          Kevin Phillips
        4. sample.png
          39 kB
          Kevin Phillips
        5. Screen Shot 2016-01-21 at 07.49.00.png
          310 kB
          ikedam

            ikedam ikedam
            leedega Kevin Phillips
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: