Skip to content

Commit

Permalink
javaOptions for InboundAgentRule
Browse files Browse the repository at this point in the history
  • Loading branch information
jglick committed Aug 29, 2024
1 parent f18f14e commit 8341a45
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main/java/org/jvnet/hudson/test/InboundAgentRule.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ public static final class Options implements Serializable {
private boolean secret;
private boolean webSocket;
@CheckForNull private String tunnel;
private List<String> javaOptions = new ArrayList<>();
private boolean start = true;
private final LinkedHashMap<String, Level> loggers = new LinkedHashMap<>();
private String label;
Expand Down Expand Up @@ -206,6 +207,11 @@ public Builder tunnel(String tunnel) {
return this;
}

public Builder javaOptions(String... opts) {
options.javaOptions.addAll(List.of(opts));
return this;
}

/**
* Skip starting the agent.
*
Expand Down Expand Up @@ -330,6 +336,7 @@ public void start(AgentArguments agentArguments, Options options) throws Excepti
cmd.add("-Xdebug");
cmd.add("Xrunjdwp:transport=dt_socket,server=y,address=" + (JenkinsRule.SLAVE_DEBUG_PORT + agentArguments.numberOfNodes - 1));
}
cmd.addAll(options.javaOptions);
cmd.addAll(List.of("-jar", agentArguments.agentJar.getAbsolutePath()));
if (agentArguments.agentJnlpUrl.endsWith("computer/" + options.getName() + "/slave-agent.jnlp") && remotingVersion(agentArguments.agentJar).isNewerThanOrEqualTo(new VersionNumber("3186.vc3b_7249b_87eb_"))) {
cmd.addAll(List.of("-url", agentArguments.agentJnlpUrl.replaceAll("computer/" + options.getName() + "/slave-agent.jnlp$", "")));
Expand Down

0 comments on commit 8341a45

Please sign in to comment.