-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from Vlatombe/JENKINS-60995
[JENKINS-60995] Implement a specific UpstreamCause class containing the nodeId that triggered the build
- Loading branch information
Showing
3 changed files
with
98 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/main/java/org/jenkinsci/plugins/workflow/support/steps/build/BuildUpstreamCause.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package org.jenkinsci.plugins.workflow.support.steps.build; | ||
|
||
import hudson.model.Cause; | ||
import hudson.model.Run; | ||
import java.util.Objects; | ||
import org.jenkinsci.plugins.workflow.graph.FlowNode; | ||
|
||
public class BuildUpstreamCause extends Cause.UpstreamCause { | ||
private final String nodeId; | ||
|
||
public BuildUpstreamCause(FlowNode node, Run<?, ?> invokingRun) { | ||
super(invokingRun); | ||
this.nodeId = node.getId(); | ||
} | ||
|
||
public String getNodeId() { | ||
return nodeId; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
if (!super.equals(o)) return false; | ||
BuildUpstreamCause that = (BuildUpstreamCause) o; | ||
return Objects.equals(nodeId, that.nodeId); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(super.hashCode(), nodeId); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters