Jenkins offline plugins installation issue

Hi, currently I’m creating an automation on Ansible to install Jenkins completely offline. I’m facing issues with installing Plugins. Since we don’t have internet connectivity all the plugins and their dependencies had been downloaded to the “/plugins” folder, but Jenkins complains that cannot read some of the “hpi” files and even if the dependencies have the correct version it still cannot load them.

For a few plugins, this method of downloading and uploading to “/plugins” folder is working but when I add more plugins the issue starts.
On a online instance, I’ve already checked all the plugins and their versions, but when I try with the offline instance with the same plugins and versions it won’t work.

Any ideas?

Make sure that:

  • java versions and jenkins core versions are identical between your online and offline versions
  • ensure all plugins are in the plugins folder (don’t do it incrementally, copy all hpi files from the online version!)
  • check file and folder ownerships, jenkins needs to be able to create subdirs in the plugin folder.

The Java and Jenkins core versions are exactly the same.
Files permissions to plugins folder are open and ownership is correct.

Each plugin hpi file is downloaded from a internal repository on a task loop while Jenkins is offline. The files uploaded to this repository are not literally the same files from the online instance’s folder but their equivalent versions from the Jenkins plugins repository.
The plugins file extension is renamed to “jpi” (Although I’ve tried the same without renaming)

Most of the errors are of this type:
Failed to expand <jenkins home>/plugins/<plugin name>.jpi

The issue still persists, but thanks for the insights!

Most of the plugins are loaded properly but a few aren’t, and they cause other plugins to fail loading as well.

strange error, maybe the files are corrupted in some way.

I thought the same and downloaded and uploaded again and still…

There must be some file that tracks the plugins installed that might be causing the issue

there is no limit how many plugins you can install. I assume you’re on Linux.
Is the plugins directory empty except for the .jpi files?
I would run a checksum on the jpi files and compare that to the checksum on the instance where you have no issues.
Also when you say you downloaded again, did you update the files in your internal repository? Maybe they are already corrupted there.
Is Failed to expand <jenkins home>/plugins/<plugin name>.jpi the only error message or is there a stacktrace attached?
Might be good to post the complete jenkins log

Most of the errors regards missing dependencies which are actually installed!

While adding a proxy config and trying to fix the plugins through the UI I get this error:

org.jvnet.hudson.reactor.ReactorException: java.lang.Error: java.lang.reflect.InvocationTargetException

Maybe let’s change the approach.

How do I install plugins and resolve their dependencies on an offline instance?

On a online machine create a text file with the plugins you want to install. Then use GitHub - jenkinsci/plugin-installation-manager-tool: Plugin Manager CLI tool for Jenkins, this will download all required plugins.
Copy the plugins to your offline machine.

1 Like