3

Am looking for a solution where I can get change set of current build from last successful build.

We are using git hub as SCM

I want to get the change set redirected to a text file, where I can further perform operations on the change set content

I tried git diff --name-only $GIT_COMMIT $GIT_PREVIOUS_COMMIT

but of no use. Its ending up with error can not access commit id.

sravani srinija
  • 73
  • 1
  • 1
  • 7

1 Answers1

5

For your use case, you can use Jenkins global variables. To retrieve the changed files from current build you can use this one:

currentBuild.changeSets

To do the same but for the previous build:

currentBuild.previousBuild.changeSets

The full reference is here.

Adam
  • 737
  • 1
  • 6
  • 20