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

Upgrade build toolchain #6432

Merged
merged 3 commits into from
Apr 4, 2022
Merged

Upgrade build toolchain #6432

merged 3 commits into from
Apr 4, 2022

Conversation

basil
Copy link
Member

@basil basil commented Apr 2, 2022

Upgrades the build toolchain to the latest releases of the parent POM, test harness, and Maven HPI plugin. With all of the above, JenkinsLogRecordsTest now runs on Java 17.

Proposed changelog entries

N/A

Proposed upgrade guidelines

N/A

Submitter checklist

  • (If applicable) Jira issue is well described
  • Changelog entries and upgrade guidelines are appropriate for the audience affected by the change (users or developer, depending on the change) and are in the imperative mood. Examples
    • Fill-in the Proposed changelog entries section only if there are breaking changes or other changes which may require extra steps from users during the upgrade
  • Appropriate autotests or explanation to why this change has no tests
  • New public classes, fields, and methods are annotated with @Restricted or have @since TODO Javadoc, as appropriate.
  • For dependency updates: links to external changelogs and, if possible, full diffs

Desired reviewers

@mention

Maintainer checklist

Before the changes are marked as ready-for-merge:

  • There are at least 2 approvals for the pull request and no outstanding requests for change
  • Conversations in the pull request are over OR it is explicit that a reviewer does not block the change
  • Changelog entries in the PR title and/or Proposed changelog entries are accurate, human-readable, and in the imperative mood
  • Proper changelog labels are set so that the changelog can be generated automatically
  • If the change needs additional upgrade steps from users, upgrade-guide-needed label is set and there is a Proposed upgrade guidelines section in the PR title. (example)
  • If it would make sense to backport the change to LTS, a Jira issue must exist, be a Bug or Improvement, and be labeled as lts-candidate to be considered (see query).

@basil basil added skip-changelog Should not be shown in the changelog squash-merge-me Unclean or useless commit history, should be merged only with squash-merge dependencies Pull requests that update a dependency file java Pull requests that update Java code labels Apr 2, 2022
@@ -28,7 +28,7 @@ THE SOFTWARE.
<parent>
<groupId>org.jenkins-ci</groupId>
<artifactId>jenkins</artifactId>
<version>1.72</version>
<version>1.73</version>
Copy link
Member Author

Choose a reason for hiding this comment

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

Pulls in a new version of maven-hpi-plugin.

@@ -85,7 +85,6 @@ THE SOFTWARE.
<patch.tracker.serverId>jenkins-jira</patch.tracker.serverId>

<animal.sniffer.skip>${skipTests}</animal.sniffer.skip>
<java.level>8</java.level>
Copy link
Member Author

Choose a reason for hiding this comment

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

Deprecated in the latest parent POM.

Comment on lines -640 to -670
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
<configuration>
<signature>
<groupId>org.codehaus.mojo.signature</groupId>
<artifactId>java1${java.level}</artifactId>
<version>1.0</version>
</signature>
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<!-- Version specified in parent POM -->
<configuration>
<source>1.${java.level}</source>
<target>1.${java.level}</target>
<!-- default reuseCreated is more performant
feel free to uncomment if you have any issues on your platform
<compilerReuseStrategy>alwaysNew</compilerReuseStrategy>
-->
</configuration>
</plugin>
Copy link
Member Author

Choose a reason for hiding this comment

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

This was always redundant and declared in the parent POM. Rather than inlining java.level I thought it best to delete the redundant copypasta.

Comment on lines +564 to +567
<And>
<Bug pattern="SSD_DO_NOT_USE_INSTANCE_LOCK_ON_SHARED_STATIC_DATA"/>
<Class name="hudson.model.ViewJob"/>
</And>
Copy link
Member Author

Choose a reason for hiding this comment

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

Some new SpotBugs check that still needs triage. Added to the triage list.

test/pom.xml Outdated
Comment on lines 46 to 53
<!--
Filled in by maven-hpi-plugin from the MANIFEST.MF entry in jenkins.war, but we provide a default value for the benefit of IDEs.
Make sure to keep the directives in core/pom.xml and war/pom.xml in sync with these.
-->
<jenkins.addOpens>--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED</jenkins.addOpens>

<!-- Filled in by maven-hpi-plugin with the path to org-netbeans-insane-hook.jar extracted from jenkins-test-harness -->
<jenkins.insaneHook />
Copy link
Member Author

Choose a reason for hiding this comment

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

Needed as defaults for IDEs that don't run Maven.

test/pom.xml Outdated
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>jenkins-test-harness</artifactId>
<version>1723.vcd938b_e66072</version>
<version>1731.v383b_5d6c3393</version>
Copy link
Member Author

Choose a reason for hiding this comment

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

Pulls in a newer version of INSANE that is needed for Java 17.

Comment on lines +210 to +218
<executions>
<execution>
<id>test-runtime</id>
<goals>
<goal>test-runtime</goal>
</goals>
<phase>test</phase>
</execution>
</executions>
Copy link
Member Author

Choose a reason for hiding this comment

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

Sets the jenkins.addOpens and jenkins.insaneHook system property. The latter is needed for the newer version of INSANE.

@@ -229,13 +254,32 @@ THE SOFTWARE.
<artifactId>maven-surefire-plugin</artifactId>
<!-- version specified in grandparent pom -->
<configuration>
<argLine>${jacocoSurefireArgs} -Xmx1g @{jenkins.addOpens} @{jenkins.insaneHook}</argLine>
Copy link
Member Author

Choose a reason for hiding this comment

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

Rather than setting these ourselves in a custom profile, we now rely on maven-hpi-plugin to set them for us, the same way plugins will in the next release of plugin-pom.

Comment on lines +265 to +282
<executions>
<!-- Unbind the default execution so that it does not run before test-runtime. -->
<execution>
<id>default-test</id>
<goals>
<goal>test</goal>
</goals>
<phase>none</phase>
</execution>
<!-- Bind a new execution which, by virtue of being declared after test-runtime, will also run after it. -->
<execution>
<id>functional-test</id>
<goals>
<goal>test</goal>
</goals>
<phase>test</phase>
</execution>
</executions>
Copy link
Member Author

Choose a reason for hiding this comment

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

Get test-runtime to run before Surefire. For plugins we define a custom lifecycle, but for the standard lifecycle used in core we have to define the executions in the order we want them to run in.

Comment on lines +38 to +39
VersionNumber javaVersion = new VersionNumber(System.getProperty("java.specification.version"));
if (javaVersion.isOlderThan(new VersionNumber("9")) || javaVersion.isNewerThanOrEqualTo(new VersionNumber("17"))) { // TODO https://github.com/jenkinsci/jenkins-test-harness/issues/359
Copy link
Member Author

Choose a reason for hiding this comment

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

Still not working on Java 11, but this finally works on Java 17.

@basil
Copy link
Member Author

basil commented Apr 2, 2022

Proof that this is all working:

https://ci.jenkins.io/job/Core/job/jenkins/job/PR-6432/3/testReport/jenkins.model/JenkinsLogRecordsTest/Linux_jdk17___Linux_Build___Test___logRecordsArePresentOnController/

That is JenkinsLogRecordsTest passing on Java 17, checking for memory leaks with the latest version of INSANE, with the INSANE hooks added by the Maven HPI plugin.

@basil
Copy link
Member Author

basil commented Apr 3, 2022

This PR is now ready for merge. We will merge it after approximately 24 hours if there is no negative feedback. Please see the merge process documentation for more information about the merge process. Thanks!

@basil basil added the ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback label Apr 3, 2022
@basil basil merged commit dc88f58 into jenkinsci:master Apr 4, 2022
@basil basil deleted the toolchain branch April 4, 2022 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file java Pull requests that update Java code ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback skip-changelog Should not be shown in the changelog squash-merge-me Unclean or useless commit history, should be merged only with squash-merge
Projects
None yet
2 participants