Skip to content

Conversation

MarkEWaite
Copy link
Contributor

@MarkEWaite MarkEWaite commented Oct 6, 2023

Require Java 11 and Jenkins 2.387.3 or newer, test with Java 21

Java 21 released Sep 19, 2023. We'd like to announce full support for Java 21 in early October and would like the most used plugins to be compiling and testing with Java 21.

The acceptance test harness and plugin bill of materials tests are already passing with Java 21. This is a further step to improve plugin readiness for use with Java 21 and for development with Java 21.

Pull request supersedes the following pull requests:

Move the definition of parallel testing from the Maven pom file into the Jenkinsfile so that ci.jenkins.io continues to run the tests with one process per available core, while developers are allowed to configure the amount of parallel testing based on the configuration and use of their computer.

Developers can adjust parallel execution by passing a command line argument to Maven like this:

  mvn clean -DforkCount=1C verify

Developers can define a Maven profile that sets the forkCount in their ~/.m2/settings.xml like this:

  <profile>
    <id>faster</id>
    <activation>
      <activeByDefault>true</activeByDefault>
    </activation>
    <properties>
      <forkCount>.45C</forkCount>
    </properties>
  </profile>

Testing done

Confirmed tests pass with Java 21 on Linux.

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

timja and others added 13 commits June 4, 2023 23:04
Bumps [org.jenkins-ci.plugins:plugin](https://github.com/jenkinsci/plugin-pom) from 4.33 to 4.74.
- [Release notes](https://github.com/jenkinsci/plugin-pom/releases)
- [Changelog](https://github.com/jenkinsci/plugin-pom/blob/master/CHANGELOG.md)
- [Commits](jenkinsci/plugin-pom@plugin-4.33...plugin-4.74)

---
updated-dependencies:
- dependency-name: org.jenkins-ci.plugins:plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Rely on Java byte code generation for Java 11 support
Better to configure forkCount in the local profile of the machine and
include a forkCount setting in the Jenkinsfile for CI.
…gelist-maven-extension-1.7' into test-with-java-21
@MarkEWaite MarkEWaite requested a review from a team as a code owner October 6, 2023 00:43
useContainerAgent: true, // Set to `false` if you need to use Docker for containerized tests
configurations: [
[platform: 'linux', jdk: 21],
[platform: 'windows', jdk: 17],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have more configurations? I'd love to test it on Linux-JDK8 and Linux-JDK11, if possible.

Why? The OpenClover (org.openclover:clover) officially supports JDK7-9 only. In its latest 4.5.0 release an experimental support for JDK10-17 was added.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you're welcome to test more configurations, though testing Java 8 won't work with this pull request because Jenkins 2.361.1 and later do not support Java 8. Jenkins 2.361.1 and later use Java 11 byte code and support only Java 11 and Java 17.

Agents can still run builds with Java 8, but the controller itself must run with Java 11 or Java 17. The agents also must run with Java 11 or Java 17 but they can control jobs that run any any JDK version or any other tool version.

Copy link
Contributor Author

@MarkEWaite MarkEWaite Oct 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't include a test of Java 11 in this case because the Java 17 compiler is configured by the Jenkins build tools to generate Java 11 byte code. Likewise for the Java 21 compiler. They are both generating and executing Java 11 byte code, so it did not seem especially useful to create a Java 11 test configuration to generate Java 11 byte code again.

I was intentionally accepting the risk of not running tests directly on Java 11 because the Jenkins project will end its support of Java 11 in Oct 2024 when Eclipse Temurin and other Java providers are expected to end their public support of Java 11. We're only 12 months away from needing to remove that test configuration and the test configuration is already reasonably covered by the Java 17 and Java 21 configurations.

If you feel strongly that you want an explicit Java 11 configuration, I'm willing to add it. I think it is testing things that are already well tested by other configurations, but I am less attached to reducing test configurations than I am to testing Java 21 in more plugins.

Let me know your preference. Thanks again for reviewing the pull request and merging the other pull requests!

@@ -34,16 +34,15 @@
<changelist>-SNAPSHOT</changelist>
<gitHubRepo>jenkinsci/clover-plugin</gitHubRepo>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.level>8</java.level>
<jenkins.version>2.289.3</jenkins.version>
<jenkins.version>2.387.3</jenkins.version>
Copy link
Contributor

@marek-parfianowicz marek-parfianowicz Oct 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add

##Unreleased
* Minimum Jenkins version required is 2.387.3 now

in the CHANGELOG.md?

FYI: I'm about to release new Jenkins Clover Plugin version (4.14.0) soon.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to do that. Have you considered switching to release drafter so that the changelog is maintained automatically? Instructions are available with more details.

Added in 7b31e02

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also changed the title of the pull request so that the release drafter will include the "Require Java 11 and Jenkins 2.387.3 or newer" in the changelog that it generates.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, yes I'm working on automation and release drafter, but this is not active yet.

@MarkEWaite
Copy link
Contributor Author

Since you've enabled continuous delivery, I believe that you'll need to label pull requests like this one so that the continuous delivery tools can decide if a pull request justifies a new release. I recommend labeling this change as an "enhancement" since it is changing the Jenkins minimum version

@MarkEWaite MarkEWaite changed the title Test with Java 21 Require Java 11 and Jenkins 2.387.3 or newer, test with Java 21 Oct 6, 2023
@MarkEWaite
Copy link
Contributor Author

Would you like me to rebase this pull request so that the merge history is not cluttered? That will cause some of the puill requests discussions to be hidden on this page but will make the git history much more tidy. I'm fine either way. You're also welcome to squash merge this if you prefer.

@marek-parfianowicz marek-parfianowicz added this to the clover-4.14.0 milestone Oct 6, 2023
@marek-parfianowicz marek-parfianowicz merged commit cbf5a63 into jenkinsci:master Oct 6, 2023
@MarkEWaite MarkEWaite deleted the test-with-java-21 branch October 6, 2023 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants