Skip to content
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: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: maven
directory: "/"
schedule:
interval: monthly
open-pull-requests-limit: 10
target-branch: master
12 changes: 12 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
See the documentation for more options:

https://github.com/jenkins-infra/pipeline-library/

*/
buildPlugin(
useContainerAgent: true, // Set to `false` if you need to use Docker for containerized tests
configurations: [
[platform: 'linux', jdk: 21],
[platform: 'windows', jdk: 17],
])
45 changes: 8 additions & 37 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>3.43</version>
<version>4.74</version>
<relativePath />
</parent>
<groupId>io.jenkins.plugins</groupId>
<artifactId>pipeline-restful-api</artifactId>
<version>0.13-SNAPSHOT</version>
<packaging>hpi</packaging>
<properties>
<jenkins.version>2.164.1</jenkins.version>
<java.level>8</java.level>
<jenkins.version>2.387.3</jenkins.version>
</properties>
<name>Pipeline restFul API Plugin</name>

Expand All @@ -25,45 +24,17 @@
</licenses>
<dependencies>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>structs</artifactId>
<version>1.19</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-step-api</artifactId>
<version>2.19</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-cps</artifactId>
<version>2.39</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-job</artifactId>
<version>2.11.2</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-basic-steps</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-durable-task-step</artifactId>
<version>2.13</version>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-2.387.x</artifactId>
<version>2179.v0884e842b_859</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-api</artifactId>
<version>2.30</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-support</artifactId>
<version>3.3</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.pipeline-stage-view</groupId>
<artifactId>pipeline-rest-api</artifactId>
Expand Down Expand Up @@ -91,7 +62,7 @@

<url>https://github.com/jenkinsci/pipeline-restful-api-plugin</url>
<scm>
<connection>scm:git:git://github.com/jenkinsci/${project.artifactId}-plugin.git</connection>
<connection>scm:git:https://github.com/jenkinsci/${project.artifactId}-plugin.git</connection>
<developerConnection>scm:git:git@github.com:jenkinsci/${project.artifactId}-plugin.git</developerConnection>
<url>https://github.com/jenkinsci/${project.artifactId}-plugin</url>
<tag>pipeline-restful-api-0.4</tag>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.net.URL;
import java.util.List;

Expand All @@ -32,7 +33,7 @@ public CpsFlowExecution create(FlowExecutionOwner owner, TaskListener listener,
try(InputStream input = new URL(url).openStream()) {
ByteArrayOutputStream data = new ByteArrayOutputStream();
IOUtils.copy(input, data);
script = data.toString();
script = data.toString(StandardCharsets.UTF_8);
}
return new CpsFlowExecution(this.script, this.sandbox, owner);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.HashMap;
Expand Down Expand Up @@ -158,12 +159,12 @@ public void setWriteListener(WriteListener writeListener) {
urlCon.setDoOutput(true);

urlCon.setRequestProperty("Content-Type", "application/json; charset=UTF-8");
JSONObject jsonObj = JSONObject.fromObject(output.toString());
JSONObject jsonObj = JSONObject.fromObject(output.toString(StandardCharsets.UTF_8));
jsonObj.getJSONObject("data").put("userName", user.getFullName());
urlCon.setFixedLengthStreamingMode(jsonObj.toString().length());

try(OutputStream os = urlCon.getOutputStream()) {
os.write(jsonObj.toString().getBytes());
os.write(jsonObj.toString().getBytes(StandardCharsets.UTF_8));
}

String result = "All set, jcli is ready! For example: 'jcli plugin list'. You can close this page now.";
Expand All @@ -178,9 +179,6 @@ public HttpResponse doSetLocation(@QueryParameter String rootURL, @QueryParamete
}

JenkinsLocationConfiguration config = JenkinsLocationConfiguration.get();
if (config == null) {
return HttpResponses.errorJSON("cannot set Jenkins location due to it is undefined");
}

if (StringUtils.isNotBlank(rootURL)) {
config.setUrl(rootURL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public void doBuild(StaplerRequest req, StaplerResponse rsp, @QueryParameter Tim
}

@ExportedBean
class IdentityBuild {
public static class IdentityBuild {
private WorkflowRun build;
private IdentifyCause cause;

Expand Down Expand Up @@ -298,7 +298,7 @@ public static CauseAction getBuildCause(ParameterizedJobMixIn.ParameterizedJob j
}

@ExportedBean
class IdentifyCause extends Cause {
public static class IdentifyCause extends Cause {
private String uuid;
private String message;

Expand Down