1

The currentBuild global variable in Jenkins has a method of getBuildCauses(). The Reference says this:

getBuildCauses Returns a JSON array of build causes for the current build

I was wondering, why does this method returns an array? Is there any possibility that a build was caused by several causes?

YoavKlein
  • 2,005
  • 9
  • 38

1 Answers1

1

There are cases where a job was triggered by another job that was e.g. started manually by a user. So this information about a user who triggered the parent job is made available in the array. In another case, this job may be rebuilt manually by a user from a previous run that was triggered by a webhook. Sometimes, people want to know the whole history of the job instance, and so it's made available in this array.

MaratC
  • 6,418
  • 2
  • 20
  • 27