From 4103732971b6185446b348653d7c4ffc9e824e20 Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Thu, 16 Jan 2025 16:58:52 -0800 Subject: [PATCH] Migrate from EE 8 to EE 9 --- pom.xml | 8 ++++---- src/main/java/hudson/slaves/CommandConnector.java | 6 +++--- src/main/java/hudson/slaves/CommandLauncher.java | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/pom.xml b/pom.xml index 69d8e84..d233be5 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.jenkins-ci.plugins plugin - 4.88 + 5.5 command-launcher @@ -14,8 +14,8 @@ 999999-SNAPSHOT jenkinsci/${project.artifactId}-plugin - 2.452 - ${jenkins.baseline}.4 + 2.479 + ${jenkins.baseline}.1 Command Agent Launcher Plugin Allows agents to be launched using a specified command. @@ -49,7 +49,7 @@ io.jenkins.tools.bom bom-${jenkins.baseline}.x - 3654.v237e4a_f2d8da_ + 3850.vb_c5319efa_e29 pom import diff --git a/src/main/java/hudson/slaves/CommandConnector.java b/src/main/java/hudson/slaves/CommandConnector.java index f9e4f97..4b360ec 100644 --- a/src/main/java/hudson/slaves/CommandConnector.java +++ b/src/main/java/hudson/slaves/CommandConnector.java @@ -42,7 +42,7 @@ import org.kohsuke.stapler.DataBoundConstructor; import org.kohsuke.stapler.QueryParameter; import org.kohsuke.stapler.Stapler; -import org.kohsuke.stapler.StaplerRequest; +import org.kohsuke.stapler.StaplerRequest2; /** * Executes a program on the controller and expect that script to connect. @@ -56,7 +56,7 @@ public class CommandConnector extends ComputerConnector { public CommandConnector(String command) { this.command = command; // TODO add withKey if we can determine the Cloud.name being configured - ScriptApproval.get().configuring(command, SystemCommandLanguage.get(), ApprovalContext.create().withCurrentUser(), Stapler.getCurrentRequest() == null); + ScriptApproval.get().configuring(command, SystemCommandLanguage.get(), ApprovalContext.create().withCurrentUser(), Stapler.getCurrentRequest2() == null); } private Object readResolve() { @@ -73,7 +73,7 @@ public CommandLauncher launch(String host, TaskListener listener) throws IOExcep @Extension @Symbol("command") public static class DescriptorImpl extends ComputerConnectorDescriptor { @Override - public ComputerConnector newInstance(@Nullable StaplerRequest req, @NonNull JSONObject formData) throws FormException { + public ComputerConnector newInstance(@Nullable StaplerRequest2 req, @NonNull JSONObject formData) throws FormException { CommandConnector instance = (CommandConnector) super.newInstance(req, formData); if (formData.get("oldCommand") != null) { String oldCommand = formData.getString("oldCommand"); diff --git a/src/main/java/hudson/slaves/CommandLauncher.java b/src/main/java/hudson/slaves/CommandLauncher.java index d8dc9bb..6ba8e04 100644 --- a/src/main/java/hudson/slaves/CommandLauncher.java +++ b/src/main/java/hudson/slaves/CommandLauncher.java @@ -57,7 +57,7 @@ import org.kohsuke.stapler.DataBoundConstructor; import org.kohsuke.stapler.QueryParameter; import org.kohsuke.stapler.Stapler; -import org.kohsuke.stapler.StaplerRequest; +import org.kohsuke.stapler.StaplerRequest2; /** * {@link ComputerLauncher} through a remote login mechanism like ssh/rsh. @@ -90,7 +90,7 @@ public CommandLauncher(String command) throws Descriptor.FormException { agentCommand = command; env = null; // TODO add withKey if we can determine the Slave.nodeName being configured - ScriptApproval.get().configuring(command, SystemCommandLanguage.get(), ApprovalContext.create().withCurrentUser(), Stapler.getCurrentRequest() == null); + ScriptApproval.get().configuring(command, SystemCommandLanguage.get(), ApprovalContext.create().withCurrentUser(), Stapler.getCurrentRequest2() == null); } /** Constructor for programmatic use. Always approves the script. @@ -245,7 +245,7 @@ private static void reportProcessTerminated(Process proc, TaskListener listener) public static class DescriptorImpl extends Descriptor { @Override - public ComputerLauncher newInstance(@Nullable StaplerRequest req, @NonNull JSONObject formData) throws FormException { + public ComputerLauncher newInstance(@Nullable StaplerRequest2 req, @NonNull JSONObject formData) throws FormException { CommandLauncher instance = (CommandLauncher) super.newInstance(req, formData); if (formData.get("oldCommand") != null) { String oldCommand = formData.getString("oldCommand"); @@ -297,7 +297,7 @@ public boolean filterType(@NonNull Class contextClass, @NonNull Descriptor de } private boolean isCreatingNewObject() { - var req = Stapler.getCurrentRequest(); + var req = Stapler.getCurrentRequest2(); if (req != null) { List ancs = req.getAncestors(); for (Ancestor anc : ancs) {