• Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Major Major
    • git-plugin
    • Jenkins ver. 1.591
      Git plugin 2.3.3
      GIT client plugin 1.15.0

      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.

      The problem is deeper, suppose our build runs unit tests, and they failed. In that case, no emails will be send to committers, because of no changes. We have caught this case and got a problems
      I think, it's a bug, because 2 new commits were created and Jenkins should show it in Changes section.

          [JENKINS-26354] First time build does not show changelog

          Max Usachev created issue -
          Max Usachev made changes -
          Summary Original: Git polling found changes but they are not displayed in Changes New: Git polling found changes but they are not displayed in Changes section

          Mark Waite added a comment -

          I can't duplicate the bug based on the steps you've provided. Can you provide more details or clarify the areas in which my steps are different than your steps?

          Steps I took:

          1. Create a new git repo ( repo=~/git/bugs/JENKINS-26534; mkdir -p $repo; cd $repo; git init )
          2. Commit a change to that repo ( branch=master; date >> $branch; git add $branch; git commit -m "Add date to $branch" )
          3. Create a freestyle project to monitor that repo ( poll git often, or create a post-receive hook )
          4. Define "Branches to build" as "*" so that any branch which appears will start a build
          5. Confirm that the project builds on its first polling interval
          6. Confirm that the log of the first build contains the line "First time build. Skipping changelog."
          7. Confirm that Changes and Recent Changes show no change for that first time build
          8. Add a branch to the repo with a commit ( branch=branch-a; git checkout -b $branch; date >> $branch; git add $branch; git commit -m "Add date to $branch" )
          9. Confirm that the next poll starts that job
          10. Confirm that the console output contains the line "First time build. Skipping changelog."
          11. Commit a second change to the branch (branch=branch-a; git checkout $branch; date >> $branch; git add $branch; git commit -m "Add date to $branch" )
          12. Confirm that the next poll starts that job
          13. Confirm that the changes show the commit (since it is not a first time build)

          Is the bug you're reporting that the first time build for a new branch does not list any changes? If so, it is difficult to make a good general case decision of what should be the basis of those changes.

          Mark Waite added a comment - I can't duplicate the bug based on the steps you've provided. Can you provide more details or clarify the areas in which my steps are different than your steps? Steps I took: Create a new git repo ( repo=~/git/bugs/ JENKINS-26534 ; mkdir -p $repo; cd $repo; git init ) Commit a change to that repo ( branch=master; date >> $branch; git add $branch; git commit -m "Add date to $branch" ) Create a freestyle project to monitor that repo ( poll git often, or create a post-receive hook ) Define "Branches to build" as "*" so that any branch which appears will start a build Confirm that the project builds on its first polling interval Confirm that the log of the first build contains the line "First time build. Skipping changelog." Confirm that Changes and Recent Changes show no change for that first time build Add a branch to the repo with a commit ( branch=branch-a; git checkout -b $branch; date >> $branch; git add $branch; git commit -m "Add date to $branch" ) Confirm that the next poll starts that job Confirm that the console output contains the line "First time build. Skipping changelog." Commit a second change to the branch (branch=branch-a; git checkout $branch; date >> $branch; git add $branch; git commit -m "Add date to $branch" ) Confirm that the next poll starts that job Confirm that the changes show the commit (since it is not a first time build) Is the bug you're reporting that the first time build for a new branch does not list any changes? If so, it is difficult to make a good general case decision of what should be the basis of those changes.

          Mark Waite added a comment -

          I confirmed that a multi-branch job (recently added plugin which allows a git or subversion based job to create a new job for each new branch detected) behaves similarly. The first build of a new job lists in the console output that it is a first time build and is not computing the changelog. Subsequent builds compute the changelog.

          Mark Waite added a comment - I confirmed that a multi-branch job (recently added plugin which allows a git or subversion based job to create a new job for each new branch detected) behaves similarly. The first build of a new job lists in the console output that it is a first time build and is not computing the changelog. Subsequent builds compute the changelog.

          Max Usachev added a comment -

          Yes, the problem related to the first time build for new branch, which was discovered by Git polling. For the next changes in existing remote branch changes are shown correct.
          I don't know details of the implementation of Git plugin, but it seems to me, that plugin can store list of all commit hashes of repository and when it see new remote branch, try to find those commits which are in new branch but not in commits store.
          And then build changelog based on these commits.

          Max Usachev added a comment - Yes, the problem related to the first time build for new branch, which was discovered by Git polling. For the next changes in existing remote branch changes are shown correct. I don't know details of the implementation of Git plugin, but it seems to me, that plugin can store list of all commit hashes of repository and when it see new remote branch, try to find those commits which are in new branch but not in commits store. And then build changelog based on these commits.
          Mark Waite made changes -
          Summary Original: Git polling found changes but they are not displayed in Changes section New: First time build does not show changelog

          Mark Waite added a comment -

          There isn't any way to reliably decide which branch should be the basis for the diff calculation you're proposing for an initial branch. There may be many different heuristics (fallible rules) which could be applied to the case, but there will be cases where each of the heuristics is wrong.

          Mark Waite added a comment - There isn't any way to reliably decide which branch should be the basis for the diff calculation you're proposing for an initial branch. There may be many different heuristics (fallible rules) which could be applied to the case, but there will be cases where each of the heuristics is wrong.
          Mark Waite made changes -
          Resolution New: Won't Fix [ 2 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 160419 ] New: JNJira + In-Review [ 196422 ]

          Ben Wicks added a comment - - edited

          This happens for us too. The git plugin reports the correct commit hash of the changeset but it shows No Changes on the Changes view.

          What is the fix? Thanks.

          Ben Wicks added a comment - - edited This happens for us too. The git plugin reports the correct commit hash of the changeset but it shows No Changes on the Changes view. What is the fix? Thanks.

            ndeloof Nicolas De Loof
            maxusachev Max Usachev
            Votes:
            0 Vote for this issue
            Watchers:
            17 Start watching this issue

              Created:
              Updated:
              Resolved: