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

Branch API inverse branch name matching not working

    XMLWordPrintable

Details

    Description

      Our project is configured to only automatically build the develop branch when changes are pushed to Bitbucket. This is accomplished by using the Branch API Property strategy that states 'Named branches get different properties.' We use inverse name matching to specify that all branches except for develop are to `Suppress automatic SCM triggering.` However, after upgrading our installed plugins, every branch builds automatically.

      See the attached image for our project configuration related to this issue.

      Here is a list of plugins with the previously installed version and the upgraded version:

      • Branch API Plugin 1.11.1 --> 2.0.2
      • Git Plugin 3.0.1 --> 3.0.4
      • Pipeline: Multibranch 2.9.2 --> 2.12
      • SCM API Plugin 1.3 --> 2.0.3

      Attachments

        Issue Links

          Activity

            you need to replace the / with %2F

            I'll need to investigate if we can fix this

            stephenconnolly Stephen Connolly added a comment - you need to replace the / with %2F I'll need to investigate if we can fix this

            The replacement '/' by '%2F' doesn't helped for me.

            dubrsl Viacheslav Dubrovskyi added a comment - The replacement '/' by '%2F' doesn't helped for me.

            what about %252F

            stephenconnolly Stephen Connolly added a comment - what about %252F
            dubrsl Viacheslav Dubrovskyi added a comment - - edited

            I can say more, the !master,!epic** doesn't work as expected.
            If I add !epic** It stop working for master too.
            In log I see:

            Checking branch epic/BAP-13553
            ‘Jenkinsfile’ found
            Met criteria
            Changes detected: epic/BAP-13553 (null → 40c14275e85dd805614d7838060a06e940085e22)
            Did not schedule build for branch: epic/BAP-13553

            Checking branch master
            ‘Jenkinsfile’ found
            Met criteria
            Changes detected: master (1c226faa06724bedd2b39af361102ad833dd7928 → 57be02e0308918ee5f7882e1b2b9446947d7f5f6)
            Did not schedule build for branch: master

            dubrsl Viacheslav Dubrovskyi added a comment - - edited I can say more, the !master,!epic** doesn't work as expected. If I add !epic** It stop working for master too. In log I see: Checking branch epic/BAP-13553 ‘Jenkinsfile’ found Met criteria Changes detected: epic/BAP-13553 (null → 40c14275e85dd805614d7838060a06e940085e22) Did not schedule build for branch: epic/BAP-13553 Checking branch master ‘Jenkinsfile’ found Met criteria Changes detected: master (1c226faa06724bedd2b39af361102ad833dd7928 → 57be02e0308918ee5f7882e1b2b9446947d7f5f6) Did not schedule build for branch: master

            Stephen, do you have any ideas?
            If no, I'll try make job as workaround and run branch job from it. Hope it will work.

            dubrsl Viacheslav Dubrovskyi added a comment - Stephen, do you have any ideas? If no, I'll try make job as workaround and run branch job from it. Hope it will work.

            Definitely test NamedExceptionsBranchPropertyStrategyTest with
            assertThat(isMatch("master", "!master,!epic/**"), is(false));
            Not pass.
            But I found solution for my case.
            I set branches in Include branches for github section and set PR-* in branch name for exception. And it working as expected: - run branchec and don't run PR

            dubrsl Viacheslav Dubrovskyi added a comment - Definitely test NamedExceptionsBranchPropertyStrategyTest with assertThat(isMatch("master", "!master,!epic/**"), is(false)); Not pass. But I found solution for my case. I set branches in Include branches for github section and set PR-* in branch name for exception. And it working as expected: - run branchec and don't run PR

            so the string !master,!epic/* is logically (NOT master) OR (NOT epic/) which is guaranteed to be true for any branch name as master and epic/* are disjoint.

            You need to split into two different exceptions.... or just define develop as the exception (without the `Suppress automatic SCM triggering`) and have the defaults be suppress

            Now if you want to raise an RFE to provide for AND style conditions in the branch name matching, that is another issue... frankly I do not see it being a direction we want to take things though

            stephenconnolly Stephen Connolly added a comment - so the string !master,!epic/* is logically (NOT master) OR (NOT epic/ ) which is guaranteed to be true for any branch name as master and epic/ * are disjoint. You need to split into two different exceptions.... or just define develop as the exception (without the `Suppress automatic SCM triggering`) and have the defaults be suppress Now if you want to raise an RFE to provide for AND style conditions in the branch name matching, that is another issue... frankly I do not see it being a direction we want to take things though

            People

              stephenconnolly Stephen Connolly
              bartsblues C B
              Votes:
              2 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: