Skip to content

Commit

Permalink
Merge pull request #978 from jenkinsci/chore/bump_core
Browse files Browse the repository at this point in the history
chore: bump Jenkins core to 2.79.1
  • Loading branch information
kuisathaverat authored Nov 8, 2024
2 parents e0eb7b0 + 3dc70cd commit 71a7b4a
Show file tree
Hide file tree
Showing 16 changed files with 53 additions and 52 deletions.
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
*/
buildPlugin(useContainerAgent: false, configurations: [
[platform: 'linux', jdk: 21],
[platform: 'windows', jdk: 11],
[platform: 'windows', jdk: 21],
])
2 changes: 1 addition & 1 deletion docs/security_obs.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 5 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.88</version>
<version>5.2</version>
<relativePath />
</parent>
<groupId>io.jenkins.plugins</groupId>
Expand All @@ -20,7 +20,8 @@
<properties>
<revision>3</revision>
<changelist>999999-SNAPSHOT</changelist>
<jenkins.version>2.440.3</jenkins.version>
<jenkins.baseline>2.479</jenkins.baseline>
<jenkins.version>${jenkins.baseline}.1</jenkins.version>
<gitHubRepo>jenkinsci/${project.artifactId}-plugin</gitHubRepo>
<opentelemetry.version>1.43.0</opentelemetry.version>
<jenkins-opentelemetry.version>1.43.0-38.v1a_9b_53e3f70f</jenkins-opentelemetry.version>
Expand All @@ -44,8 +45,8 @@
<dependencies>
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-2.440.x</artifactId>
<version>3435.v238d66a_043fb_</version>
<artifactId>bom-${jenkins.baseline}.x</artifactId>
<version>3613.v584fca_12cf5c</version>
<scope>import</scope>
<type>pom</type>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -73,7 +73,7 @@ public void putLogBytesToLogLine(long bytes, long line) {
}

Map<RunFlowNodeIdentifier, Map<Long, Long>> 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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -68,7 +68,7 @@ public void putLogBytesToLogLineId(long bytes, Id logLineId) {
}

Map<RunFlowNodeIdentifier, Map<Long, Id>> getContext() {
StaplerRequest currentRequest = Stapler.getCurrentRequest();
StaplerRequest2 currentRequest = Stapler.getCurrentRequest2();

Check warning on line 71 in src/main/java/io/jenkins/plugins/opentelemetry/job/log/util/LogLineIterator.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 71 is not covered by tests
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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 <a href="https://javadoc.jenkins.io/component/stapler/org/kohsuke/stapler/StaplerRequest.html#getAncestors()">StaplerRequest.html#getAncestors()</a>
* TODO adopt <a href="https://javadoc.jenkins.io/component/stapler/org/kohsuke/stapler/StaplerRequest2.html#getAncestors()">StaplerRequest2.html#getAncestors()</a>

Check warning on line 59 in src/main/java/io/jenkins/plugins/opentelemetry/servlet/StaplerInstrumentationServletFilter.java

View check run for this annotation

ci.jenkins.io / Open Tasks Scanner

TODO

NORMAL: StaplerRequest2.html#getAncestors():https://javadoc.jenkins.io/component/stapler/org/kohsuke/stapler/StaplerRequest2.html#getAncestors() adopt
*/
@Extension
public class StaplerInstrumentationServletFilter implements Filter, OpenTelemetryLifecycleListener {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 71a7b4a

Please sign in to comment.