Add a Jenkinsfile

This site is the new docs site currently being tested. For the actual docs in use please go to https://www.jenkins.io/doc.

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: 21],
    [platform: 'windows', jdk: 17],
])

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 '{task-identifier}' on GitHub by visiting:
remote: https://github.com/user/your-plugin/pull/new/{task-identifier}
remote:
To github.com:user/your-plugin.git
 * [new branch]      {task-identifier} -> {task-identifier}
Branch '{task-identifier}' tracking remote branch '{task-identifier}'.

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.