Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate from EE 8 to EE 9 #105

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.88</version>
<version>5.5</version>
<relativePath />
</parent>
<artifactId>command-launcher</artifactId>
Expand All @@ -14,8 +14,8 @@
<changelist>999999-SNAPSHOT</changelist>
<gitHubRepo>jenkinsci/${project.artifactId}-plugin</gitHubRepo>
<!-- https://www.jenkins.io/doc/developer/plugin-development/choosing-jenkins-baseline/ -->
<jenkins.baseline>2.452</jenkins.baseline>
<jenkins.version>${jenkins.baseline}.4</jenkins.version>
<jenkins.baseline>2.479</jenkins.baseline>
<jenkins.version>${jenkins.baseline}.1</jenkins.version>
</properties>
<name>Command Agent Launcher Plugin</name>
<description>Allows agents to be launched using a specified command.</description>
Expand Down Expand Up @@ -49,7 +49,7 @@
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-${jenkins.baseline}.x</artifactId>
<version>3654.v237e4a_f2d8da_</version>
<version>3850.vb_c5319efa_e29</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/hudson/slaves/CommandConnector.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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() {
Expand All @@ -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");
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/hudson/slaves/CommandLauncher.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -245,7 +245,7 @@ private static void reportProcessTerminated(Process proc, TaskListener listener)
public static class DescriptorImpl extends Descriptor<ComputerLauncher> {

@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");
Expand Down Expand Up @@ -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<Ancestor> ancs = req.getAncestors();
for (Ancestor anc : ancs) {
Expand Down
Loading