Plugin installation via automation fails

Now Latest Release Jenkins, new installation of Jenkins getting failed to Run, Plugin installation via automation getting failed! Jenkins through error’s to run.

You’ll need to provide more details about your environment and the failure message that is being reported.

“it doesn’t work” is always hard to remote debug. Try to always include these 3 things.

  1. what did you try? (Code samples, command lines, screenshots, videos, etc)
  2. what did happen? (Error messages, description, outputs, stuff)
  3. what did you expect to happen?

Otherwise, it’s hard for us to get into your context and you’ll have to have someone who is exactly knowledgeable come along.

what did you try? (Code samples, command lines, screenshots, videos, etc)
we are doing some automation using Jenkins ci.
1. Install plugin using bash script
# Download Jenkins CLI if not already present
if [ ! -f “$JENKINS_CLI_JAR” ]; then
wget “$JENKINS_URL/jnlpJars/JENKINS_CLI_JAR" fi # Install each plugin for plugin in "{DEFAULT_PLUGINS[@]}”; do
java -jar $JENKINS_CLI_JAR -s $JENKINS_URL -auth $JENKINS_USER:$JENKINS_TOKEN install-plugin $plugin -deploy
# Restart Jenkins to apply changes
what did happen? (Error messages, description, outputs, stuff)
when we try to install jenkins and plugins that time we face jenkins server getting crashed
what did you expect to happen?
Jenkins - jenkins installation with plugin via ansible automation and bash script automation in RHEL and UBUNTU
we need to fix this error and need a reason why jenkins service crashed.
Note: we expect complete jenkins install through automation we need.

What messages does Jenkins report when it crashes?

The operations you’re performing seem reasonable to me. The Jenkins command line is able to install plugins and the installed plugins should support the version of the Jenkins controller that you are running, so long as that Jenkins controller is supported by the Jenkins update center.

An alternate idea

It is surprising to me that you are attempting to manage your configuration as code without specifying all the plugins you are installing and without specifying the precise versions of the plugins that you are installing. That will give you an unpredictable configuration, since you’ll always receive the most recent releases of the plugin at the time you install the plugins.

I like to specify the exact plugins and their versions so that the configuration is repeatable no matter when I run that configuration. I believe that many other Jenkins administrators do the same.

In my case, I have a plugins.txt file that is maintained by a Python script. I build a Docker container image for the configuration that I want to evaluate, then I use docker run to run that container image on the computer where I created it.

I’m sure others have better techniques that they use to manage their plugin versions, but that method has worked well for me.

Doing it more or less the same since over 8 years. A config file with the plugins I need with the exact versions and then build a docker image out of it for a dedicated Jenkins version.

1 Like

Our Developement at end stage we cant able add docker type installation, that’s why we need Jenkins installation with plugin’s using ansible without any issues.

Karmugilan. K
Senior Software Engineer
YozY Technologies LLP

The technique that @mawinter69 and I are using to manage our plugins is not limited to container installations. However, it is quite different from the approach that you are taking.

Your approach:

  • List a subset of the plugins without specifying a version number of the plugin and without specifying any of the dependencies of the plugin

Our approach:

  • List all plugins with version numbers, including all plugin dependencies

Your approach:

  • Use the Jenkins command line interface to use a running Jenkins to download the plugins into the running Jenkins controller

My approach:

  • Use the Jenkins plugin installation manager tool to download the plugins into a directory that can be used as I start and stop a Jenkins controller to test that set of plugins

I’ve found it easier to use a container image, because I have many other files that benefit from being inside a container image. However, you can use the same technique without using a container image.

Outside of a container image, here is the shell script that I use to download and run a specified version of Jenkins and all the plugins specified in a plugins.txt file:



if [ ! -f ../$PLUGIN_MANAGER_JAR ]; then
if [ ! -d plugins ]; then
  mkdir plugins
java -jar ../$PLUGIN_MANAGER_JAR \
    --jenkins-version $JENKINS_WAR_VERSION \
    --latest false \
    --plugin-download-directory plugins \
    --plugin-file plugins.txt

if [ ! -f ../$JENKINS_WAR ]; then
  wget ${base}/${JENKINS_WAR_VERSION}/jenkins.war
  mv jenkins.war ../$JENKINS_WAR