Skip to content
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

[JENKINS-73714] Fix filtering of icons in jar file #283

Merged
merged 1 commit into from
Sep 8, 2024
Merged

[JENKINS-73714] Fix filtering of icons in jar file #283

merged 1 commit into from
Sep 8, 2024

Conversation

strangelookingnerd
Copy link
Contributor

@strangelookingnerd strangelookingnerd commented Sep 4, 2024

See https://issues.jenkins.io/browse/JENKINS-73714 for more details.

During the refactoring in 1b41824 the collection of the icons was broken in case they are read from the JAR file due to the FileSystem being closed too early.

Testing done

I did not find a way to reproduce the issue with a regular test without manually manipulating the classpath. However the manual tests showed that these changes fix the issue at hand.

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

Copy link

codecov bot commented Sep 4, 2024

Codecov Report

Attention: Patch coverage is 71.42857% with 4 lines in your changes missing coverage. Please review.

Project coverage is 71.15%. Comparing base (ab9790e) to head (f6a3c13).
Report is 86 commits behind head on main.

Files with missing lines Patch % Lines
.../jenkins/plugins/fontawesome/FontAwesomeIcons.java 71.42% 1 Missing and 3 partials ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##               main     #283       +/-   ##
=============================================
+ Coverage     50.00%   71.15%   +21.15%     
- Complexity       17       19        +2     
=============================================
  Files             3        2        -1     
  Lines            76       52       -24     
  Branches          5        3        -2     
=============================================
- Hits             38       37        -1     
+ Misses           31        9       -22     
+ Partials          7        6        -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@strangelookingnerd strangelookingnerd changed the title [JENKINS-73714] Do not close FileSystem before creating Stream [JENKINS-73714] Calling FontAwesomeIcons#getAvailableIcons() causes ClosedFileSystemException Sep 4, 2024
@uhafner uhafner added the bug Bugs or performance problems label Sep 8, 2024
@uhafner uhafner changed the title [JENKINS-73714] Calling FontAwesomeIcons#getAvailableIcons() causes ClosedFileSystemException [JENKINS-73714] Fix filtering of icons in jar file Sep 8, 2024
@uhafner uhafner merged commit 6e253be into jenkinsci:main Sep 8, 2024
30 of 31 checks passed
@uhafner
Copy link
Member

uhafner commented Sep 8, 2024

Thanks! Maybe it makes sense to write a UI test so we can remove the non-jar code and see such bugs during development.

@strangelookingnerd
Copy link
Contributor Author

Thanks! Maybe it makes sense to write a UI test so we can remove the non-jar code and see such bugs during development.

I’ll try to look into it and may create a PR if I find a solution. But just to be sure: The non-JAR path is only relevant during development but will not be used in „production“ usage. There is no situation where the plugins are being unpacked in a Jenkins deployment?

@uhafner
Copy link
Member

uhafner commented Sep 10, 2024

Thanks! Maybe it makes sense to write a UI test so we can remove the non-jar code and see such bugs during development.

I’ll try to look into it and may create a PR if I find a solution.

I'm not sure if it is worth the effort. This requires a lot of changes in the plugin structure. Do you have a UI test in your consumer plugin?

But just to be sure: The non-JAR path is only relevant during development but will not be used in „production“ usage. There is no situation where the plugins are being unpacked in a Jenkins deployment?

I don't know.

@strangelookingnerd
Copy link
Contributor Author

Thanks! Maybe it makes sense to write a UI test so we can remove the non-jar code and see such bugs during development.

I’ll try to look into it and may create a PR if I find a solution.

I'm not sure if it is worth the effort. This requires a lot of changes in the plugin structure. Do you have a UI test in your consumer plugin?

I gave it a go yesterday and did not really come up with something that actually works.

Using RealJenkinsRule has more or less the same classpath issue from I can tell.
It would work when running Jenkins in a container and have a completely disjunct classpath from what ever the IDE / CI is providing. The overhead seems unreasonable to me.

Adding tests to my consumer plugin seems way more reasonable.

@uhafner
Copy link
Member

uhafner commented Sep 11, 2024

Thanks! Maybe it makes sense to write a UI test so we can remove the non-jar code and see such bugs during development.

I’ll try to look into it and may create a PR if I find a solution.

I'm not sure if it is worth the effort. This requires a lot of changes in the plugin structure. Do you have a UI test in your consumer plugin?

I gave it a go yesterday and did not really come up with something that actually works.

Using RealJenkinsRule has more or less the same classpath issue from I can tell.

Yes, all integration tests run with the classes folder as classpath.

It would work when running Jenkins in a container and have a completely disjunct classpath from what ever the IDE / CI is providing. The overhead seems unreasonable to me.

Adding tests to my consumer plugin seems way more reasonable.

Yes, this is exactly what I mean: we need a UI test (with ATH) to test this setup. This requires a new plugin structure, see https://github.com/jenkinsci/git-forensics-plugin/blob/main/ui-tests/src/test/java/io/jenkins/plugins/forensics/git/SmokeTests.java or https://github.com/jenkinsci/warnings-ng-plugin/blob/main/ui-tests/src/test/java/io/jenkins/plugins/analysis/warnings/SmokeTests.java for some examples.

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

Successfully merging this pull request may close these issues.

2 participants