Steve Mason
Steve Mason

Reputation: 23

Get updated changes files from Git in Jenkins

My job in Jenkins get the origin of the source code from a Git repository.

This is an example of the structure of the repository:

/repository
   /project1
       /premium.txt
   /project2
       /supplement.txt
   /project3
       /regulator.txt

I need to get the changes updated by the job for example:

Commit f341ldin3:

/project1/premium.txt

Should you use some Git command or some plugin or parameter to configure it in Jenkins? What is recommended?

Upvotes: 2

Views: 2828

Answers (2)

Marina Liu
Marina Liu

Reputation: 38136

To get changed files from Jenkins build job, you can add a Windows PowerShell step to achieve.

The PowerShell scripts as below:

$files=$(git diff head~ --name-only)
echo $files

enter image description here

Upvotes: 3

VonC
VonC

Reputation: 1329492

The JENKINS Git Plugin has a section "Branches to Build".

Simply add and push a new branch created on that commit, and you will be able to specify said branch (meaning that commit referenced by the branch HEAD) to be built by your job.

Upvotes: 0

Related Questions