See here: https://github.com/jenkinsci/jenkins/pull/4932
In complex automated build systems cascading events and starting builds
remotely, it can be useful to propagated a X-Correlation-ID to be able
to map related events all together from the begining to the end
As the initial piece of code is there, now, for example, others clients
starting builds remotely can propagate correlation Id which can be
retrieve thru the getCorrelationId() and on their turn, send
it/cascade/propagate it later on.
By using the Run.getCause(Cause.class).getCorrelationId, people will be able to understand from which remote system/request, this build was generated from & will be able to propagate it to others sub calls(others remote jobs, microservices on the backend or whatever), & then to follow from the begining/first caller having created the job to the end,
For example:
- Parameterized Remote Trigger Plugin to send a X-Correlation-ID in the header to Jenkins & get it stored in the Cause
- SCM Triggers to receive events containing X-Correlation-ID & also store them in the Cause
- Next others plugins invoked (Build Steps) in a Job which need to know from which original sender this job was started & to send this information to others backing services used in Build Steps or others.