0

Which tool should I be using in order to be able to control Jenkins plugins from a cli/script in such way that when I have a new installation (e.g. 2.164.3)?

For example, I want to type blueocean - 1.1.15 (older version then current for example) and it will download the dependencies for the given version without messing everything else?

As I see I shouldn't be using jenkins-cli, but https://github.com/jenkinsci/plugin-installation-manager-tool? If so can anyone provide a simple example for the scenario I have given as the documentation is short of simple/clear examples.

The already existing topics are not answering the question in 2020 and I can't solve my scenario with them.

Alexey Vazhnov
  • 139
  • 1
  • 1
  • 9

1 Answers1

1

Why not use Plugin installation manager tool?

Your alternative would be the install-plugins.sh referenced in the tool readme.md. You can explicitly list all plugins and versions or let it auto-resolve dependencies.

See also answer in S/O re:Jenkins plugins for old versions.

Alexey Vazhnov
  • 139
  • 1
  • 1
  • 9
Ian W
  • 449
  • 1
  • 3
  • 7
  • My biggest problem is that I find the implementation not so straightforward. That is why I asked both for confirmation and example.Still confirming is good enough for me to continue trying, I will try out again today, if it works, I will accept the answer, if I find problems with it I will continue to wait someone to provide an example. Thanks. – anVzdGFub3RoZXJodW1hbg Jun 02 '20 at 08:28
  • when I do java -jar jenkins-plugin-manager-1.0.2.jar --war /usr/share/jenkins/jenkins.war -l, I don't get the start pack plugins listed. I have tried this: java -jar jenkins-plugin-manager-1.0.2.jar --war /usr/share/jenkins/jenkins.war --plugins blueocean:1.15.0, it failed for one plugin, but other than it has downloaded in a specific folder that has nothing to do to where my plugins are stored. So my expectations was to see the plugins in Jenkins, but there is nothing it it. – anVzdGFub3RoZXJodW1hbg Jun 02 '20 at 13:42
  • I have tried: java -jar jenkins-plugin-manager-1.0.2.jar --war /usr/share/jenkins/jenkins.war --plugins blueocean:1.15.0, I get a bunch of plugins downloaded, one was unable to be downloaded and I get after no plugins in the default folder, that tool is not useful for me at this point. – anVzdGFub3RoZXJodW1hbg Jun 03 '20 at 08:15
  • Update 4, after a lot of debugging it looks like there is some kind of a bug whenever there is a permissions issue on the default DL folder (it doesn't throw warning about it). I have created new one and changed to it and all was executed successfully, it looks like yesterday I had another bad luck due to the global outage of Jenkins. So, right now I only need to understand what I need to do with the downloaded JPI and if all works out as expected, this will be what I needed. – anVzdGFub3RoZXJodW1hbg Jun 03 '20 at 10:18
  • Final update, it worked for what I want to do with:
    cd plugin-management-cli;
    wget https://github.com/jenkinsci/plugin-installation-manager-tool/releases/download/plugin-management-parent-pom-1.0.2/jenkins-plugin-manager-1.0.2.jar;
    --plugin-download-directory
    cd ~/plugin-management-cli/plugins/
    sudo chown -R jenkins:jenkins ./*
    sudo cp -R ./* /var/lib/jenkins/plugins
    sudo systemctl stop jenkins
    sudo systemctl status jenkins
    sudo systemctl start jenkins
    sudo systemctl status jenkins```
    
    – anVzdGFub3RoZXJodW1hbg Jun 04 '20 at 10:17
  • I am glad you got it working. Managing plugins and their dependencies is a major headache, but is getting better in the newest LTS releases. We try keep it simple by only speaking top level plugins, accept dependencies as resolved, but then track that explicit installed list and only apply security fixes to dependencies until a specified top-level plugin is updated. It's really hard to untangle otherwise. – Ian W Jun 05 '20 at 10:06