Migrated from DataDog/jenkins-datadog-plugin#115
Description
I need to change a tag value based on what triggered the build (i.e. what's the build cause). After a lot of tinkering, I'm doing something like this:
def cause = 'something' // actually comes from currentBuild.rawBuild.getCause...
properties([
[
$class: 'DatadogJobProperty',
tagProperties: "cause=${cause}"
]
])
And this sort of works, but isn't really reliable. It causes issues when multiple jobs run concurrently. The current DatadogJobProperty value is used whenever a build finishes. That means that if job A starts with cause "A" and job B starts with cause "B" before A finishes running, then both jobs will use the last DatadogJobProperty which has "B" configured as the cause.
I also tried the following, but this fails to set the value altogether. The tag ends up as cause=_cause.
env.CAUSE = 'something' // actually comes from currentBuild.rawBuild.getCause...
properties([
[
$class: 'DatadogJobProperty',
tagProperties: 'cause=${CAUSE}'
]
])
Migrated from DataDog/jenkins-datadog-plugin#115
Description
I need to change a tag value based on what triggered the build (i.e. what's the build cause). After a lot of tinkering, I'm doing something like this:
And this sort of works, but isn't really reliable. It causes issues when multiple jobs run concurrently. The current
DatadogJobPropertyvalue is used whenever a build finishes. That means that if job A starts with cause "A" and job B starts with cause "B" before A finishes running, then both jobs will use the lastDatadogJobPropertywhich has "B" configured as the cause.I also tried the following, but this fails to set the value altogether. The tag ends up as
cause=_cause.