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

PR first time build has no changelog

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • 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.

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

              Created:
              Updated: