• Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • git-plugin
    • Git Plugin 4.10.3

      The first build of a Pull Request reports no changes since last build.  I found this same issue closed due to no response https://issues.jenkins.io/browse/JENKINS-26354.

      In trying to automate builds based on change content, this issue is problematic.  Because the "first build" of a pull request (change request) reports that there is no changelog, there is no way for the job to know what file types changed.  It seems to me that the compare for the first job of a pull request should be comparing itself against the branch point.  For example, getting the branch point, and then looking for commits in the branch since that point with something like:

      branch_commit = git merge-base ${main} ${branch_name}
      commits_since_branch = git log ${branch_commit}..${branch_name}
      

      From original post, as it describes my issue perfectly:

      Suppose, we have master branch. Then we checkout to a new branch, lets name it branch1:

      git checkout -b branch1
      

      Then we do some commits:

      echo "a" > a.txt && git add a.txt && git commit -m 'Added file: a.txt'
      echo "b" > b.txt && git add b.txt && git commit -m 'Added file: b.txt'
      

      Then we push our branch to Git repository:

      git push origin branch1
      

      In Jenkins, Git polling reports:

      ...
      Seen branch in repository origin/branch1
      Seen XXX remote branches
       > /usr/bin/git log --full-history --no-abbrev --format=raw -M -m --raw 0a6eb107fea5bb6371c450db1b5f6e100e0fba28..d8c5018ca184fb75e46386de2f16e552906fe106 # timeout=10
      Done. Took 3.5 sec
      Changes found
      

      but Changes section shows nothing, it means, that no changes were made. Nevertheless, build was triggered.

          [JENKINS-68030] PR first time build has no changelog

          Derek Sharpe created issue -
          Derek Sharpe made changes -
          Description Original: The first build of a Pull Request reports no changes since last build.  I found this same issue closed due to no response https://issues.jenkins.io/browse/JENKINS-26354.

          In trying to automate builds based on change content, this issue is problematic.  Because the "first build" of a pull request (change request) reports that there is no changelog, there is no way for the job to know what file types changed.  It seems to me that the compare for the first job of a pull request should be comparing itself against the branch point.  For example, getting the branch point, and then looking for commits in the branch since that point with something like:

          branch_commit = git merge-base ${main} ${branch_name}

          commits_since_branch = git log ${branch_commit}..${branch_name}

           

          From original post, as it describes my issue perfectly:

          Suppose, we have _master_ branch. Then we checkout to a new branch, lets name it _branch1_:
          {code:java}
          git checkout -b branch1
          {code}
          Then we do some commits:
          {code:java}
          echo "a" > a.txt && git add a.txt && git commit -m 'Added file: a.txt'
          echo "b" > b.txt && git add b.txt && git commit -m 'Added file: b.txt'
          {code}
          Then we push our branch to Git repository:
          {code:java}
          git push origin branch1
          {code}
          In Jenkins, Git polling reports:
          {code:java}
          ...
          Seen branch in repository origin/branch1
          Seen XXX remote branches
           > /usr/bin/git log --full-history --no-abbrev --format=raw -M -m --raw 0a6eb107fea5bb6371c450db1b5f6e100e0fba28..d8c5018ca184fb75e46386de2f16e552906fe106 # timeout=10
          Done. Took 3.5 sec
          Changes found
          {code}
          but Changes section shows nothing, it means, that no changes were made. Nevertheless, build was triggered.
          New: The first build of a Pull Request reports no changes since last build.  I found this same issue closed due to no response https://issues.jenkins.io/browse/JENKINS-26354.

          In trying to automate builds based on change content, this issue is problematic.  Because the "first build" of a pull request (change request) reports that there is no changelog, there is no way for the job to know what file types changed.  It seems to me that the compare for the first job of a pull request should be comparing itself against the branch point.  For example, getting the branch point, and then looking for commits in the branch since that point with something like:
          {code:java}
          branch_commit = git merge-base ${main} ${branch_name}
          commits_since_branch = git log ${branch_commit}..${branch_name}
          {code}

          From original post, as it describes my issue perfectly:

          Suppose, we have _master_ branch. Then we checkout to a new branch, lets name it _branch1_:
          {code:java}
          git checkout -b branch1
          {code}
          Then we do some commits:
          {code:java}
          echo "a" > a.txt && git add a.txt && git commit -m 'Added file: a.txt'
          echo "b" > b.txt && git add b.txt && git commit -m 'Added file: b.txt'
          {code}
          Then we push our branch to Git repository:
          {code:java}
          git push origin branch1
          {code}
          In Jenkins, Git polling reports:
          {code:java}
          ...
          Seen branch in repository origin/branch1
          Seen XXX remote branches
           > /usr/bin/git log --full-history --no-abbrev --format=raw -M -m --raw 0a6eb107fea5bb6371c450db1b5f6e100e0fba28..d8c5018ca184fb75e46386de2f16e552906fe106 # timeout=10
          Done. Took 3.5 sec
          Changes found
          {code}
          but Changes section shows nothing, it means, that no changes were made. Nevertheless, build was triggered.
          Mark Waite made changes -
          Assignee Original: Mark Waite [ markewaite ]
          Derek Sharpe made changes -
          Comment [ Similarly, this command prints only the commits to this new branchgit log origin..HEAD ]
          Mark Waite made changes -
          Released As New: https://github.com/jenkinsci/git-plugin/releases/tag/git-5.3.0
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]

            Unassigned Unassigned
            dereksharpe Derek Sharpe
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: