jenkinsci / plugin-modernizer-tool

MIT License
2 stars 5 forks source link

Plugin Modernizer Tool

Using OpenRewrite Recipes for Plugin Modernization or Automation Plugin Build Metadata Updates

Build Status Coverage LOC GitHub license

[!WARNING] This tool is currently in development. Please avoid opening issues until the end of the GSoC 2024 period.

It's configuration and APIs might change in future releases

About

Plugin Modernizer is a generic CLI tool designed to automate the modernization of Jenkins plugins. It utilizes OpenRewrite recipes, JDOM, and refaster to apply transformations to the plugin, validating the applied transformations and creating pull requests with the results.

Learn more at this project page.

Usage

[!NOTE] Currently, this tool does not support checking out plugins from remote repositories. Therefore, one must manually check out the plugin repository into a new directory named test-plugins.

Build

mvn clean install

Execute the following command outside the test-plugins directory:

java -jar plugin-modernizer-cli/target/jenkins-plugin-modernizer-999999-SNAPSHOT.jar --plugins plugin1,plugin2 --recipes AddPluginsBom,AddCodeOwner

Here, plugin1 and plugin2 are the names of plugin directories, and AddPluginsBom and AddCodeOwners are recipe names. For more details about available recipes, refer to the recipe_data.yaml file.

CLI Options

Reproducibility

The maven build should be reproducible

See

Reproducible Builds for more information.

Ensure the repository is clean before running the following commands (otherwise you can pass the -Dignore.dirty flag to the maven command).

mvn -Dset.changelist clean install
mvn -Dset.changelist -Dreference.repo=central clean verify artifact:compare

The property project.build.outputTimestamp will be set with the timestamp of the latest commit.

If you are using a mirror for central you should adapt the reference.repo property accordingly to match the id of the mirror in your settings.xml.

References