![]() |
|
|
|
|
Change By:
|
Sverre Moe
(12/Mar/15 9:38 AM)
|
|
Summary:
|
Downstream projects get same build cause as its upstream project
Matrix Job: Build Cause is always UpstreamCause
|
|
Description:
|
When a downstream
project
multi-configuration job
is triggered
it gets
by an upstream multi-configuration job,
the
same
build cause
as its upstream project
is always UpstreamCause
.
If upstream project ProjectA
When also a Multi-configuration job
is triggered
manually
alone,
by a
user
User or SCM
,
then
the
downstream project ProjectB gets the same
build cause
is still UpstreamCause
.
In effect there
There
is no way to find out if
ProjectB
a downstream job
was triggered from an upstream
project
job, since each matrix configurations is always upstream from its parent
.
From hudson.model.AbstractBuild:
For Multi-Configuration jobs then
build.getCauses() will always yield
a
hudson.model.Cause.UpstreamCause
Cause.toString() will always contain the original build cause from the upstream project. Cause.getClass() will always be Cause.UpstreamCause Cause.getShortDescription() will
Probably because each matrix configuration is a downstream build from its upstream parent.
Reproduce: Create 2 Free-style projects ProjectA and ProjectB Create 2 Multi-conf projects ProjectC and ProjectD
Add Groovy Postbuild with this script {code} manager.build.getCauses().each { cause -> manager.listener.logger.println(cause.getClass()) manager.listener.logger.println(cause.toString()) manager.listener.logger.println(cause.getShortDescription()) } {code}
It works for a Free-style project, but its wrong
build
cause in a Multi-Configuration Job.
Free-style Jobs: ProjectA
cause.toString() ==
1 class
hudson.model.Cause$UserIdCause
@caebc9aa
cause.getClass() == class
2
hudson.model.Cause$UserIdCause
@caebc9aa
3 Started by user Sverre Moe
ProjectB
cause
1 class hudson
.
toString() ==
model.Cause$UpstreamCause 2
job/
projectA
ProjectA
/
1
2
[hudson.model.Cause$UserIdCause@
2efba933
caebc9aa
]
cause.getClass() ==
3 Started by upstream project "ProjectA" build number 2
Only running ProjectB 1
class hudson.model.Cause$
UpstreamCause
UserIdCause
2 hudson.model.Cause$UserIdCause@caebc9aa
3 Started by user Sverre Moe
Multi-configuration Jobs:
ProjectA
ProjectC
cause
1 class hudson
.
toString() ==
model.Cause$UpstreamCause 2 job/ProjectC/1[
hudson.model.Cause$UserIdCause@caebc9aa
]
cause.getClass() ==
3 Started by upstream project "ProjectC" build number 1
ProjectD 1
class hudson.model.Cause$
UserIdCause
UpstreamCause
ProjectB cause.toString() ==
2
job/
projectA
ProjectD
/1[
job/ProjectC/1[
hudson.model.Cause$UserIdCause@
2efba933
caebc9aa
]
]
cause.getClass() ==
3 Started by upstream project "ProjectD" build number 1
Only running ProjectD: 1
class hudson.model.Cause$
UpstreamCause 2 job/ProjectD/2[hudson.model.Cause$
UserIdCause
@caebc9aa] 3 Started by upstream project "ProjectD" build number 2
The only way to find out if a project was triggered from an upstream project would be to parse toString(), find if it has a nested job. job/ProjectD/1[job/ProjectC/ == UpstreamCause job/ProjectD/ != UpstreamCause
|
|
|
|
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
|
--
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
[email protected].
For more options, visit
https://groups.google.com/d/optout.