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

Update to Jenkins LTS version 2.375 #696

Merged
merged 13 commits into from
Aug 6, 2023
Merged
1 change: 0 additions & 1 deletion bootstrap/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<resources>
<resource>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public ClassLoader createJenkinsWarClassLoader() throws PrivilegedActionExceptio
return AccessController.doPrivileged((PrivilegedExceptionAction<ClassLoader>) () -> new ClassLoaderBuilder(new SideClassLoader(getPlatformClassloader()))
.collectJars(new File(getLauncherOptions().warDir, "WEB-INF/lib"))
// In this mode we also take Jetty from the Jenkins core
.collectJars(new File(getLauncherOptions().warDir, "winstone.jar"))
.collectJars(new File(getLauncherOptions().warDir, "executable/winstone.jar"))
// servlet API needs to be visible to jenkins.war
.collectJars(new File(getAppRepo(), "javax/servlet"))
.make());
Expand All @@ -212,7 +212,7 @@ public int runJenkinsfileRunnerApp() throws Throwable {
String appClassName = getAppClassName();
if (hasClass(appClassName)) {
Class<?> c = Class.forName(appClassName);
return ((IApp) c.newInstance()).run(this);
return ((IApp) c.getDeclaredConstructor().newInstance()).run(this);
}

// Slim packaging (no bundled WAR or plugins)
Expand All @@ -223,7 +223,7 @@ public int runJenkinsfileRunnerApp() throws Throwable {

try {
Class<?> c = setup.loadClass(appClassName);
return ((IApp) c.newInstance()).run(this);
return ((IApp) c.getDeclaredConstructor().newInstance()).run(this);
} catch (ClassNotFoundException e) {
if (setup instanceof URLClassLoader) {
throw new ClassNotFoundException(e.getMessage() + " not found in " + getAppRepo() + ","
Expand Down
1 change: 0 additions & 1 deletion packaging-parent-pom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<skip>${jfr.packaging.skip}</skip>
<resources>
Expand Down
8 changes: 4 additions & 4 deletions payload-dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,16 @@
<artifactId>jackson2-api</artifactId>
</dependency>
<!-- TODO(oleg_nenashev): Should be removed entirely from Pipeline: Global CPS Library plugin -->
<dependency>
<!-- <dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>git-server</artifactId>
</dependency>
</dependency> -->
<!-- TODO(oleg_nenashev): Should be removed entirely from Pipeline: Global CPS Library plugin -->
<dependency>
<!-- <dependency>
<groupId>org.jenkins-ci.modules</groupId>
<artifactId>sshd</artifactId>
<version>3.1.0</version>
</dependency>
</dependency> -->

<!-- For injected tests, when we decide to enable them -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.jenkinsci.plugins.workflow.multibranch.yaml.pipeline.PipelineAsYamlScriptFlowDefinition;

import java.io.IOException;
import java.nio.charset.Charset;

@Extension(ordinal = -1000, optional = true)
public class PipelineAsYAMLDefinitionProvider extends PipelineDefinitionProvider {
Expand All @@ -27,6 +28,6 @@ public void instrumentJob(WorkflowJob job, PipelineRunOptions runOptions) throws

// We do not support SCM definition here due to https://github.com/jenkinsci/pipeline-as-yaml-plugin/issues/28
job.setDefinition(new PipelineAsYamlScriptFlowDefinition(
FileUtils.readFileToString(runOptions.jenkinsfile), !runOptions.noSandBox));
FileUtils.readFileToString(runOptions.jenkinsfile, Charset.defaultCharset()), !runOptions.noSandBox));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ private CauseAction createCauseAction(String cause) {
}

private void writeLogTo(PrintStream out) throws IOException, InterruptedException {
final int retryCnt = 10;
final int retryCnt = 200;

// read output in a retry loop, by default try only once
// writeWholeLogTo may fail with FileNotFound
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.List;

/**
Expand All @@ -28,6 +29,6 @@ public SetJenkinsfileLocation(File jenkinsfile, Boolean sandbox) {

@Override
public CpsFlowExecution create(FlowDefinition def, FlowExecutionOwner owner, List<? extends Action> actions) throws IOException {
return new CpsFlowExecution(FileUtils.readFileToString(jenkinsfile), this.sandboxedExecution, owner);
return new CpsFlowExecution(FileUtils.readFileToString(jenkinsfile, Charset.defaultCharset()), this.sandboxedExecution, owner);
}
}
23 changes: 10 additions & 13 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ THE SOFTWARE.
<parent>
<groupId>org.jenkins-ci</groupId>
<artifactId>jenkins</artifactId>
<version>1.85</version>
<version>1.90</version>
<relativePath />
</parent>

Expand Down Expand Up @@ -66,11 +66,11 @@ THE SOFTWARE.
<gitHubRepo>jenkinsci/jenkinsfile-runner</gitHubRepo>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.level>11</java.level>
<jenkins.version>2.346.1</jenkins.version>
<jenkins.bom.baseline>bom-2.346.x</jenkins.bom.baseline>
<jenkins.bom.version>1500.ve4d05cd32975</jenkins.bom.version>
<jetty.version>9.4.43.v20210629</jetty.version>
<jenkins-test-harness.version>1589.vc23fca066d5c</jenkins-test-harness.version>
<jenkins.version>2.375.4</jenkins.version>
<jenkins.bom.baseline>bom-2.375.x</jenkins.bom.baseline>
<jenkins.bom.version>2025.v816d28f1e04f</jenkins.bom.version>
<jetty.version>10.0.12</jetty.version>
<jenkins-test-harness.version>1952.v3a_b_0cd3f5a_03</jenkins-test-harness.version>
<!--TODO: Reenable once all the issues are fixed (JENKINS-57353)-->
<spotbugs.failOnError>false</spotbugs.failOnError>
</properties>
Expand Down Expand Up @@ -108,27 +108,25 @@ THE SOFTWARE.
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>pipeline-utility-steps</artifactId>
<version>2.13.2</version>
<version>2.15.1</version>
</dependency>
<!-- TODO(oleg_nenashev): Remove explicit version once https://github.com/jenkinsci/bom/issues/681 is fixed -->
<dependency>
<!-- <dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>git-server</artifactId>
<version>1.10</version>
</dependency>
</dependency> -->
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-annotations</artifactId>
<version>4.7.1</version>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>3.0.2</version>
</dependency>
</dependencies>

Expand All @@ -143,8 +141,7 @@ THE SOFTWARE.
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<release>11</release>
</configuration>
</plugin>
<plugin>
Expand Down
30 changes: 0 additions & 30 deletions setup/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,36 +39,6 @@
<version>${jenkins.version}</version>
</dependency>

<!-- Jenkins Modules -->
<!-- NOTE(oleg_nenashev): Not all modules are actually needed, e.g. Agent Installer modules unlikely have any use-case in JFR.
At the same time, there are plugins which **may** depend on them.
Total size of modules is less than 400KB, so optimization is not required here for now.
-->
<dependency>
<groupId>org.jenkins-ci.modules</groupId>
<artifactId>instance-identity</artifactId>
</dependency>
<dependency>
<groupId>org.jenkins-ci.modules</groupId>
<artifactId>slave-installer</artifactId>
</dependency>
<dependency>
<groupId>org.jenkins-ci.modules</groupId>
<artifactId>windows-slave-installer</artifactId>
</dependency>
<dependency>
<groupId>org.jenkins-ci.modules</groupId>
<artifactId>launchd-slave-installer</artifactId>
</dependency>
<dependency>
<groupId>org.jenkins-ci.modules</groupId>
<artifactId>upstart-slave-installer</artifactId>
</dependency>
<dependency>
<groupId>org.jenkins-ci.modules</groupId>
<artifactId>systemd-slave-installer</artifactId>
</dependency>

<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ public CLILauncher(RunCLICommand command) {
@Override
protected int doLaunch() throws Exception {
// so that the CLI has all the access to the system
ACL.impersonate(ACL.SYSTEM);
ACL.as2(ACL.SYSTEM2);

BufferedReader commandIn = new BufferedReader(new InputStreamReader(System.in, StandardCharsets.UTF_8));
String line;
System.out.printf("Connected to Jenkins!%nType 'help' for a list of available commands, or 'exit' to quit.%n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.EnumSet;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;
Expand All @@ -24,6 +25,8 @@
import org.apache.commons.lang.StringUtils;
import org.eclipse.jetty.security.AbstractLoginService;
import org.eclipse.jetty.security.LoginService;
import org.eclipse.jetty.security.RolePrincipal;
import org.eclipse.jetty.security.UserPrincipal;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.util.thread.QueuedThreadPool;
import org.eclipse.jetty.webapp.Configuration;
Expand Down Expand Up @@ -230,7 +233,7 @@ public JFRLoginService() {
}

@Override
protected String[] loadRoleInfo(UserPrincipal user) {
protected List<RolePrincipal> loadRoleInfo(UserPrincipal user) {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ protected int doLaunch() throws Exception {
// Attempt to call the scriptToPipelineDef method of the Converter class. This is the same as what
// happens when a Jenkinsfile is POSTed to $JENKINS_URL/pipeline-model-converter/validate.
System.out.println("Linting...");
cc.getMethod("scriptToPipelineDef", String.class).invoke(cc.newInstance(), getJenkinsfileAsString());
cc.getMethod("scriptToPipelineDef", String.class).invoke(cc.getConstructor().newInstance(), getJenkinsfileAsString());
System.out.println("Done");
return 0;
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protected int doLaunch() throws Exception {
// We are either in the shared environment (uberjar, repo with plugins) where we can already classload the Runner class directly.
// Or not, and then we consult with the Jenkins core loader and plugin uber classloader
Class<?> c = command.hasClass(PIPELINE_JOB_CLASS_NAME) ? Class.forName(RUNNER_CLASS_NAME) : getRunnerClassFromJar();
return (int) c.getMethod("run", PipelineRunOptions.class).invoke(c.newInstance(), command.pipelineRunOptions);
return (int) c.getMethod("run", PipelineRunOptions.class).invoke(c.getConstructor().newInstance(), command.pipelineRunOptions);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import org.eclipse.jetty.util.component.AbstractLifeCycle;
import org.eclipse.jetty.webapp.WebAppContext;

import java.util.Collections;

import javax.servlet.ServletContextListener;

/**
Expand All @@ -23,6 +25,6 @@ final class NoListenerConfiguration extends AbstractLifeCycle {

@Override
protected void doStart() {
context.setEventListeners(null);
context.setEventListeners(Collections.emptyList());
}
}
7 changes: 5 additions & 2 deletions vanilla-package/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,21 @@
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>git</artifactId>
</dependency>
<!-- Exclude this outdated plugin since it will fail with higher managed dependencies
coming from the Jenkins core parent bom -->
<!--
<dependency>
<groupId>io.jenkins.plugins</groupId>
<artifactId>pipeline-as-yaml</artifactId>
<version>0.12-rc</version>
<version>0.16-rc</version>
<exclusions>
<exclusion>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</exclusion>
</exclusions>
</dependency>
-->
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>job-dsl</artifactId>
Expand All @@ -85,7 +89,6 @@
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>http_request</artifactId>
<version>1.16</version>
</dependency>

<!-- Upper bounds -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ public void shouldSupportDataboundMethods() throws Throwable {
}

@Test
@Ignore
public void helloWorldAsYaml() throws Throwable {
File jenkinsfile = tmp.newFile("Jenkinsfile.yml");
FileUtils.writeStringToFile(jenkinsfile,
Expand Down
Loading