Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
feature/JENKINS-38339-link-downstream-builds-to-trigger-node * Functi…
…onality OK, needs tests and javadocs
- Loading branch information
1 parent
3ff1439
commit b32359e
Showing
3 changed files
with
66 additions
and
29 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,5 @@ work | |
.project | ||
.classpath | ||
.settings | ||
.idea/ | ||
*.iml |
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
45 changes: 45 additions & 0 deletions
45
...main/java/org/jenkinsci/plugins/workflow/support/steps/build/BuildUpstreamNodeAction.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,45 @@ | ||
package org.jenkinsci.plugins.workflow.support.steps.build; | ||
|
||
import hudson.model.InvisibleAction; | ||
import hudson.model.Run; | ||
import org.jenkinsci.plugins.workflow.graph.FlowNode; | ||
|
||
import java.util.Objects; | ||
|
||
// TODO: Javadocs for all this | ||
public class BuildUpstreamNodeAction extends InvisibleAction { | ||
|
||
private final String upstreamNodeId; | ||
private final String upstreamRunId; | ||
|
||
public BuildUpstreamNodeAction(FlowNode node, Run<?, ?> invokingRun) { | ||
this.upstreamNodeId = node.getId(); | ||
this.upstreamRunId = invokingRun.getExternalizableId(); | ||
} | ||
|
||
public String getUpstreamNodeId() { | ||
return upstreamNodeId; | ||
} | ||
|
||
public String getUpstreamRunId() { | ||
return upstreamRunId; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
if (o == null || getClass() != o.getClass()) { | ||
return false; | ||
} | ||
BuildUpstreamNodeAction that = (BuildUpstreamNodeAction) o; | ||
return Objects.equals(upstreamNodeId, that.upstreamNodeId) && | ||
Objects.equals(upstreamRunId, that.upstreamRunId); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(upstreamNodeId, upstreamRunId); | ||
} | ||
} |