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

Strategy: Inverse fails to prevent unwanted builds

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • git-plugin
    • Jenkins 1.644, Git plugin 2.40, Git client plugin 1.19.0, GitHub plugin 1.14.0

      I've two jobs: myproject and myproject-master

      The first job is supposed to build all commits that land in master. It does its job admirably. The second job is supposed to build all other branches except master. For that purpose, I configured it as follows:

         <scm class="hudson.plugins.git.GitSCM" plugin="git@2.4.0">
      ...
           <branches>
             <hudson.plugins.git.BranchSpec>
               <name>master</name>
             </hudson.plugins.git.BranchSpec>
           </branches>
      ...
           <extensions>
             <hudson.plugins.git.extensions.impl.BuildChooserSetting>
               <buildChooser class="hudson.plugins.git.util.InverseBuildChooser"/>
             </hudson.plugins.git.extensions.impl.BuildChooserSetting>
           </extensions>
      ...
         </scm>
      ...
         <triggers>
           <com.cloudbees.jenkins.GitHubPushTrigger plugin="github@1.14.0">
             <spec></spec>
           </com.cloudbees.jenkins.GitHubPushTrigger>
         </triggers>
         <concurrentBuild>false</concurrentBuild>
      

      What happens when I push a branch "foo": myproject-branch builds it.

      What happens when I push the master branch: myproject-branch wakes up, fetches upstream changes, then says this:

      Seen 98 remote branches
      No new revisions were found; the most-recently built branch will be built again.
      

      and proceeds to build an unrelated branch.

      What I expect: myproject-branch builds nothing.

          [JENKINS-32521] Strategy: Inverse fails to prevent unwanted builds

          Is this the exact same XML as on the server (censoring aside)? I found that recently (since my March 18 update), only the first "additional behaviour" gets used: I had an ancestry check (for age) as well as the Inverse behaviour, and only the topmost one was used, so either my job didn't build ancient commits with completely different folder structures, or it didn't build unrelated branches, but not both.

          Zalan Meggyesi added a comment - Is this the exact same XML as on the server (censoring aside)? I found that recently (since my March 18 update), only the first "additional behaviour" gets used: I had an ancestry check (for age) as well as the Inverse behaviour, and only the topmost one was used, so either my job didn't build ancient commits with completely different folder structures, or it didn't build unrelated branches, but not both.

          The Inverse build strategy is the only additional behaviour configured for this job.

          Marius Gedminas added a comment - The Inverse build strategy is the only additional behaviour configured for this job.

          Oleksandr added a comment - - edited

          It is a bug and as described here: JENKINS-21264 to fix:

          > No new revisions were found; the most-recently built branch will be built again.

          one need to add additional option: "Force polling using workspace". Then "Inverse" strategy results in:
          > No changes

          if there are no changes but trigger fires.

          Oleksandr added a comment - - edited It is a bug and as described here:  JENKINS-21264 to fix: > No new revisions were found; the most-recently built branch will be built again. one need to add additional option: " Force polling using workspace". Then "Inverse" strategy results in: > No changes if there are no changes but trigger fires.

            Unassigned Unassigned
            mgedmin Marius Gedminas
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: