-
Notifications
You must be signed in to change notification settings - Fork 340
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
Exclude all transitive dependencies of ssj
besides commons-math3
and replace linear regression implementation
#638
Conversation
…replace linear regression implementation
@@ -104,6 +96,11 @@ | |||
<groupId>io.jenkins.plugins</groupId> | |||
<artifactId>plugin-util-api</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.apache.commons</groupId> | |||
<artifactId>commons-math3</artifactId> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was already a dependency via ssj
, I think it was just unused previously, but now we use it for SimpleRegression
.
import org.kohsuke.accmod.Restricted; | ||
import org.kohsuke.accmod.restrictions.NoExternalUse; | ||
import org.kohsuke.stapler.bind.JavaScriptMethod; | ||
import umontreal.ssj.functionfit.LeastSquares; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uses libraries from colt
, which we can avoid by using SimpleRegression
instead.
|
||
SimpleRegression sr = new SimpleRegression(true); | ||
for (int i = 0; i < lrX.length; i++) { | ||
sr.addData(lrX[i], lrY[i]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit awkward, but the SimpleRegression
methods that accept arrays of data expect double[n][2]
instead of double[2][n]
, so I did not see a simpler approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Also though, looking at the uses of The uses of (with changes like these we could drop the |
CC @mdealer |
#625 added a dependency on
ssj
, which in turn picked up a few additional dependencies. I think we can avoid some of these dependencies to reduce the size of the HPI, avoid unusual licenses, and reduce supply chain risk by excluding all dependencies ofssj
except forcommons-math3
.While reviewing the update, some of these dependencies stood out to me as being a bit unusual.
colt:colt
jar
downloads but does not mention anything about Maven, and from some quick searches it is not clear to me who ownscolt:colt
on Maven central.hep.aida.*
packages (which are unused byssj
, but due to the nature of Jenkins plugins are exposed to plugins that depend onjunit
) are LGPL "with the exception that any usage related to military applications is expressly forbidden", which means that it is definitely not an OSI-approved license (which is a requirement for plugins hosted byjenkinsci
), so that seems bad. There are different versions of the library under othergroupId
s where the problematic package has been removed, but none that have clear ownership on Maven central traceable to a clear and current owner.concurrent:concurrent
All we need from
ssj
is linear least squares regression (LeastSquares
) and some kind of smoothed spline interpolation (SmoothingCubicSpline
).LeastSquares
makes use of classes from thecolt
library, which I would prefer to avoid, butcommons-math3
has a direct replacement in itsSimpleRegression
class.SmoothingCubicSpline
incommons-math3
. There isSplineInterpolator
, but it does not have smoothing support. Probably smoothing support good enough for our purposes (just a visual aid in some charts) could be implemented on top ofSplineInterpolator
with some preprocessing on our side if someone is interested and wants to spend some time on it.Note:
Really I would prefer to not depend on
ssj
at all, and instead just copy the source code ofSmoothingCubicSpline
into this repo with proper attribution. I doubt we care at all about tracking updates for the code we are using, and there is a good chance the code will never change anyway. I am also a bit concerned that the 3.3.2 version that we are using and that is in Maven central is only mentioned in the README in https://github.com/umontreal-simul/ssj, and there is no corresponding release or tag. However, I did not find any good way to report licensing information correctly via https://github.com/jenkinsci/license-maven-plugin and https://www.mojohaus.org/license-maven-plugin/ without having the library that you want to include the license for actually be adependency
.Testing done
I ran the plugin, created a job that created random test data and recorded it with this plugin, built the job around 50 times, took a screenshot of the charts on the test history page with and without my changes, and verified that the relevant trend lines in the screenshots were the same.
Submitter checklist