Skip to content

Add Separate Logging for Plugin Modernization Failures #913

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 36 commits into
base: main
Choose a base branch
from

Conversation

gounthar
Copy link
Collaborator

@gounthar gounthar commented Apr 3, 2025

Please don't merge this pull request, as it is mostly a proof of concept rather than production-ready code.
You already guessed it: some of the tests fail now. 😢
I'm especially not proud of the way I retrieved the plugin's version. I was expecting to use just metadata, but I was not able to do so. 🤦

Whenever I run a "campaign" (e.g., move to JDK 11, move to JDK 17, migrate to JUnit 5), I encounter numerous failures because lots of plugins just can't migrate.
However, these often go unnoticed as I am processing several hundreds of plugins at once. The failures could stem from the plugin being significantly outdated, limitations in a recipe, bugs in the plugin-modernizer, or issues with a recent version of SpotBugs. Unfortunately, valuable information gets buried within lengthy logs.

The goal of this PR is to create a "log file" that documents all plugin modernization attempts that failed, using the format plugin:version. This system will allow us to review details later on (by searching within the local cache for the faulty plugins).
The format also enables us to reuse the list of failed plugins with another recipe (e.g., after failing with JDK 17, some plugins might succeed when moved to JDK 11). Additionally, it allows us to replay the same recipe after making corrections.

In summary, this tool will help me better manage campaigns and hopefully improve the plugin-modernizer overall.

  • Add a new appender in plugin-modernizer-cli/src/main/resources/logback.xml to log failures separately in modernization-failures-YYYYMMDD-HHMMSS.log.
  • Update plugin-modernizer-core/src/main/java/io/jenkins/tools/pluginmodernizer/core/model/Plugin.java to log failures in the new log file.
  • Add a method in plugin-modernizer-core/src/main/java/io/jenkins/tools/pluginmodernizer/core/model/Plugin.java to log network-related failures in network-failures-YYYYMMDD-HHMMSS.log.

For example, it created for me today a file named modernization-failures-MigrateToJUnit5-20250403.log.
My "campaign" isn't done yet, but here is the current content of the file:

Matrix-sorter-plugin:1.4-SNAPSHOT
abap-ci:1.21-SNAPSHOT
adaptive-disconnector:0.3-SNAPSHOT
agent-server-parameter:1.2-SNAPSHOT
aio-tests:1.13-SNAPSHOT
alauda-devops-credentials-provider:2.3.1-SNAPSHOT
alauda-devops-pipeline:2.3.1-SNAPSHOT
alauda-devops-sync:2.4.1-SNAPSHOT
alauda-kubernetes-support:2.3.1-SNAPSHOT
alauda-pipeline:1.4.3
alibabacloud-credentials:1.4-SNAPSHOT
alibabacloud-ecs:1.27-SNAPSHOT
alibabacloud-edas:1.0.1-SNAPSHOT
aliyun-oss-uploader:1.5-SNAPSHOT
all-changes:1.6-SNAPSHOT
amqp-build-trigger:1.1-SNAPSHOT
appcenter:0.11.2-SNAPSHOT
apprenda:2.2.1-SNAPSHOT
aqua-microscanner:1.0.9-SNAPSHOT
aqua-serverless:1.0.7-SNAPSHOT
arachni-scanner:1.0.1-SNAPSHOT
arestocats:2.2-SNAPSHOT
argus-notifier:1.2-SNAPSHOT
artifact-diff-plugin:1.4-SNAPSHOT
assertthat-bdd-jira:1.8-SNAPSHOT
audit-log:1.4${changelist}
autoaction-step:1.2-SNAPSHOT
autocancel:1.0.5

Testing done

Ran plugin modernizer with a list of very outdated plugins for the MigrateToJUnit5 recipe.

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

gounthar added 30 commits March 28, 2025 15:55
Fixes #98

Add separate logging for plugin modernization failures.

* Add a new appender in `plugin-modernizer-cli/src/main/resources/logback.xml` to log failures separately in `modernization-failures-YYYYMMDD-HHMMSS.log`.
* Update `plugin-modernizer-core/src/main/java/io/jenkins/tools/pluginmodernizer/core/model/Plugin.java` to log failures in the new log file.
* Add a method in `plugin-modernizer-core/src/main/java/io/jenkins/tools/pluginmodernizer/core/model/Plugin.java` to log network-related failures in `network-failures-YYYYMMDD-HHMMSS.log`.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/gounthar/plugin-modernizer-tool/issues/98?shareId=XXXX-XXXX-XXXX-XXXX).
@jonesbusy
Copy link
Collaborator

Which version do we need? Can we use the last published version? It's already fetched

Yes the current implementation looks fragile

@gounthar
Copy link
Collaborator Author

gounthar commented Apr 4, 2025

It's even worse than fragile, it is terrible. 😉
I would need the version we fetched, but I was unable to do so. 🤷

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants