Back to blog

Using OpenRewrite Recipes for Plugin Modernization

Sridhar Sivakumar
Sridhar Sivakumar
August 26, 2024

This blog showcases the work done on the Plugin Modernizer Tool during the Google Summer of Code 2024. For a detailed description of the project, please refer to the project page.

Jenkins GSoC

About the Project

This project aims to build a generic tool to automate the modernization of Jenkins plugins using OpenRewrite.

This tool allows us to apply OpenRewrite recipe transformations across Jenkins plugins, validate the changes, and create pull requests in the respective plugin repositories.

This tool also extracts and stores essential metadata that can be consumed by Plugin-Health-Scoring for building more probes. For example, it can identify transitive dependencies and issue warnings if a plugin doesn’t use an API plugin as recommended.

Phase 1

In this phase, we accomplished following tasks:

  • Developed a CLI module to parse arguments.

  • Created a scanning recipe to extract metadata.

  • Developed a core module using Maven invoker to apply recipes across plugins.

Feel free to watch the demonstration of the tool in the Midterm Presentation.

Phase 2

In this phase, we accomplished the following tasks:

  • Developed a GitHub service for forking, cloning, committing, and creating pull requests.

  • Integrated OpenRewrite recipes to the tool.

  • Added a caching mechanism.

  • Improved the tests and documentation.

Next Steps

  • Integrating more recipes into the tool, allowing us to apply a wide range of changes across the Jenkins ecosystem.

  • Storing the extracted metadata in a common location so that it can be used by other projects, such as Plugin Health Scoring.

Acknowledgments

I extend my sincere thanks to my mentors, Valentin Delaye, Bruno Verachten, Rajiv Ranjan Singh and Bervianto Leo Pratama as well as the organization admins, for their invaluable guidance, support, and patience throughout this journey.

I also want to thank Basil Crow for introducing the initial project idea titled Automating plugin build metadata updates.

About the author

Sridhar Sivakumar

Sridhar Sivakumar

Sridhar is an undergraduate student from India. He began his open-source journey in November 2023 with Jenkins. In 2024, he was selected for Google Summer of Code as a contributor to work on the project Using OpenRewrite Recipes for Plugin Modernization or Automation Plugin Build Metadata Updates. His interests also include OTB-rated chess, badminton, and running.