-
-
Notifications
You must be signed in to change notification settings - Fork 77
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
Fix flatten plugin #706
Draft
jtnord
wants to merge
3
commits into
jenkinsci:master
Choose a base branch
from
jtnord:fix-flatten-plugin
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Fix flatten plugin #706
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,19 @@ | ||
assert new File(basedir, '../../local-repo/io/jenkins/plugins/incrementals-and-plugin-bom/1.0-SNAPSHOT/incrementals-and-plugin-bom-1.0-SNAPSHOT.hpi').file | ||
assert new File(basedir, '../../local-repo/io/jenkins/plugins/incrementals-and-plugin-bom/1.0-rc1234.deadbeef5678/incrementals-and-plugin-bom-1.0-rc1234.deadbeef5678.hpi').file | ||
String pomXml = new File(basedir, '../../local-repo/io/jenkins/plugins/incrementals-and-plugin-bom/1.0-rc1234.deadbeef5678/incrementals-and-plugin-bom-1.0-rc1234.deadbeef5678.pom').text | ||
assert pomXml.contains('version>1.0-rc1234.deadbeef5678</version>') | ||
// https://github.com/jenkinsci/plugin-pom/issues/705 | ||
// line endings need normalising | ||
assert pomXml.replace("\r\n", "\n").contains(''' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. flatten plugin creates poms with native line ends - yet this file may or may not be using native line ends depending on the local git setup - so normalize them. |
||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>io.jenkins.tools.bom</groupId> | ||
<artifactId>bom-2.361.x</artifactId> | ||
<version>1580.v47b_429a_c853a</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement>'''.replace("\r\n", "\n")) | ||
return true |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 is the bit we change. interpolate replaces any properties.
may need to be
expand
as currently the flatten plugin will strip the parent info so would loose anydepMgmt
specified in a parent.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.
So what does the result actually look like in the original example? Does it effectively inline all deps from the imported BOM? We do not wish for a flattened POM to retain any reference to another POM file—it should be entirely self-contained.
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.
you mean when consumed by the okhttp-api plugin?
with interpolate it keeps the
dependencyManagement
as is from the plugins's pom but with any properties replaced.With expand it gets messy! (it is basically the output of the
dependencyManagement
section ofhelp:effective-pom
which is all poms from scope-> import basically inlined. (and everything from the parent)Whilst I create a PR to demonstrate it will be like the following if we used
expand
depMgmt section
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.
Yikes, that is a lot, and I guess there is no way to restrict it to the actual transitive deps.
🤷 we can try this, I am just concerned it will result in other weird problems down the line. It is hard to predict the practical effect of changes like this in such a huge ecosystem, which is why I asked whether there were more than one known example, or if we could just work around the issue in this one plugin for now.
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.
given we have an extension we could write our own
DefaultInheritanceAssembler;
that is hpi aware, however I would consider that more risky than just including thedependencyManagement
section - which at the end of the day we have been doing for years for plugins released withm-r-p
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.
https://repo.jenkins-ci.org/incrementals/io/jenkins/plugins/okhttp-api/4.10.0-126.v8a_8a_2605a_a_e7/ (interpolate)
https://repo.jenkins-ci.org/incrementals/io/jenkins/plugins/okhttp-api/4.10.0-126.v01d52e6d79e4/ (expand)
whilst expand is a lot and a lot of unused dependencies - as they are not transitive dependencies it will not matter if you favour completeness and correctness over simplicity (and incorrectness if the dependencyManagement is in a parent).
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.
discussed directly with @jglick as the intention of the flatten plugin here is to have a self contained pom - this will switch to
expand
which will also have the benefit of picking up any<dependencyManagement>
configured in the parent(s).