Continuous Integration - buildPlugin

The Jenkins project runs its own Jenkins instance for CI builds on ci.jenkins.io. It will build all plugin repositories in the jenkinsci organization that have a Jenkinsfile in the root of the repository.

The typical plugin build (Maven or Gradle) can be run by just having the following statement in the Jenkinsfile:

buildPlugin(
  forkCount: '1C', // run this number of tests in parallel for faster feedback.  If the number terminates with a 'C', the value will be multiplied by the number of available CPU cores
  useContainerAgent: true, // Set to `false` if you need to use Docker for containerized tests
  configurations: [
    [platform: 'linux', jdk: 21],
    [platform: 'windows', jdk: 17],
])

'Gradle support in buildPlugin() is deprecated and will be eventually removed. Please use:'

buildPluginWithGradle(
  forkCount: '1C', // run this number of tests in parallel for faster feedback.  If the number terminates with a 'C', the value will be multiplied by the number of available CPU cores
  useContainerAgent: true, // Set to `false` if you need to use Docker for containerized tests
  configurations: [
    [platform: 'linux', jdk: 21],
    [platform: 'windows', jdk: 17],
])
If the Jenkinsfile configuration includes Java 8, you will receive a low-level class version error when using version 4.52 or later of the plugin parent POM.

To learn more about the Pipeline library providing this functionality, see its GitHub repository.