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

Git build chooser only obeys first child of the extensions section

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Minor Minor
    • git-plugin
    • None
    • git-plugin 2.4.4
      Jenkins 1.653

      This issue was spun out of JENKINS-33695.

      Consider the following snippet from a job config.xml:

      <scm class="hudson.plugins.git.GitSCM" plugin="git@2.4.4">
      	<configVersion>2</configVersion>
      	<userRemoteConfigs>
      		<hudson.plugins.git.UserRemoteConfig>
      			<name>gitlab</name>
      			<url>[URL]</url>
      			<credentialsId>[CREDENTIAL]</credentialsId>
      		</hudson.plugins.git.UserRemoteConfig>
      	</userRemoteConfigs>
      	<branches>
      		<hudson.plugins.git.BranchSpec>
      			<name>**/master</name>
      		</hudson.plugins.git.BranchSpec>
      		<hudson.plugins.git.BranchSpec>
      			<name>**/bleeding</name>
      		</hudson.plugins.git.BranchSpec>
      	</branches>
      	<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
      	<submoduleCfg class="list"/>
      	<extensions>
      		<hudson.plugins.git.extensions.impl.BuildChooserSetting>
      			<buildChooser class="hudson.plugins.git.util.AncestryBuildChooser">
      				<maximumAgeInDays>14</maximumAgeInDays>
      				<ancestorCommitSha1/>
      			</buildChooser>
      		</hudson.plugins.git.extensions.impl.BuildChooserSetting>
      		<hudson.plugins.git.extensions.impl.BuildChooserSetting>
      			<buildChooser class="hudson.plugins.git.util.InverseBuildChooser"/>
      		</hudson.plugins.git.extensions.impl.BuildChooserSetting>
      	</extensions>
      </scm>
      

      According to this snippet, there should be two criteria for selecting a commit to build - it should both be less than 14 days old, and it should not be the master or bleeding branch (i.e. the chosen commit would be in the intersection of all BuildChooser selections).

      Currently, this is not the case, and the plugin will select any commit less than 14 days old for building.

      The breaking change seems to have been introduced in 2.4.1; 2.4.0 still produces the expected behavior.

            Unassigned Unassigned
            zmeggyesi Zalan Meggyesi
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: