49

I have installed Jenkins plugins in two ways i.e. manually keeping the .hpi file in Jenkins home directory, and installing from Jenkins front-end (Manage Jenkins > Manage Plugins).

What I notice here is when I install the plugin manually (downloaded as .hpi file) it installed with extension .hpi and while installing the plugin through Jenkins front-end I notice that plugin again installed as .jpi.

But why? What is going on in the background? I know functionality won't change but it looks interesting to know.

Rob Hruska
  • 118,520
  • 32
  • 167
  • 192
Venkat M
  • 593
  • 1
  • 4
  • 6

3 Answers3

57

Both are supposed to be identical to that extend that Jenkins is renaming hpi to jpi when you install it manually as you said.

The reason why you see both in your JENKINS_HOME is the order in which plugins are loaded when Jenkins boots up: plugin.jpi gets precedence over plugin.hpi in case both are present. This is the way the upload installation makes sure the uploaded version will override the existing one after the restart.

Oliver Gondža
  • 3,386
  • 4
  • 29
  • 49
  • Is it documented anywhere about the precedence? I have a case in which there are two versions of a plugin, hpi (which is an older version), and jpi, the hpi one ended up taking precedence, thus causing issues to other dependant plugins due to incompatibility. – Arcobaleno Mar 21 '23 at 03:30
  • @Arcobaleno, I do not think it is documented, but it can be [verified in code](https://github.com/jenkinsci/jenkins/blob/89d37d8ee34524fe2abfb8f2b7d5409eba70cc5e/core/src/main/java/hudson/init/InitStrategy.java#L45-L60). Your observation feels strange to me. In general, either let Jenkins manage `plugins/` dir content by manipulating plugins through Jenkins, or - when managing the files yourself - always stick to one suffix for all the files. – Oliver Gondža Mar 22 '23 at 07:52
2

Plugins as present in $JENKINS_HOME/plugins/ should always be using the .jpi suffix (with the basename being the plugin identifier). Normally Jenkins will enforce this naming pattern even when uploading a plugin manually, regardless of what filename you used for the upload, so I am not sure how you came to have a *.hpi file here, unless you directly copied it into this filesystem location.

Jesse Glick
  • 24,539
  • 10
  • 90
  • 112
1

Functionally speaking, both are the same.

I found only one slight difference:

In the 2023 version: 2.411, in the case of offline plugins (compiled manually) if you paste the hpi file into /var/jenkins_home/plugins the plugin is not installed. I had to rename it and plugin was automatically installed at the server start:

RUN mv /var/jenkins_home/plugins/easy-webhook-plugin.hpi /var/jenkins_home/plugins/easy-webhook-plugin.jpi

So that could be another difference: hpi are not installed at the start, only jpi plugins

JRichardsz
  • 14,356
  • 6
  • 59
  • 94