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

Add environment variable for last successful build commit

    XMLWordPrintable

Details

    Description

      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?

      Attachments

        Activity

          drugcrazed Patrick Rose created issue -
          drugcrazed Patrick Rose made changes -
          Field Original Value New Value
          Environment Jenkins Git: 2.3.5
          Jenkins: 1.604
          drugcrazed 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.

          drugcrazed 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.
          alexnederlof 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
          rtyler R. Tyler Croy made changes -
          Workflow JNJira [ 161780 ] JNJira + In-Review [ 180830 ]
          ndeloof Nicolas De Loof made changes -
          Assignee Nicolas De Loof [ ndeloof ]

          This should be closed.

          mog Morgan Christiansson added a comment - This should be closed.

          People

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

            Dates

              Created:
              Updated: