Skip to content

Commit

Permalink
Merge branch 'master' into FlowGraphTableTest
Browse files Browse the repository at this point in the history
  • Loading branch information
jglick authored Jan 14, 2025
2 parents de268e4 + b5cc063 commit 8dcdaf4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
10 changes: 6 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@
</pluginRepositories>
<properties>
<changelist>999999-SNAPSHOT</changelist>
<jenkins.version>2.440.3</jenkins.version>
<!-- https://www.jenkins.io/doc/developer/plugin-development/choosing-jenkins-baseline/ -->
<jenkins.baseline>2.452</jenkins.baseline>
<jenkins.version>${jenkins.baseline}.4</jenkins.version>
<no-test-jar>false</no-test-jar>
<useBeta>true</useBeta>
<hpi.compatibleSinceVersion>3.0</hpi.compatibleSinceVersion>
Expand All @@ -73,8 +75,8 @@
<dependencies>
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-2.440.x</artifactId>
<version>3234.v5ca_5154341ef</version>
<artifactId>bom-${jenkins.baseline}.x</artifactId>
<version>3850.vb_c5319efa_e29</version>
<scope>import</scope>
<type>pom</type>
</dependency>
Expand Down Expand Up @@ -105,7 +107,7 @@
<!-- Required for running with Java 9+ -->
<groupId>org.jboss.marshalling</groupId>
<artifactId>jboss-marshalling-river</artifactId>
<version>2.2.1.Final</version>
<version>2.2.2.Final</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,25 @@ public abstract class DefaultStepContext extends StepContext {

/**
* Uses {@link #doGet} but automatically translates certain kinds of objects into others.
* <p>Note that some basic types are handled directly by {@link #get} and cannot be overridden,
* such as {@link Run}, {@link Job}, {@link FlowExecution}, and {@link FlowNode}.
* <p>{@inheritDoc}
*/
@Override public final <T> T get(Class<T> key) throws IOException, InterruptedException {
T value = doGet(key);
T value = null;
if (Run.class.isAssignableFrom(key)) {
value = castOrNull(key, getExecution().getOwner().getExecutable());
} else if (Job.class.isAssignableFrom(key)) {
value = castOrNull(key, get(Run.class).getParent());
} else if (FlowExecution.class.isAssignableFrom(key)) {
value = castOrNull(key, getExecution());
} else if (FlowNode.class.isAssignableFrom(key)) {
value = castOrNull(key, getNode());
}
if (value != null) {
return value;
}
value = doGet(key);
if (key == EnvVars.class) {
Run<?,?> run = get(Run.class);
EnvironmentAction a = run == null ? null : run.getAction(EnvironmentAction.class);
Expand Down Expand Up @@ -100,14 +115,6 @@ public abstract class DefaultStepContext extends StepContext {
}
*/
return castOrNull(key, n);
} else if (Run.class.isAssignableFrom(key)) {
return castOrNull(key, getExecution().getOwner().getExecutable());
} else if (Job.class.isAssignableFrom(key)) {
return castOrNull(key, get(Run.class).getParent());
} else if (FlowExecution.class.isAssignableFrom(key)) {
return castOrNull(key,getExecution());
} else if (FlowNode.class.isAssignableFrom(key)) {
return castOrNull(key, getNode());
} else {
// unrecognized key
return null;
Expand Down

0 comments on commit 8dcdaf4

Please sign in to comment.