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

Drop the version from libraries packaged under WEB-INF/lib #9228

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Vlatombe
Copy link
Member

@Vlatombe Vlatombe commented May 3, 2024

The default mapping requires mvn cleaning every time whenever a library is updated, otherwise it ends up being packaged twice. It also eases deep war comparison.

Con is that it is slightly more difficult to determine library version, since you need to look into lib.jar/META-INF/MANIFEST.MF rather than look at the file name itself.

Testing done

  • Checked startup is successful
  • Checked that /jnlpJars/agent.jar is reachable

Proposed changelog entries

N/A

Proposed upgrade guidelines

N/A

Submitter checklist

Edit tasklist title
Beta Give feedback Tasklist Submitter checklist, more options

Delete tasklist

Delete tasklist block?
Are you sure? All relationships in this tasklist will be removed.
  1. The Jira issue, if it exists, is well-described.
    Options
  2. The changelog entries and upgrade guidelines are appropriate for the audience affected by the change (users or developers, depending on the change) and are in the imperative mood (see examples). Fill in the Proposed upgrade guidelines section only if there are breaking changes or changes that may require extra steps from users during upgrade.
    Options
  3. There is automated testing or an explanation as to why this change has no tests.
    Options
  4. New public classes, fields, and methods are annotated with @Restricted or have @since TODO Javadocs, as appropriate.
    Options
  5. New deprecations are annotated with @Deprecated(since = "TODO") or @Deprecated(forRemoval = true, since = "TODO"), if applicable.
    Options
  6. New or substantially changed JavaScript is not defined inline and does not call eval to ease future introduction of Content Security Policy (CSP) directives (see documentation).
    Options
  7. For dependency updates, there are links to external changelogs and, if possible, full differentials.
    Options
  8. For new APIs and extension points, there is a link to at least one consumer.
    Options

Desired reviewers

@mention

Before the changes are marked as ready-for-merge:

Maintainer checklist

Edit tasklist title
Beta Give feedback Tasklist Maintainer checklist, more options

Delete tasklist

Delete tasklist block?
Are you sure? All relationships in this tasklist will be removed.
  1. There are at least two (2) approvals for the pull request and no outstanding requests for change.
    Options
  2. Conversations in the pull request are over, or it is explicit that a reviewer is not blocking the change.
    Options
  3. Changelog entries in the pull request title and/or Proposed changelog entries are accurate, human-readable, and in the imperative mood.
    Options
  4. Proper changelog labels are set so that the changelog can be generated automatically.
    Options
  5. If the change needs additional upgrade steps from users, the upgrade-guide-needed label is set and there is a Proposed upgrade guidelines section in the pull request title (see example).
    Options
  6. If it would make sense to backport the change to LTS, a Jira issue must exist, be a Bug or Improvement, and be labeled as lts-candidate to be considered (see query).
    Options

The default mapping requires `mvn clean`ing every time whenever a library is
updated, otherwise it ends up being packaged twice. It also eases deep
war comparison.
@Vlatombe Vlatombe added the developer Changes which impact plugin developers label May 3, 2024
@Vlatombe Vlatombe requested a review from a team May 3, 2024 12:11
@daniel-beck
Copy link
Member

It also eases deep war comparison.

OTOH makes it more difficult to determine for a given war, which version of a library is included.

@Vlatombe Vlatombe marked this pull request as draft May 3, 2024 14:29
@Vlatombe
Copy link
Member Author

Vlatombe commented May 3, 2024

java.io.FileNotFoundException: lib/remoting-3206.vb_15dcf73f6a_9.jar
	at hudson.model.Slave$JnlpJar.getURL(Slave.java:470)

Some tests look broken, back to draft.

@Vlatombe Vlatombe marked this pull request as ready for review May 6, 2024 14:39
Copy link
Member

@basil basil left a comment

Choose a reason for hiding this comment

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

-0 from me. I don't feel strongly enough to block the change, but I somewhat like the status quo, as it improves observability (e.g. when listing open file descriptors with pfiles or ls -lah /proc/$PID/fd). Admittedly, I only ever run mvn clean verify (never mvn verify, for exactly this reason), but my experience is that the former is good enough. I have a natural bias for observability over performance, and I recognize that others have different priorities, which is why I am not blocking this PR, but I would prefer to keep this as-is and to close this PR.

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.

I have a preference (+0) for stability in the list of ZIP entries.

Regarding version lookups, jenkins.war!/META-INF/maven/org.jenkins-ci.main/jenkins-war/pom.xml and jenkins.war!/WEB-INF/lib/jenkins-core.jar!/META-INF/maven/org.jenkins-ci.main/jenkins-core/pom.xml contain resolved version numbers.

@basil
Copy link
Member

basil commented May 14, 2024

I have a preference (+0) for stability in the list of ZIP entries.

For what reason do you have this preference?

Regarding version lookups, jenkins.war!/META-INF/maven/org.jenkins-ci.main/jenkins-war/pom.xml and jenkins.war!/WEB-INF/lib/jenkins-core.jar!/META-INF/maven/org.jenkins-ci.main/jenkins-core/pom.xml contain resolved version numbers.

My complaint is that these aren't casually visible to system-level debugging tools and require more effort to peel open.

@jglick
Copy link
Member

jglick commented May 14, 2024

For what reason do you have this preference?

Same as in PR description. Also easier to maintain scripts which pick out a member by name. No strong feeling, but have generally encountered fewer problems with Maven projects configured to suppress the default behavior of injecting -${project.version} into artifact filenames.

@basil
Copy link
Member

basil commented May 14, 2024

Also easier to maintain scripts which pick out a member by name.

That seems like a pretty contrived use case to me—better to construct the WAR file as desired rather than pick out a member in a script after the fact.

No strong feeling, but have generally encountered fewer problems with Maven projects configured to suppress the default behavior of injecting -${project.version} into artifact filenames.

No strong feeling either, but from the other perpsective one could also make the argument that deviating from the default behavior for any reason is an increase in code that has to be maintained (even a small one).

@Vlatombe
Copy link
Member Author

Talking about technical debt, I had issues in the past with a setup relying on a custom jenkinsWarId provided to maven-hpi-plugin, that was embedding a different version of remoting than the version that was ending up in maven classpath.

Could be qualified as an exotic use case, but that still exists in real life.

This was leading to test errors like java.io.FileNotFoundException: lib/remoting-XXXX.jar for tests relying on JenkinsRule#createOnlineSlave that were difficult to diagnose.

Dropping the version from packaging would have avoided that kind of issue.

@Vlatombe
Copy link
Member Author

deviating from the default behavior

Maven defaults are not always sane TBH.

@daniel-beck
Copy link
Member

Dropping the version from packaging would have avoided that kind of issue.

That case looks more like a reason to keep the version, seems like the error was fairly explicit, and resulting behavior discrepancies between jars would be far more difficult to diagnose?

@Vlatombe
Copy link
Member Author

Vlatombe commented May 16, 2024

the error was fairly explicit

Actually not so much, added clarification in

throw new FileNotFoundException("Could not find " + warRelativePath + " in " + Jenkins.get().servletContext.getResource("/")); // giving up

One more protection that could be added would be for maven-hpi-plugin to validate that the jenkins core version in classpath is the same as the core version provided part of the custom jenkinsWarId.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
developer Changes which impact plugin developers
Projects
None yet
6 participants