Skip to content

Commit

Permalink
Merge pull request #384 from basil/refresh
Browse files Browse the repository at this point in the history
Require Jenkins 2.479.1 LTS or newer
  • Loading branch information
KostyaSha authored Oct 30, 2024
2 parents 91d9641 + e6d6dbb commit 8783201
Show file tree
Hide file tree
Showing 29 changed files with 98 additions and 98 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @jenkinsci/github-plugin-developers
2 changes: 1 addition & 1 deletion .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ jobs:
runs-on: ubuntu-latest
steps:
# Drafts your next Release notes as Pull Requests are merged into the default branch
- uses: release-drafter/release-drafter@v5
- uses: release-drafter/release-drafter@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .mvn/extensions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<extension>
<groupId>io.jenkins.tools.incrementals</groupId>
<artifactId>git-changelist-maven-extension</artifactId>
<version>1.7</version>
<version>1.8</version>
</extension>
</extensions>
22 changes: 10 additions & 12 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.77</version>
<version>5.2</version>
<relativePath />
</parent>

Expand Down Expand Up @@ -49,14 +49,13 @@
<properties>
<revision>1.40.1</revision>
<changelist>-SNAPSHOT</changelist>
<gitHubRepo>jenkinsci/github-plugin</gitHubRepo>
<jenkins.version>2.414.3</jenkins.version>
<gitHubRepo>jenkinsci/${project.artifactId}-plugin</gitHubRepo>
<!-- https://www.jenkins.io/doc/developer/plugin-development/choosing-jenkins-baseline/ -->
<jenkins.baseline>2.479</jenkins.baseline>
<jenkins.version>${jenkins.baseline}.1</jenkins.version>
<release.skipTests>false</release.skipTests>
<tagNameFormat>v@{project.version}</tagNameFormat>
<useBeta>true</useBeta> <!-- For Jenkins.MANAGE permission -->
<!-- TODO JENKINS-73339 until in parent POM -->
<jenkins-test-harness.version>2250.v03a_1295b_0a_30</jenkins-test-harness.version>
<maven.compiler.testRelease>17</maven.compiler.testRelease>
</properties>

<repositories>
Expand Down Expand Up @@ -184,14 +183,14 @@
<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock-jre8-standalone</artifactId>
<version>2.35.0</version>
<version>2.35.2</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>5.3.1</version>
<version>5.3.2</version>
<scope>test</scope>
</dependency>

Expand All @@ -201,8 +200,8 @@
<dependencies>
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-2.414.x</artifactId>
<version>2718.v7e8a_d43b_3f0b_</version>
<artifactId>bom-${jenkins.baseline}.x</artifactId>
<version>3559.vb_5b_81183b_d23</version>
<scope>import</scope>
<type>pom</type>
</dependency>
Expand All @@ -229,7 +228,7 @@

<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.1.2</version>
<version>3.6.0</version>
<executions>
<execution>
<id>checkstyle</id>
Expand All @@ -240,7 +239,6 @@
</execution>
</executions>
<configuration>
<encoding>UTF-8</encoding>
<failOnViolation>true</failOnViolation>
<logViolationsToConsole>true</logViolationsToConsole>
<linkXRef>false</linkXRef>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/cloudbees/jenkins/GitHubPushTrigger.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public void onPost() {
*/
public void onPost(String triggeredByUser) {
onPost(GitHubTriggerEvent.create()
.withOrigin(SCMEvent.originOf(Stapler.getCurrentRequest()))
.withOrigin(SCMEvent.originOf(Stapler.getCurrentRequest2()))
.withTriggeredByUser(triggeredByUser)
.build()
);
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/cloudbees/jenkins/GitHubTriggerEvent.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.cloudbees.jenkins;

import jakarta.servlet.http.HttpServletRequest;
import jenkins.scm.api.SCMEvent;

/**
Expand All @@ -14,7 +15,7 @@ public class GitHubTriggerEvent {
*/
private final long timestamp;
/**
* The origin of the event (see {@link SCMEvent#originOf(javax.servlet.http.HttpServletRequest)})
* The origin of the event (see {@link SCMEvent#originOf(HttpServletRequest)})
*/
private final String origin;
/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/cloudbees/jenkins/GitHubWebHook.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public List<Item> reRegisterAllHooks() {
@RequirePostWithGHHookPayload
public void doIndex(@NonNull @GHEventHeader GHEvent event, @NonNull @GHEventPayload String payload) {
GHSubscriberEvent subscriberEvent =
new GHSubscriberEvent(SCMEvent.originOf(Stapler.getCurrentRequest()), event, payload);
new GHSubscriberEvent(SCMEvent.originOf(Stapler.getCurrentRequest2()), event, payload);
from(GHEventsSubscriber.all())
.filter(isInterestedIn(event))
.transform(processEvent(subscriberEvent)).toList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import hudson.Extension;
import hudson.security.csrf.CrumbExclusion;

import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.FilterChain;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;

import static org.apache.commons.lang3.StringUtils.isEmpty;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import net.sf.json.JSONObject;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.DataBoundSetter;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerRequest2;

import edu.umd.cs.findbugs.annotations.CheckForNull;
import edu.umd.cs.findbugs.annotations.NonNull;
Expand Down Expand Up @@ -116,7 +116,7 @@ public String getDisplayName() {
}

@Override
public JobProperty<?> newInstance(@NonNull StaplerRequest req,
public JobProperty<?> newInstance(@NonNull StaplerRequest2 req,
JSONObject formData) throws Descriptor.FormException {

GithubProjectProperty tpp = req.bindJSON(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.cloudbees.jenkins.GitHubRepositoryName;
import org.kohsuke.stapler.AnnotationHandler;
import org.kohsuke.stapler.InjectedParameter;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerRequest2;
import org.slf4j.Logger;

import java.lang.annotation.Documented;
Expand Down Expand Up @@ -37,8 +37,8 @@ class PayloadHandler extends AnnotationHandler<GHRepoName> {
* @return {@link GitHubRepositoryName} extracted from request or null on any problem
*/
@Override
public GitHubRepositoryName parse(StaplerRequest req, GHRepoName a, Class type, String param) {
String repo = notNull(req, "Why StaplerRequest is null?").getParameter(param);
public GitHubRepositoryName parse(StaplerRequest2 req, GHRepoName a, Class type, String param) {
String repo = notNull(req, "Why StaplerRequest2 is null?").getParameter(param);
LOGGER.trace("Repo url in method {}", repo);
return GitHubRepositoryName.create(repo);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import org.kohsuke.stapler.HttpRedirect;
import org.kohsuke.stapler.HttpResponse;
import org.kohsuke.stapler.HttpResponses;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerRequest2;
import org.kohsuke.stapler.interceptor.RequirePOST;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -147,7 +147,7 @@ public boolean isActivated() {
*/
@RequirePOST
@RequireAdminRights
public HttpResponse doAct(StaplerRequest req) throws IOException {
public HttpResponse doAct(StaplerRequest2 req) throws IOException {
if (req.hasParameter("no")) {
disable(true);
return HttpResponses.redirectViaContextPath("/manage");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package org.jenkinsci.plugins.github.admin;

import jenkins.model.Jenkins;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
import org.kohsuke.stapler.StaplerRequest2;
import org.kohsuke.stapler.StaplerResponse2;
import org.kohsuke.stapler.interceptor.Interceptor;
import org.kohsuke.stapler.interceptor.InterceptorAnnotation;

import javax.servlet.ServletException;
import jakarta.servlet.ServletException;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import java.lang.reflect.InvocationTargetException;
Expand All @@ -29,7 +29,7 @@
class Processor extends Interceptor {

@Override
public Object invoke(StaplerRequest request, StaplerResponse response, Object instance, Object[] arguments)
public Object invoke(StaplerRequest2 request, StaplerResponse2 response, Object instance, Object[] arguments)
throws IllegalAccessException, InvocationTargetException, ServletException {

Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package org.jenkinsci.plugins.github.admin;

import org.kohsuke.stapler.HttpRedirect;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
import org.kohsuke.stapler.StaplerRequest2;
import org.kohsuke.stapler.StaplerResponse2;
import org.kohsuke.stapler.interceptor.Interceptor;
import org.kohsuke.stapler.interceptor.InterceptorAnnotation;

import javax.servlet.ServletException;
import jakarta.servlet.ServletException;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import java.lang.reflect.InvocationTargetException;
Expand All @@ -30,7 +30,7 @@
class Processor extends Interceptor {

@Override
public Object invoke(StaplerRequest request, StaplerResponse response, Object instance, Object[] arguments)
public Object invoke(StaplerRequest2 request, StaplerResponse2 response, Object instance, Object[] arguments)
throws IllegalAccessException, InvocationTargetException, ServletException {
target.invoke(request, response, instance, arguments);
throw new InvocationTargetException(new HttpRedirect("."));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package org.jenkinsci.plugins.github.admin;

import com.cloudbees.jenkins.GitHubRepositoryName;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
import org.kohsuke.stapler.StaplerRequest2;
import org.kohsuke.stapler.StaplerResponse2;
import org.kohsuke.stapler.interceptor.Interceptor;
import org.kohsuke.stapler.interceptor.InterceptorAnnotation;

import javax.servlet.ServletException;
import jakarta.servlet.ServletException;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import java.lang.reflect.InvocationTargetException;
Expand All @@ -16,7 +16,7 @@
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import static javax.servlet.http.HttpServletResponse.SC_BAD_REQUEST;
import static jakarta.servlet.http.HttpServletResponse.SC_BAD_REQUEST;
import static org.jenkinsci.plugins.github.util.FluentIterableWrapper.from;
import static org.kohsuke.stapler.HttpResponses.errorWithoutStack;

Expand All @@ -34,7 +34,7 @@
class Processor extends Interceptor {

@Override
public Object invoke(StaplerRequest request, StaplerResponse response, Object instance, Object[] arguments)
public Object invoke(StaplerRequest2 request, StaplerResponse2 response, Object instance, Object[] arguments)
throws IllegalAccessException, InvocationTargetException, ServletException {

if (!from(newArrayList(arguments)).firstMatch(instanceOf(GitHubRepositoryName.class)).isPresent()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.kohsuke.github.GitHub;
import org.kohsuke.stapler.DataBoundSetter;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerRequest2;
import org.kohsuke.stapler.interceptor.RequirePOST;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -191,7 +191,7 @@ protected XmlFile getConfigFile() {
}

@Override
public boolean configure(StaplerRequest req, JSONObject json) throws FormException {
public boolean configure(StaplerRequest2 req, JSONObject json) throws FormException {
hookSecretConfigs = null; // form binding might omit empty lists
try {
req.bindJSON(this, json);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ protected boolean applyNullSafe(@NonNull GHEventsSubscriber subscriber) {
*/
@Deprecated
public static Function<GHEventsSubscriber, Void> processEvent(final GHEvent event, final String payload) {
return processEvent(new GHSubscriberEvent(SCMEvent.originOf(Stapler.getCurrentRequest()), event, payload));
return processEvent(new GHSubscriberEvent(SCMEvent.originOf(Stapler.getCurrentRequest2()), event, payload));

Check warning on line 225 in src/main/java/org/jenkinsci/plugins/github/extension/GHEventsSubscriber.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 225 is not covered by tests
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.jenkinsci.plugins.github.extension;

import jakarta.servlet.http.HttpServletRequest;
import jenkins.scm.api.SCMEvent;
import org.kohsuke.github.GHEvent;

Expand All @@ -20,7 +21,7 @@ public class GHSubscriberEvent extends SCMEvent<String> {
/**
* Constructs a new {@link GHSubscriberEvent}.
*
* @param origin the origin (see {@link SCMEvent#originOf(javax.servlet.http.HttpServletRequest)}) or {@code null}.
* @param origin the origin (see {@link SCMEvent#originOf(HttpServletRequest)}) or {@code null}.
* @param ghEvent the type of event received from GitHub.
* @param payload the event payload.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import org.kohsuke.github.GHEvent;
import org.kohsuke.stapler.AnnotationHandler;
import org.kohsuke.stapler.InjectedParameter;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerRequest2;
import org.slf4j.Logger;

import javax.servlet.ServletException;
import jakarta.servlet.ServletException;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
Expand Down Expand Up @@ -42,7 +42,7 @@ class PayloadHandler extends AnnotationHandler<GHEventHeader> {
* @return parsed {@link GHEvent} or null on empty header or unknown value
*/
@Override
public Object parse(StaplerRequest req, GHEventHeader a, Class type, String param) throws ServletException {
public Object parse(StaplerRequest2 req, GHEventHeader a, Class type, String param) throws ServletException {
isTrue(GHEvent.class.isAssignableFrom(type),
"Parameter '%s' should has type %s, not %s", param,
GHEvent.class.getName(),
Expand Down
Loading

0 comments on commit 8783201

Please sign in to comment.