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

Add environment variable for last successful build commit

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Minor Minor
    • git-plugin
    • Jenkins Git: 2.3.5
      Jenkins: 1.604

      I have a build script that uses the last commit to find out which files have changed and perform code style analysis on those files alone. Running across the entire code base is infeasible (as it is too large and hangs).

      However, there's no easy way to get the last commit that was built successfully for the current branch. Is it possible to add a GIT_PREVIOUS_COMMIT_SUCCESSFUL environment variable?

          [JENKINS-27570] Add environment variable for last successful build commit

          Patrick Rose added a comment -

          Having had a brief look at the source code, I spotted GIT_PREVIOUS_SUCCESSFUL_COMMIT. This doesn't appear to work as expected - the commit it found is not a valid reference that I can check out afterwards.

          Patrick Rose added a comment - Having had a brief look at the source code, I spotted GIT_PREVIOUS_SUCCESSFUL_COMMIT . This doesn't appear to work as expected - the commit it found is not a valid reference that I can check out afterwards.

          Alex Nederlof added a comment -

          Alex Nederlof added a comment - This issue is outdated. GIT_PREVIOUS_SUCCESSFUL_COMMIT has been built: https://github.com/jenkinsci/git-plugin/blob/959bca0d9f92b31ed83c991bdbd6c24c2463daa3/src/main/java/hudson/plugins/git/GitSCM.java#L1183-L1206

          This should be closed.

          Morgan Christiansson added a comment - This should be closed.

            Unassigned Unassigned
            drugcrazed Patrick Rose
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: