<div dir="ltr"><div class="gmail-post-text">

<p>I come from Jenkins, and there, it is possible to obtain the Git 
commit hash associated with the last successful build on a Git branch. 
The environment variable <code>GIT_PREVIOUS_SUCCESSFUL_COMMIT</code> is 
provided by the Jenkins Git plugin. For each build, its value is set to 
the commit hash of the previous successfully built commit on the branch.
 The commit hash can then be used to compute the list of changed files. 
That's how I am able to get the list of changed files in Jenkins.</p>

<p>With Buildbot, how can I:</p>

<ul><li>get the Git commit hash of the last successful build for a branch, or alternatively,</li><li>get the list of changed files since the last successful build for a Git branch?</li></ul>

<p>I know how to get the list of changed files since the last build for a
 branch, but I just don't know how to get the list of changed files 
since the last <em>successful</em> build.</p>

<p><strong>Use cases</strong></p>

<ul><li><p>The list of changed files since the last successful build will be
 used in a build script. The build script (invoked as a Buildbot 
BuildFactory step) uses the list of changed files to determine how the 
project should be built.</p></li><li><p>The commit hash of last successful build is useful for rolling 
back source code to the last successful build's revision when newly 
submitted code does not work.</p></li></ul><div>(Originally posted on Stack Overflow (<a href="https://stackoverflow.com/q/57239124/5916915">https://stackoverflow.com/q/57239124/5916915</a>). The question has a Stack Overflow bounty ending on August 7, 2019.)<br></div>
    </div></div>