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

Polling always finds changes when you checkout 2 branches of the same repo in the pipeline

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • git-plugin
    • jenkins 2.46.3
      git plugin 3.3.0
      pipeline 2.5

      I have a jenkins multibranch pipeline that is building the product, the tests and runs them.

      The product git repo contains the Jenkinsfile and the GitLab webhook is configured on the product git repo. In order to run the tests i need to :

      • checkout the master branch of the tests git repo - to setup the product (the master can install any supported upgrade path)
      • checkout the maintenance branch of the same tests git repo to run the tests applicable for the product installed

      Since the webhook/Jenkins file is configured on the product git repo i have configured scm polling for the master/maintenance branch of the tests git repo.

      However whenever the git pooling triggers it always finds changes in the tests git repo although there are none.

       

      Note: Just to be clear both branches of the tests git repo are checked out in separate folders.

       

      Expected behavior:

      The polling should consider the repo+branch combination as a separate entity, i.e.

      • change in tests repo master branch only - trigger a build
      • change in tests repo maintenance branch only - trigger a build
      • change in both tests repo master and maintenance branch - trigger a build
      • no changes in tests repo master/maintenance branches - no build triggered

       

      NOTE: Original comment added in https://issues.jenkins-ci.org/browse/JENKINS-39621

          [JENKINS-44762] Polling always finds changes when you checkout 2 branches of the same repo in the pipeline

          Pavel Georgiev created issue -
          Pavel Georgiev made changes -
          Summary Original: Pooling always finds changes when one checkouts one repo with 2 branches New: Pooling always finds changes when one checkouts 2 branches of the same repo in the pipeline
          Pavel Georgiev made changes -
          Summary Original: Pooling always finds changes when one checkouts 2 branches of the same repo in the pipeline New: Pooling always finds changes when you checkout 2 branches of the same repo in the pipeline
          Mark Waite made changes -
          Summary Original: Pooling always finds changes when you checkout 2 branches of the same repo in the pipeline New: Polling always finds changes when you checkout 2 branches of the same repo in the pipeline
          Martin Sander made changes -
          Link New: This issue is related to JENKINS-39621 [ JENKINS-39621 ]

          Martin Sander added a comment -

          To reproduce, use this simple pipeline definition:

          node {
              stage('checkout') {
                  ws() {
                      git 'https://github.com/jenkinsci/pipeline-examples.git'
                  }
                  ws() {
                      git branch: 'pipeline', url: 'https://github.com/jenkinsci/pipeline-examples.git'
                  }
              }
              
              stage('check branch') {
                  sh "git branch -a"
              }
          }
          

          Martin Sander added a comment - To reproduce, use this simple pipeline definition: node { stage( 'checkout' ) { ws() { git 'https: //github.com/jenkinsci/pipeline-examples.git' } ws() { git branch: 'pipeline' , url: 'https: //github.com/jenkinsci/pipeline-examples.git' } } stage( 'check branch' ) { sh "git branch -a" } }
          Pavel Georgiev made changes -
          Description Original: I have a jenkins multibranch pipeline that is building the product, the tests and runs them.

          The *product* git repo contains the Jenkinsfile and the GitLab webhook is configured on the *product* git repo. In order to run the tests i need to :
           * checkout the master branch of the *tests* git repo - to setup the product (the master can install any supported upgrade path)
           * checkout the maintenance branch of the same *tests* git repo to run the tests applicable for the product installed

          Since the webhook/Jenkins file is configured on the *product* git repo i have configured scm polling for the master/maintenance branch of the tests git repo.

          *However whenever the git pooling triggers it always finds changes.*

           

          NOTE: Original comment added in https://issues.jenkins-ci.org/browse/JENKINS-39621
          New: I have a jenkins multibranch pipeline that is building the product, the tests and runs them.

          The *product* git repo contains the Jenkinsfile and the GitLab webhook is configured on the *product* git repo. In order to run the tests i need to :
           * checkout the master branch of the *tests* git repo - to setup the product (the master can install any supported upgrade path)
           * checkout the maintenance branch of the same *tests* git repo to run the tests applicable for the product installed

          Since the webhook/Jenkins file is configured on the *product* git repo i have configured scm polling for the master/maintenance branch of the tests git repo.

          *However whenever the git pooling triggers it always finds changes in the tests git repo although there are none.*

           

          *Expected behavior:*

          The polling should consider the repo+branch combination as a separate entity, i.e.
           * change in tests repo *master* branch only - trigger a build
           * change in tests repo *maintenance* branch only - trigger a build
           * change in both tests repo *master* and *maintenance* branch - trigger a build
           * *no changes* in tests repo master/maintenance branches - *no build* triggered

           

          NOTE: Original comment added in https://issues.jenkins-ci.org/browse/JENKINS-39621
          Pavel Georgiev made changes -
          Description Original: I have a jenkins multibranch pipeline that is building the product, the tests and runs them.

          The *product* git repo contains the Jenkinsfile and the GitLab webhook is configured on the *product* git repo. In order to run the tests i need to :
           * checkout the master branch of the *tests* git repo - to setup the product (the master can install any supported upgrade path)
           * checkout the maintenance branch of the same *tests* git repo to run the tests applicable for the product installed

          Since the webhook/Jenkins file is configured on the *product* git repo i have configured scm polling for the master/maintenance branch of the tests git repo.

          *However whenever the git pooling triggers it always finds changes in the tests git repo although there are none.*

           

          *Expected behavior:*

          The polling should consider the repo+branch combination as a separate entity, i.e.
           * change in tests repo *master* branch only - trigger a build
           * change in tests repo *maintenance* branch only - trigger a build
           * change in both tests repo *master* and *maintenance* branch - trigger a build
           * *no changes* in tests repo master/maintenance branches - *no build* triggered

           

          NOTE: Original comment added in https://issues.jenkins-ci.org/browse/JENKINS-39621
          New: I have a jenkins multibranch pipeline that is building the product, the tests and runs them.

          The *product* git repo contains the Jenkinsfile and the GitLab webhook is configured on the *product* git repo. In order to run the tests i need to :
           * checkout the master branch of the *tests* git repo - to setup the product (the master can install any supported upgrade path)
           * checkout the maintenance branch of the same *tests* git repo to run the tests applicable for the product installed

          Since the webhook/Jenkins file is configured on the *product* git repo i have configured scm polling for the master/maintenance branch of the tests git repo.

          *However whenever the git pooling triggers it always finds changes in the tests git repo although there are none.*

           

          +*Note*+: Just to be clear both branches of the *tests git repo* are checked out in separate folders.

           

          *Expected behavior:*

          The polling should consider the repo+branch combination as a separate entity, i.e.
           * change in tests repo *master* branch only - trigger a build
           * change in tests repo *maintenance* branch only - trigger a build
           * change in both tests repo *master* and *maintenance* branch - trigger a build
           * *no changes* in tests repo master/maintenance branches - *no build* triggered

           

          NOTE: Original comment added in https://issues.jenkins-ci.org/browse/JENKINS-39621

          Jesse Glick added a comment -

          Probably another symptom of the well-known failure of the git plugin to correctly implement SCM APIs (see BuildData). No one has figured out how to refactor it without causing regressions for thousands of users.

          Jesse Glick added a comment - Probably another symptom of the well-known failure of the git plugin to correctly implement SCM APIs (see BuildData ). No one has figured out how to refactor it without causing regressions for thousands of users.
          Jesse Glick made changes -
          Component/s Original: pipeline [ 21692 ]
          Labels Original: git-client multibranch pipeline New: multibranch pipeline

            Unassigned Unassigned
            pgeorgiev Pavel Georgiev
            Votes:
            5 Vote for this issue
            Watchers:
            15 Start watching this issue

              Created:
              Updated: