diff --git a/Jenkinsfile b/Jenkinsfile index 913fb4a55..c9afbde48 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,5 +4,5 @@ */ buildPlugin(useContainerAgent: false, configurations: [ [platform: 'linux', jdk: 21], - [platform: 'windows', jdk: 11], + [platform: 'windows', jdk: 21], ]) diff --git a/docs/security_obs.md b/docs/security_obs.md index 962a7f62a..236fc34a8 100644 --- a/docs/security_obs.md +++ b/docs/security_obs.md @@ -14,7 +14,7 @@ Successful and failed log in events are captured as structured log messages: * `event.category`: `authentication` * `event.action`: `user_login` * `event.outcome`: `success` - * `net.peer.ip`: `javax.servlet.ServletRequest.getRemoteAddr()` + * `net.peer.ip`: `jakarta.servlet.ServletRequest.getRemoteAddr()` * Body * Example: "Successful login of user 'admin' from 127.0.0.1" * Login failure diff --git a/pom.xml b/pom.xml index 1b017db55..b3134478e 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ org.jenkins-ci.plugins plugin - 4.88 + 5.2 io.jenkins.plugins @@ -20,7 +20,8 @@ 3 999999-SNAPSHOT - 2.440.3 + 2.479 + ${jenkins.baseline}.1 jenkinsci/${project.artifactId}-plugin 1.43.0 1.43.0-38.v1a_9b_53e3f70f @@ -44,8 +45,8 @@ io.jenkins.tools.bom - bom-2.440.x - 3435.v238d66a_043fb_ + bom-${jenkins.baseline}.x + 3613.v584fca_12cf5c import pom diff --git a/src/main/java/io/jenkins/plugins/opentelemetry/JenkinsOpenTelemetryPluginConfiguration.java b/src/main/java/io/jenkins/plugins/opentelemetry/JenkinsOpenTelemetryPluginConfiguration.java index e8d6ce5b2..0944b1035 100644 --- a/src/main/java/io/jenkins/plugins/opentelemetry/JenkinsOpenTelemetryPluginConfiguration.java +++ b/src/main/java/io/jenkins/plugins/opentelemetry/JenkinsOpenTelemetryPluginConfiguration.java @@ -54,7 +54,7 @@ import org.kohsuke.stapler.DataBoundConstructor; import org.kohsuke.stapler.DataBoundSetter; import org.kohsuke.stapler.QueryParameter; -import org.kohsuke.stapler.StaplerRequest; +import org.kohsuke.stapler.StaplerRequest2; import javax.annotation.PreDestroy; import javax.inject.Inject; @@ -170,7 +170,7 @@ public JenkinsOpenTelemetryPluginConfiguration() { } @Override - public boolean configure(StaplerRequest req, JSONObject json) throws FormException { + public boolean configure(StaplerRequest2 req, JSONObject json) throws FormException { LOGGER.log(Level.FINE, "Configure..."); req.bindJSON(this, json); // stapler oddity, empty lists coming from the HTTP request are not set on bean by `req.bindJSON(this, json)` diff --git a/src/main/java/io/jenkins/plugins/opentelemetry/OtelUtils.java b/src/main/java/io/jenkins/plugins/opentelemetry/OtelUtils.java index 48fccda71..551e608c1 100644 --- a/src/main/java/io/jenkins/plugins/opentelemetry/OtelUtils.java +++ b/src/main/java/io/jenkins/plugins/opentelemetry/OtelUtils.java @@ -23,7 +23,7 @@ import java.util.logging.Logger; import java.util.stream.Collectors; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; import org.apache.commons.codec.net.URLCodec; import org.apache.commons.lang.StringUtils; diff --git a/src/main/java/io/jenkins/plugins/opentelemetry/administrativemonitor/ElasticBackendDashboardNotEnabledAdministrativeMonitor.java b/src/main/java/io/jenkins/plugins/opentelemetry/administrativemonitor/ElasticBackendDashboardNotEnabledAdministrativeMonitor.java index 153bcb037..f346bc681 100644 --- a/src/main/java/io/jenkins/plugins/opentelemetry/administrativemonitor/ElasticBackendDashboardNotEnabledAdministrativeMonitor.java +++ b/src/main/java/io/jenkins/plugins/opentelemetry/administrativemonitor/ElasticBackendDashboardNotEnabledAdministrativeMonitor.java @@ -12,8 +12,8 @@ import org.apache.commons.lang.StringUtils; import org.kohsuke.stapler.HttpResponse; import org.kohsuke.stapler.HttpResponses; -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.RequirePOST; import javax.inject.Inject; @@ -42,7 +42,7 @@ public boolean isActivated() { * Depending on whether the user said "yes" or "no", send him to the right place. */ @RequirePOST - public HttpResponse doAct(StaplerRequest req, StaplerResponse rsp) throws IOException { + public HttpResponse doAct(StaplerRequest2 req, StaplerResponse2 rsp) throws IOException { if (req.hasParameter("no")) { disable(true); } diff --git a/src/main/java/io/jenkins/plugins/opentelemetry/administrativemonitor/ElasticBackendKibanaBaseUrlNotSetAdministrativeMonitor.java b/src/main/java/io/jenkins/plugins/opentelemetry/administrativemonitor/ElasticBackendKibanaBaseUrlNotSetAdministrativeMonitor.java index c6e9d0264..c93182786 100644 --- a/src/main/java/io/jenkins/plugins/opentelemetry/administrativemonitor/ElasticBackendKibanaBaseUrlNotSetAdministrativeMonitor.java +++ b/src/main/java/io/jenkins/plugins/opentelemetry/administrativemonitor/ElasticBackendKibanaBaseUrlNotSetAdministrativeMonitor.java @@ -12,8 +12,8 @@ import org.apache.commons.lang.StringUtils; import org.kohsuke.stapler.HttpResponse; import org.kohsuke.stapler.HttpResponses; -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.RequirePOST; import javax.inject.Inject; @@ -41,7 +41,7 @@ public boolean isActivated() { * Depending on whether the user said "yes" or "no", send him to the right place. */ @RequirePOST - public HttpResponse doAct(StaplerRequest req, StaplerResponse rsp) throws IOException { + public HttpResponse doAct(StaplerRequest2 req, StaplerResponse2 rsp) throws IOException { if (req.hasParameter("no")) { disable(true); } diff --git a/src/main/java/io/jenkins/plugins/opentelemetry/administrativemonitor/ObservabilityBackendCheckAdministrativeMonitor.java b/src/main/java/io/jenkins/plugins/opentelemetry/administrativemonitor/ObservabilityBackendCheckAdministrativeMonitor.java index 5f924c2bb..f5045ad4c 100644 --- a/src/main/java/io/jenkins/plugins/opentelemetry/administrativemonitor/ObservabilityBackendCheckAdministrativeMonitor.java +++ b/src/main/java/io/jenkins/plugins/opentelemetry/administrativemonitor/ObservabilityBackendCheckAdministrativeMonitor.java @@ -11,8 +11,8 @@ import org.apache.commons.lang.StringUtils; import org.kohsuke.stapler.HttpResponse; import org.kohsuke.stapler.HttpResponses; -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.RequirePOST; import javax.inject.Inject; @@ -43,7 +43,7 @@ public void setJenkinsOpenTelemetryPluginConfiguration(JenkinsOpenTelemetryPlugi * Depending on whether the user said "yes" or "no", send him to the right place. */ @RequirePOST - public HttpResponse doAct(StaplerRequest req, StaplerResponse rsp) throws IOException { + public HttpResponse doAct(StaplerRequest2 req, StaplerResponse2 rsp) throws IOException { if (req.hasParameter("no")) { disable(true); } diff --git a/src/main/java/io/jenkins/plugins/opentelemetry/init/ServletFilterInitializer.java b/src/main/java/io/jenkins/plugins/opentelemetry/init/ServletFilterInitializer.java index b01fb58cb..7fd6fda0a 100644 --- a/src/main/java/io/jenkins/plugins/opentelemetry/init/ServletFilterInitializer.java +++ b/src/main/java/io/jenkins/plugins/opentelemetry/init/ServletFilterInitializer.java @@ -14,8 +14,8 @@ import javax.annotation.PostConstruct; import javax.inject.Inject; -import javax.servlet.Filter; -import javax.servlet.ServletException; +import jakarta.servlet.Filter; +import jakarta.servlet.ServletException; import java.util.logging.Level; import java.util.logging.Logger; diff --git a/src/main/java/io/jenkins/plugins/opentelemetry/job/log/LogsViewHeader.java b/src/main/java/io/jenkins/plugins/opentelemetry/job/log/LogsViewHeader.java index 8a664375b..34dba3ad0 100644 --- a/src/main/java/io/jenkins/plugins/opentelemetry/job/log/LogsViewHeader.java +++ b/src/main/java/io/jenkins/plugins/opentelemetry/job/log/LogsViewHeader.java @@ -11,7 +11,7 @@ import org.apache.commons.io.output.CountingOutputStream; import org.jenkinsci.plugins.workflow.flow.FlowExecutionOwner; import org.kohsuke.stapler.Stapler; -import org.kohsuke.stapler.StaplerRequest; +import org.kohsuke.stapler.StaplerRequest2; import edu.umd.cs.findbugs.annotations.NonNull; import java.io.IOException; @@ -40,7 +40,7 @@ public long writeHeader(Writer w, FlowExecutionOwner.Executable context, Charset ConsoleAnnotator consoleAnnotator = new ConsoleAnnotator() { @Override public ConsoleAnnotator annotate(@NonNull Object context, @NonNull MarkupText text) { - StaplerRequest currentRequest = Stapler.getCurrentRequest(); + StaplerRequest2 currentRequest = Stapler.getCurrentRequest2(); String iconRootContextRelativeUrl; if (currentRequest == null) { // unit test iconRootContextRelativeUrl = backendIconUrl; diff --git a/src/main/java/io/jenkins/plugins/opentelemetry/job/log/OtelLogStorage.java b/src/main/java/io/jenkins/plugins/opentelemetry/job/log/OtelLogStorage.java index fcf09fb64..5524c7378 100644 --- a/src/main/java/io/jenkins/plugins/opentelemetry/job/log/OtelLogStorage.java +++ b/src/main/java/io/jenkins/plugins/opentelemetry/job/log/OtelLogStorage.java @@ -131,10 +131,10 @@ public BuildListener nodeListener(@NonNull FlowNode flowNode) throws IOException * Invoked by * io.jenkins.plugins.opentelemetry.job.log.OtelLogStorage#overallLog(org.jenkinsci.plugins.workflow.flow.FlowExecutionOwner.Executable, boolean) * |- org.jenkinsci.plugins.workflow.job.WorkflowRun#getLogText() - * |- org.jenkinsci.plugins.workflow.job.WorkflowRun#doConsoleText(org.kohsuke.stapler.StaplerRequest, org.kohsuke.stapler.StaplerResponse) + * |- org.jenkinsci.plugins.workflow.job.WorkflowRun#doConsoleText(org.kohsuke.stapler.StaplerRequest2, org.kohsuke.stapler.StaplerResponse2) * |- org.jenkinsci.plugins.workflow.job.WorkflowRun#getLog() * |- org.jenkinsci.plugins.workflow.job.WorkflowRun#getLogInputStream() - * |- hudson.model.Run#doConsoleText(org.kohsuke.stapler.StaplerRequest, org.kohsuke.stapler.StaplerResponse) + * |- hudson.model.Run#doConsoleText(org.kohsuke.stapler.StaplerRequest2, org.kohsuke.stapler.StaplerResponse2) * |- hudson.model.Run#writeLogTo(long, org.apache.commons.jelly.XMLOutput) * |- workflowRun/console.jelly */ diff --git a/src/main/java/io/jenkins/plugins/opentelemetry/job/log/OverallLog.java b/src/main/java/io/jenkins/plugins/opentelemetry/job/log/OverallLog.java index f7ba90b73..a496904f1 100644 --- a/src/main/java/io/jenkins/plugins/opentelemetry/job/log/OverallLog.java +++ b/src/main/java/io/jenkins/plugins/opentelemetry/job/log/OverallLog.java @@ -12,8 +12,8 @@ import io.opentelemetry.api.trace.TracerProvider; import io.opentelemetry.context.Scope; import org.jenkinsci.plugins.workflow.flow.FlowExecutionOwner; -import org.kohsuke.stapler.StaplerRequest; -import org.kohsuke.stapler.StaplerResponse; +import org.kohsuke.stapler.StaplerRequest2; +import org.kohsuke.stapler.StaplerResponse2; import org.kohsuke.stapler.framework.io.ByteBuffer; import java.io.IOException; @@ -41,7 +41,7 @@ public OverallLog(ByteBuffer memory, LogsViewHeader logsViewHeader, Charset char * Invoked by `/job/:jobFullName/:runNumber/logText/progressiveHtml */ @Override - public void doProgressiveHtml(StaplerRequest req, StaplerResponse rsp) throws IOException { + public void doProgressiveHtml(StaplerRequest2 req, StaplerResponse2 rsp) throws IOException { Tracer tracer = logger.isLoggable(Level.FINE) ? this.tracer : TracerProvider.noop().get("noop"); Span span = tracer.spanBuilder("OverallLog.doProgressiveHtml") .startSpan(); @@ -68,7 +68,7 @@ public void doProgressiveHtml(StaplerRequest req, StaplerResponse rsp) throws IO } @Override - public void doProgressiveText(StaplerRequest req, StaplerResponse rsp) throws IOException { + public void doProgressiveText(StaplerRequest2 req, StaplerResponse2 rsp) throws IOException { Tracer tracer = logger.isLoggable(Level.FINE) ? this.tracer : TracerProvider.noop().get("noop"); Span span = tracer.spanBuilder("OverallLog.doProgressiveText") .startSpan(); @@ -194,7 +194,7 @@ public Reader readAll() throws IOException { } @Override - public void doProgressText(StaplerRequest req, StaplerResponse rsp) throws IOException { + public void doProgressText(StaplerRequest2 req, StaplerResponse2 rsp) throws IOException { Tracer tracer = logger.isLoggable(Level.FINE) ? this.tracer : TracerProvider.noop().get("noop"); Span span = tracer.spanBuilder("OverallLog.doProgressText") .startSpan(); @@ -221,7 +221,7 @@ public void doProgressText(StaplerRequest req, StaplerResponse rsp) throws IOExc } @Override - protected Writer createWriter(StaplerRequest req, StaplerResponse rsp, long size) throws IOException { + protected Writer createWriter(StaplerRequest2 req, StaplerResponse2 rsp, long size) throws IOException { Tracer tracer = logger.isLoggable(Level.FINE) ? this.tracer : TracerProvider.noop().get("noop"); Span span = tracer.spanBuilder("OverallLog.createWriter") .startSpan(); diff --git a/src/main/java/io/jenkins/plugins/opentelemetry/job/log/util/LineIterator.java b/src/main/java/io/jenkins/plugins/opentelemetry/job/log/util/LineIterator.java index eae773262..d9a0c6f99 100644 --- a/src/main/java/io/jenkins/plugins/opentelemetry/job/log/util/LineIterator.java +++ b/src/main/java/io/jenkins/plugins/opentelemetry/job/log/util/LineIterator.java @@ -12,10 +12,10 @@ import java.util.logging.Level; import java.util.logging.Logger; -import javax.servlet.http.HttpSession; +import jakarta.servlet.http.HttpSession; import org.kohsuke.stapler.Stapler; -import org.kohsuke.stapler.StaplerRequest; +import org.kohsuke.stapler.StaplerRequest2; import edu.umd.cs.findbugs.annotations.Nullable; import io.jenkins.plugins.opentelemetry.job.RunFlowNodeIdentifier; @@ -73,7 +73,7 @@ public void putLogBytesToLogLine(long bytes, long line) { } Map> getContext() { - StaplerRequest currentRequest = Stapler.getCurrentRequest(); + StaplerRequest2 currentRequest = Stapler.getCurrentRequest2(); if (currentRequest == null) { // happens when reading logs is not tied to a web request // (e.g. API call from within a pipeline as described in https://github.com/jenkinsci/opentelemetry-plugin/issues/564) diff --git a/src/main/java/io/jenkins/plugins/opentelemetry/job/log/util/LogLineIterator.java b/src/main/java/io/jenkins/plugins/opentelemetry/job/log/util/LogLineIterator.java index 346091c69..29e7fbdf9 100644 --- a/src/main/java/io/jenkins/plugins/opentelemetry/job/log/util/LogLineIterator.java +++ b/src/main/java/io/jenkins/plugins/opentelemetry/job/log/util/LogLineIterator.java @@ -9,9 +9,9 @@ import io.jenkins.plugins.opentelemetry.job.RunFlowNodeIdentifier; import io.jenkins.plugins.opentelemetry.job.log.LogLine; import org.kohsuke.stapler.Stapler; -import org.kohsuke.stapler.StaplerRequest; +import org.kohsuke.stapler.StaplerRequest2; -import javax.servlet.http.HttpSession; +import jakarta.servlet.http.HttpSession; import java.util.HashMap; import java.util.Iterator; import java.util.Map; @@ -68,7 +68,7 @@ public void putLogBytesToLogLineId(long bytes, Id logLineId) { } Map> getContext() { - StaplerRequest currentRequest = Stapler.getCurrentRequest(); + StaplerRequest2 currentRequest = Stapler.getCurrentRequest2(); if (currentRequest == null) { // happens when reading logs is not tied to a web request // (e.g. API call from within a pipeline as described in https://github.com/jenkinsci/opentelemetry-plugin/issues/564) diff --git a/src/main/java/io/jenkins/plugins/opentelemetry/servlet/StaplerInstrumentationServletFilter.java b/src/main/java/io/jenkins/plugins/opentelemetry/servlet/StaplerInstrumentationServletFilter.java index d3b044476..027a3469b 100644 --- a/src/main/java/io/jenkins/plugins/opentelemetry/servlet/StaplerInstrumentationServletFilter.java +++ b/src/main/java/io/jenkins/plugins/opentelemetry/servlet/StaplerInstrumentationServletFilter.java @@ -28,14 +28,14 @@ import edu.umd.cs.findbugs.annotations.Nullable; import javax.inject.Inject; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.Filter; +import jakarta.servlet.FilterChain; +import jakarta.servlet.FilterConfig; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; @@ -56,7 +56,7 @@ * Instrumentation of the Stapler MVC framework. * Must be a {@link Filter} rather than a {@link jenkins.util.HttpServletFilter} because it must wrap the invocation of the {@link FilterChain} to create a {@link Span}. * TODO find a smarter way to instrument each HTTP request path. It should rely on instrumenting the Stapler framework - * TODO adopt StaplerRequest.html#getAncestors() + * TODO adopt StaplerRequest2.html#getAncestors() */ @Extension public class StaplerInstrumentationServletFilter implements Filter, OpenTelemetryLifecycleListener { diff --git a/src/main/java/io/jenkins/plugins/opentelemetry/servlet/TraceContextServletFilter.java b/src/main/java/io/jenkins/plugins/opentelemetry/servlet/TraceContextServletFilter.java index 76e6461a4..22c4cfcdc 100644 --- a/src/main/java/io/jenkins/plugins/opentelemetry/servlet/TraceContextServletFilter.java +++ b/src/main/java/io/jenkins/plugins/opentelemetry/servlet/TraceContextServletFilter.java @@ -12,13 +12,13 @@ import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; import javax.inject.Inject; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.Filter; +import jakarta.servlet.FilterChain; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.Objects; import java.util.concurrent.atomic.AtomicBoolean;