jenkinsci / jenkinsci/git-plugin

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

Open
#2,632 3 comments 0 reactions 0 assignees View on GitHub
component:git-plugin enhancement imported-jira-issue priority:minor resolution:unresolved
Dominant language
Java
Stars
694
Forks
1.1k
Avg merge
1h 29m
Merged PRs (30d)
3

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?

---
Originally reported by drugcrazed, imported from: Add environment variable for last successful build commit


  • status: Open
  • priority: Minor
  • component(s): git-plugin
  • label(s): environment-variables
  • resolution: Unresolved
  • votes: 1
  • watchers: 3
  • imported: 2025-12-02

Raw content of original issue

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?

environment

```
Jenkins Git: 2.3.5

Jenkins: 1.604
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.