Skip to content

plugin modernization to reduce hpi size#355

Merged
cdelmonte-zg merged 4 commits intojenkinsci:masterfrom
mawinter69:dep-update
Feb 26, 2025
Merged

plugin modernization to reduce hpi size#355
cdelmonte-zg merged 4 commits intojenkinsci:masterfrom
mawinter69:dep-update

Conversation

@mawinter69
Copy link
Copy Markdown
Contributor

@mawinter69 mawinter69 commented Jan 5, 2025

  • use 2.401.3 as minimum Jenkins version
  • replace dependencies to jackson, gson and commons-lang3 with the corresponding api plugins
  • remove dependency to groovy. It is not needed and only blows up the hpi.
  • remove dependencies to annotation-indexer and structs as they are not required

The size of the hpi is reduced from over 9MiB to 342KiB

Testing done

Don't have access to bitbucket but the tests are running fine

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

- use 2.452.4 as minimum Jenkins version
- replace dependency to jackson, gson and commons-lang3 with the
  corresponding api plugins
- remove dependency to groovy. It is not needed and only blows up the hpi.
- remove dependencies to annotation-indexer and structs as they are not
  required
@cdelmonte-zg
Copy link
Copy Markdown
Contributor

cdelmonte-zg commented Jan 17, 2025

Hi @mawinter69
Thanks for your PR. Could you just change two things?

The minimum Jenkins version shouldn't be changed at the moment, so that installations running on older versions of Jenkins can still use the updated versions of the plugin. You can look at the distribution of installations in this matrix: https://old.stats.jenkins.io/pluginversions/bitbucket-push-and-pull-request.html

Instead of the @SuppressFBWarnings(value="PA_PUBLIC_PRIMITIVE_ATTRIBUTE", justification="Preserve API compatibility") annotation, could you use the method shown in the official documentation? https://spotbugs.readthedocs.io/en/latest/maven.html#add-spotbugs-maven-plugin-to-your-pom-xml. For example:

  • Create a findbugs-exclude.xml file in the project root and specify the pattern for the warnings to be excluded:
<FindBugsFilter
    <Match>
        <Bug pattern="PA_PUBLIC_PRIMITIVE_ATTRIBUTE" />
    </Match>
</FindBugsFilter>
  • Then reference this file in the pom.xml SpotBugs plugin configuration:
<plugin
    <groupId>com.github.spotbugs</groupId>
    <artifactId>spotbugs-maven-plugin</artifactId>
    <version>any version</version>
    <configuration>
        <excludeFilterFile>findbugs-exclude.xml</excludeFilterFile>
    </configuration>
</plugin>

@mawinter69
Copy link
Copy Markdown
Contributor Author

mawinter69 commented Jan 17, 2025

The gson-api plugin is only available from 2.401.3 so I used that as the baseline. Given that most users that are on a Jenkins older than 2.401.3 are using this plugin also with an older release I think that the impact is not really big to increase the minimum required Jenkins version.
I put the spotbugs exclude file to the location where it is automatically found, that avoids to explicitly define it in the pom.xml

@cdelmonte-zg cdelmonte-zg merged commit e84c2ba into jenkinsci:master Feb 26, 2025
18 of 19 checks passed
@cdelmonte-zg
Copy link
Copy Markdown
Contributor

@mawinter69 Merged and released, thanks!

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