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-20679] Try to declare the minimum Java version in the manifest #75

Merged
merged 9 commits into from
Dec 5, 2018

Conversation

daniel-beck
Copy link
Member

@daniel-beck daniel-beck commented Sep 10, 2017

JENKINS-20679

Only tested manually, including with a patched plugins POM to see whether the compiler plugin configuration fallback works. Can rip that out and we only support property or HPI plugin configuration for this.

Downstream PRs are jenkins-infra/update-center2#164 and jenkinsci/jenkins#3016.

Upstream of: jenkinsci/plugin-pom#134

@jenkinsci/code-reviewers

@KostyaSha
Copy link
Member

KostyaSha commented Sep 10, 2017

Unfortunately hpi-plugin is not using jar-plugin. Does maven-jar-plugin put such info? Could you compare with generic maven project with jar packaging manifest? Is it missing something else?

@daniel-beck
Copy link
Member Author

@KostyaSha Not sure what you mean, could you elaborate? Also, note that I don't want to mechanically pick up whatever is used to build the plugin (may be too recent, or there may be reasons to require a newer JRE to actually run), so the Build-Jdk entry is unsuitable.

@KostyaSha
Copy link
Member

Checked myself. Seems maven-jar is not setting this information. I thought it includes more information in manifest :/

Copy link
Member

@oleg-nenashev oleg-nenashev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐝 . There may be a need to check if the dependencies are compliant with the declared version, but IIRC it's already done by other tools

@daniel-beck
Copy link
Member Author

@oleg-nenashev Animal sniffer and enforcer use the java.level in the plugins POM. While there may be rare situations this isn't good enough (e.g. custom parent POM/overrides), we should just treat those as bugs in the plugin (responsibility to set the HPI plugin parameter if somehow needing a newer JRE as automatically determined) and ignore it otherwise.

Copy link
Member

@jglick jglick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Too magical, not the Maven way.

@daniel-beck
Copy link
Member Author

This change + the downstream change to plugin POM should probably done sooner rather than later.

The corresponding core change is only needed when core supports Java 9 at all, and the infra change can be implemented even later (theoretically).

@batmat batmat self-requested a review February 13, 2018 10:54
@jglick
Copy link
Member

jglick commented Feb 27, 2018

the downstream change to plugin POM

Where is that?

Copy link
Member

@jglick jglick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK so far as it goes, but needs to be evaluated in context of matching PRs.

@daniel-beck daniel-beck self-assigned this Feb 27, 2018
@jglick
Copy link
Member

jglick commented Apr 19, 2018

Is there something filed downstream of this?

@daniel-beck
Copy link
Member Author

@jglick See original PR comment.

@jglick
Copy link
Member

jglick commented May 11, 2018

I think on hold while discussions in the downstreams continue.

@oleg-nenashev
Copy link
Member

@jenkinsci/java11-support

Copy link
Member

@batmat batmat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but I commented in https://github.com/jenkinsci/maven-hpi-plugin/pull/75/files#r236275067 about my main concern currently.

@oleg-nenashev
Copy link
Member

And then Maven integration tests failed... as designed, I believe. Will add flags there

@oleg-nenashev
Copy link
Member

oleg-nenashev commented Nov 30, 2018

There is a chicken-and-egg problem in integration tests. They fail, because minimumJavaVersion is now required as the reviewers suggested. The problem is that the tests use old versions of Plugin POM which do not include jenkinsci/plugin-pom#134 (downstream of this PR).

option 1: I could release a snapshot of the Parent POM, update integration tests to such timestamped snapshot (upper bounds, yey), and then the tests would be green. But it requires a circular dependency in the release. It should be Okay in this case

option 2: Reconsider the approach and do not require minimumJavaVersion to be always set. In such case we will have no breaking changes, and the integration tests will pass with previous plugin POMs

@jglick @daniel-beck @jenkinsci/java11-support Would appreciate an advice how to proceed

@batmat
Copy link
Member

batmat commented Nov 30, 2018

IMO if we step back:

  • in the general case, i.e. if we don't take the current state in account, I am still convinced we should require it. It's much clearer and we can leverage this in many locations to serve better the Jenkins users by filtering out the incompatible plugins for their setup. AFAIK we all agree that this is more and more needed, if not overdue.
  • anyway nobody is going to see her/his plugin start failing to build right after we merge and release the new maven-hpi-plugin. This requires an explicit version bump, and in such case said developers will just spend the needed 5 seconds to decide what minimum Java version they are actually supporting, done.
  • The ITs here are obviously a special case, and are failing exactly for the contrary reason as the previous point: this uses the latest version of the maven-hpi-plugin on an old plugin. Which in real life would be no-brainer: developer adds the newly required minimumJavaVersion field, done. So despite this is a bit crappy here to have to modify existing ITs, I don't see really an other way out, so let's bite the bullet.

So, for the issue at stake here IMO this is why we should go for option 1, because requiring the field is the most important and the right long-term decision.

Copy link

@MRamonLeon MRamonLeon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer the option 1.

@jglick
Copy link
Member

jglick commented Nov 30, 2018

Alternately, make the Java version optional (with a warning) for now, release everything, then immediately afterward go back and make it mandatory by switching the parent POMs in the ITs to use the prior release.

@oleg-nenashev
Copy link
Member

Deployed the current state as 3.0-20181203.145945-2

@oleg-nenashev
Copy link
Member

Going forward with option 1

@oleg-nenashev
Copy link
Member

@jenkinsci/java11-support @jglick The rest of integration tests are failing with...

[WARNING] Could not validate integrity of download from https://repo.jenkins-ci.org/public/org/jenkins-ci/tools/maven-hpi-plugin/3.0-SNAPSHOT/maven-hpi-plugin-3.0-20181203.145945-2.pom.sha1: Checksum validation failed, no checksums available

[WARNING] Could not validate integrity of download from https://repo.jenkins-ci.org/public/org/jenkins-ci/tools/maven-hpi-plugin/3.0-SNAPSHOT/maven-hpi-plugin-3.0-20181203.145945-2.jar.sha1: Checksum validation failed, no checksums available

[INFO] ..FAILED (44.9 s)

I cannot do much about that, so I suggest merging as is and then fixing the PR builder after releasing the downstream patch and bumping to the released version of Plugin POM. Are you fine with it?

@batmat
Copy link
Member

batmat commented Dec 3, 2018

You mean releasing the plugin-pom jenkinsci/plugin-pom#134. I guess let's do that, yes.

Inject `Minimum-Java-Version` into the manifest.
* It is set by a new mandatory `minimumJavaVersion` parameter in `hpi:hpi`, `hpi:jar` and `hpi:hpl`
* Format: `java.specification.version` according to [Java JEP-223](https://openjdk.java.net/jeps/223).
Examples: `1.6`, `1.7`, `1.8`, `6`, `7`, `8`, `9`, `11`, ...
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh? That JEP seems to say the format should be 6, 7, etc., and not 1.6, 1.7, etc. as before. So which is the version format expected by this feature?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://openjdk.java.net/jeps/223 . 1.6 and 1.7 are the old formats of Java specification, we should not maintain them going forward imho

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, so why would we support them at all in this newly added feature?

@oleg-nenashev oleg-nenashev merged commit 4747f63 into jenkinsci:master Dec 5, 2018
@oleg-nenashev
Copy link
Member

Maven release failed due to the duplicate metadata file, but I see it for other Maven Plugins in Jenkins org as well. The release itself should be fine

[INFO] [INFO] --- maven-deploy-plugin:2.6:deploy (default-deploy) @ maven-hpi-plugin ---
[INFO] Uploading to maven.jenkins-ci.org: https://repo.jenkins-ci.org/releases/org/jenkins-ci/tools/maven-hpi-plugin/3.0/maven-hpi-plugin-3.0.jar
[INFO] Progress (1): 2.0/140 kB
[INFO] Progress (1): 4.1/140 kB
[INFO] Progress (1): 6.1/140 kB
[INFO] Progress (1): 8.2/140 kB
[INFO] Progress (1): 10/140 kB 
[INFO] Progress (1): 12/140 kB
[INFO] Progress (1): 14/140 kB
[INFO] Progress (1): 16/140 kB
[INFO] Progress (1): 18/140 kB
[INFO] Progress (1): 20/140 kB
[INFO] Progress (1): 23/140 kB
[INFO] Progress (1): 25/140 kB
[INFO] Progress (1): 27/140 kB
[INFO] Progress (1): 29/140 kB
[INFO] Progress (1): 31/140 kB
[INFO] Progress (1): 33/140 kB
[INFO] Progress (1): 35/140 kB
[INFO] Progress (1): 37/140 kB
[INFO] Progress (1): 39/140 kB
[INFO] Progress (1): 41/140 kB
[INFO] Progress (1): 43/140 kB
[INFO] Progress (1): 45/140 kB
[INFO] Progress (1): 47/140 kB
[INFO] Progress (1): 49/140 kB
[INFO] Progress (1): 51/140 kB
[INFO] Progress (1): 53/140 kB
[INFO] Progress (1): 55/140 kB
[INFO] Progress (1): 57/140 kB
[INFO] Progress (1): 59/140 kB
[INFO] Progress (1): 61/140 kB
[INFO] Progress (1): 63/140 kB
[INFO] Progress (1): 66/140 kB
[INFO] Progress (1): 68/140 kB
[INFO] Progress (1): 70/140 kB
[INFO] Progress (1): 72/140 kB
[INFO] Progress (1): 74/140 kB
[INFO] Progress (1): 76/140 kB
[INFO] Progress (1): 78/140 kB
[INFO] Progress (1): 80/140 kB
[INFO] Progress (1): 82/140 kB
[INFO] Progress (1): 84/140 kB
[INFO] Progress (1): 86/140 kB
[INFO] Progress (1): 88/140 kB
[INFO] Progress (1): 90/140 kB
[INFO] Progress (1): 92/140 kB
[INFO] Progress (1): 94/140 kB
[INFO] Progress (1): 96/140 kB
[INFO] Progress (1): 98/140 kB
[INFO] Progress (1): 100/140 kB
[INFO] Progress (1): 102/140 kB
[INFO] Progress (1): 104/140 kB
[INFO] Progress (1): 106/140 kB
[INFO] Progress (1): 109/140 kB
[INFO] Progress (1): 111/140 kB
[INFO] Progress (1): 113/140 kB
[INFO] Progress (1): 115/140 kB
[INFO] Progress (1): 117/140 kB
[INFO] Progress (1): 119/140 kB
[INFO] Progress (1): 121/140 kB
[INFO] Progress (1): 123/140 kB
[INFO] Progress (1): 125/140 kB
[INFO] Progress (1): 127/140 kB
[INFO] Progress (1): 129/140 kB
[INFO] Progress (1): 131/140 kB
[INFO] Progress (1): 133/140 kB
[INFO] Progress (1): 135/140 kB
[INFO] Progress (1): 137/140 kB
[INFO] Progress (1): 139/140 kB
[INFO] Progress (1): 140 kB    
[INFO]                     
[INFO] Uploaded to maven.jenkins-ci.org: https://repo.jenkins-ci.org/releases/org/jenkins-ci/tools/maven-hpi-plugin/3.0/maven-hpi-plugin-3.0.jar (140 kB at 69 kB/s)
[INFO] Uploading to maven.jenkins-ci.org: https://repo.jenkins-ci.org/releases/org/jenkins-ci/tools/maven-hpi-plugin/3.0/maven-hpi-plugin-3.0.pom
[INFO] Progress (1): 2.0/12 kB
[INFO] Progress (1): 4.1/12 kB
[INFO] Progress (1): 6.1/12 kB
[INFO] Progress (1): 8.2/12 kB
[INFO] Progress (1): 10/12 kB 
[INFO] Progress (1): 12/12 kB
[INFO] Progress (1): 12 kB   
[INFO]                    
[INFO] Uploaded to maven.jenkins-ci.org: https://repo.jenkins-ci.org/releases/org/jenkins-ci/tools/maven-hpi-plugin/3.0/maven-hpi-plugin-3.0.pom (12 kB at 15 kB/s)
[INFO] Downloading from maven.jenkins-ci.org: https://repo.jenkins-ci.org/releases/org/jenkins-ci/tools/maven-hpi-plugin/maven-metadata.xml
[INFO] Progress (1): 0.7/2.6 kB
[INFO] Progress (1): 2.1/2.6 kB
[INFO] Progress (1): 2.6 kB    
[INFO]                     
[INFO] Downloaded from maven.jenkins-ci.org: https://repo.jenkins-ci.org/releases/org/jenkins-ci/tools/maven-hpi-plugin/maven-metadata.xml (2.6 kB at 7.3 kB/s)
[INFO] Downloading from maven.jenkins-ci.org: https://repo.jenkins-ci.org/releases/org/jenkins-ci/tools/maven-metadata.xml
[INFO] Progress (1): 385 B
[INFO]                    
[INFO] Downloaded from maven.jenkins-ci.org: https://repo.jenkins-ci.org/releases/org/jenkins-ci/tools/maven-metadata.xml (385 B at 1.5 kB/s)
[INFO] Uploading to maven.jenkins-ci.org: https://repo.jenkins-ci.org/releases/org/jenkins-ci/tools/maven-hpi-plugin/maven-metadata.xml
[INFO] Progress (1): 2.0/2.5 kB
[INFO] Progress (1): 2.5 kB    
[INFO]                     
[INFO] Uploaded to maven.jenkins-ci.org: https://repo.jenkins-ci.org/releases/org/jenkins-ci/tools/maven-hpi-plugin/maven-metadata.xml (2.5 kB at 3.1 kB/s)
[INFO] Uploading to maven.jenkins-ci.org: https://repo.jenkins-ci.org/releases/org/jenkins-ci/tools/maven-metadata.xml
[INFO] Progress (1): 385 B
[INFO]                    
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] BUILD FAILURE
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Total time:  26.541 s
[INFO] [INFO] Finished at: 2018-12-05T09:58:38+01:00
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.6:deploy (default-deploy) on project maven-hpi-plugin: Failed to deploy metadata: Could not transfer metadata org.jenkins-ci.tools/maven-metadata.xml from/to maven.jenkins-ci.org (https://repo.jenkins-ci.org/releases/): Access denied to: https://repo.jenkins-ci.org/releases/org/jenkins-ci/tools/maven-metadata.xml -> [Help 1]
[INFO] [ERROR] 
[INFO] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[INFO] [ERROR] Re-run Maven using the -X switch to enable full debug logging.
[INFO] [ERROR] 
[INFO] [ERROR] For more information about the errors and possible solutions, please read the following articles:
[INFO] [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

@olamy
Copy link
Member

olamy commented Dec 5, 2018

@oleg-nenashev nope not duplicated! but you cannot write the maven-metadata.xml (error message says Access denied to: https://repo.jenkins-ci.org/releases/org/jenkins-ci/tools/maven-metadata.xml ). I had the same problem recently... might be an infra issue... (not source files are probably not deploy...)

@daniel-beck
Copy link
Member Author

The patterns used for upload permissions from https://github.com/jenkins-infra/repository-permissions-updater/ do not allow for a package level metadata file.

@olamy
Copy link
Member

olamy commented Dec 11, 2018

this is not an issue until we want to add new maven plugin.

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

Successfully merging this pull request may close these issues.

None yet

8 participants