Add a Jenkinsfile

Add a Jenkinsfile to the repository

If the plugin repository does not already include a Jenkinsfile, add a Jenkinsfile so that ci.jenkins.io will automatically compile and test the plugin and any pull requests submitted to the plugin.

Create a branch

In a local copy of your fork of the plugin repository create a git branch for your work with the command:

$ git checkout -b add-a-jenkinsfile master

Create the Jenkinsfile

Create a file named Jenkinsfile with the content:

buildPlugin(
  useContainerAgent: true, // Set to `false` if you need to use Docker for containerized tests
  configurations: [
    [platform: 'linux', jdk: 17],
    [platform: 'windows', jdk: 11],
])

Be sure the configuration platform is set correctly. Building with a Jenkinsfile configuration that includes Java 8 will result in a low-level class version error when using version 4.52 or later of the plugin parent POM.

Create a pull request

Commit that change:

$ git add Jenkinsfile
$ git commit -m "Add Jenkinsfile for ci.jenkins.io"

Push the change to GitHub:

$ git push origin --set-upstream add-a-jenkinsfile
Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
remote:
remote: Create a pull request for 'add-a-jenkinsfile' on GitHub by visiting:
remote: https://github.com/user/your-plugin/pull/new/add-a-jenkinsfile
remote:
To github.com:user/your-plugin.git
 * [new branch]      add-a-jenkinsfile -> add-a-jenkinsfile
Branch 'add-a-jenkinsfile' tracking remote branch 'add-a-jenkinsfile'.

Notice that the output of the command includes the URL, which can be used to open a pull request. Copy that URL in your web browser and submit a pull request.

A job will be automatically created in the ci.jenkins.io Plugins folder after the pull request is merged and the GitHub organization folder is scanned by ci.jenkins.io.

For more details, see the continuous integration page for Jenkins developers.