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

Organization folder multiple sources not honored

      I'm working with an organization folder using the Github Branch Source Plugin. My aim is to have builds automatically start under two conditions:

      • A change is being merged to the base branch (main or master)
      • A branch has been created AND is marked as a pull request.

      To achieve this, I configure the folder to discover branches with two sets of config. I.e. I have multiple sources. The first one looks for PRs using the "Discover pull requests..." behaviour. The second looks for base merges using the "Discover branches" behaviour along with a wildcard filter. I configured it this way because I found with a single source, it was impossible to put together a single set of behaviours that met my requirements without triggering builds for all branches - PR or otherwise. 

      Expected behaviour

      Repositories that contain branches meeting either/both source criteria are created in the folder. I.e. if a repo contains PRs AND main branches, both of those things would be discovered.

      Actual behaviour

      Repositories are scanned and depending on which source criteria is met first, the other is then ignored in the future. For example, if I have a Jenkinsfile in my main branch and then do a PR, the PR is ignored because the project is now only expecting to see main branch changes. The same happens on the reverse (more realistic example)... I have a repo without a Jenkinsfile so I create a PR for it. I then merge my PR but the merge is ignored. 

          [JENKINS-70546] Organization folder multiple sources not honored

          Thomas created issue -
          Thomas made changes -
          Description Original: I am trying to build only for main branch and PRs. So far I have found that builds are automatically created for main, branches and PRs. The only way I have found to apply filtering to stop non-main branches from building except when they are PRs is to create multiple "repository sources" configurations - one for the PRs and one for main branches. 

          However, when multiple repository sources exist, it seems like only one of them is honored. E.g. if my repository has a Jenkinsfile in the main branch, it is then discovered. But then any PRs are ignored. Similarly if my main branch does not have a Jenkinsfile but the new PR does, the main branch is ignored even after I merge the PR. 

          I have attached a screenshot of my repository sources configuration.
          New: I am trying to build only for main branch and PRs. So far I have found that builds are automatically created for main, branches and PRs. The only way I have found to apply filtering to stop non-main branches from building except when they are PRs is to create multiple "repository sources" configurations - one for the PRs and one for main branches. 

          However, when multiple repository sources exist, it seems like only one of them is honored. E.g. if my repository has a Jenkinsfile in the main branch, it is then discovered. But then any PRs are ignored. Similarly if my main branch does not have a Jenkinsfile but the new PR does, the main branch is ignored even after I merge the PR. 

          I have attached a screenshot of my repository sources configuration.



          I'm working with an organization folder using the Github Branch Source Plugin. My aim is to have builds automatically start under two conditions:
          - A change is being merged to the base branch (main or master)
          - A branch has been created AND is marked as a pull request

          To achieve this, I configure the folder to discover branches with two sets of config. I.e. I have multiple sources. The first one looks for 
          Thomas made changes -
          Description Original: I am trying to build only for main branch and PRs. So far I have found that builds are automatically created for main, branches and PRs. The only way I have found to apply filtering to stop non-main branches from building except when they are PRs is to create multiple "repository sources" configurations - one for the PRs and one for main branches. 

          However, when multiple repository sources exist, it seems like only one of them is honored. E.g. if my repository has a Jenkinsfile in the main branch, it is then discovered. But then any PRs are ignored. Similarly if my main branch does not have a Jenkinsfile but the new PR does, the main branch is ignored even after I merge the PR. 

          I have attached a screenshot of my repository sources configuration.



          I'm working with an organization folder using the Github Branch Source Plugin. My aim is to have builds automatically start under two conditions:
          - A change is being merged to the base branch (main or master)
          - A branch has been created AND is marked as a pull request

          To achieve this, I configure the folder to discover branches with two sets of config. I.e. I have multiple sources. The first one looks for 
          New: I'm working with an organization folder using the Github Branch Source Plugin. My aim is to have builds automatically start under two conditions:
           - A change is being merged to the base branch (main or master)
           - A branch has been created AND is marked as a pull request.

          To achieve this, I configure the folder to discover branches with two sets of config. I.e. I have multiple sources. The first one looks for PRs using the "Discover pull requests..." behaviour. The second looks for base merges using the "Discover branches" behaviour along with a wildcard filter. I configured it this way because I found with a single source, it was impossible to put together a single set of behaviours that met my requirements without triggering builds for all branches - PR or otherwise. 

          *Expected behaviour*

          Repositories that contain branches meeting either/both source criteria are created in the folder. I.e. if a repo contains PRs AND main branches, both of those things would be discovered.

          *Actual behaviour*

          Repositories are scanned and depending on which source criteria is met first, the other is then ignored in the future. For example, if I have a Jenkinsfile in my main branch and then do a PR, the PR is ignored because the project is now only expecting to see main branch changes. The same happens on the reverse (more realistic example)... I have a repo without a Jenkinsfile so I create a PR for it. I then merge my PR but the merge is ignored. 

            Unassigned Unassigned
            tb0283970 Thomas
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: