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

Enable installation of plugin dependencies #175

Closed
wants to merge 3 commits into
base: master
from

Conversation

Projects
None yet
3 participants
@jsm
Contributor

jsm commented Apr 10, 2014

No description provided.

@sethvargo

This comment has been minimized.

Contributor

sethvargo commented Apr 10, 2014

Hi @jsm! First of all, thank you for the Pull Request. This looks awesome.

I'm going to make some stylistic comments, but this is definitely a much-needed feature. We could not figure out how to install/manage plugin dependencies when I originally wrote this, so excellent work!

It would be really great if you could add a test for this. We already have a verbose plugin test suite, so you could just tack something onto the end with dependencies and assert they are installed. I'm more than happy to help walk you through it.

@@ -91,6 +102,7 @@ def source(arg = nil)
def installed?
!!@installed
end

This comment has been minimized.

@sethvargo

sethvargo Apr 10, 2014

Contributor

Please remove extra newline

@@ -248,9 +261,63 @@ def action_uninstall
end
end

This comment has been minimized.

@sethvargo

sethvargo Apr 10, 2014

Contributor

Extra newlines here

# Find all dependencies and install them
#
def install_dependencies(plugin_file)

This comment has been minimized.

@sethvargo

sethvargo Apr 10, 2014

Contributor

Extra newlines here

def install_dependencies(plugin_file)
require 'zip'
require 'nokogiri'

This comment has been minimized.

@sethvargo

sethvargo Apr 10, 2014

Contributor

👎 on using nokogiri here. It makes installing/managing the cookbook mostly impossible. You need to have build-essential and bunch of libs installed just to use it. Are you familiar with REXML, Ruby's native XML-parsing library? It's API is less pretty, but it's bunded with Ruby core. We actually use it in the test suites if you need an example.

plugin.install_dependencies
plugin.run_action(:install)
end

This comment has been minimized.

@sethvargo

sethvargo Apr 10, 2014

Contributor

Extra newline

#
# Find all dependencies and install them
#

This comment has been minimized.

@sethvargo

sethvargo Apr 10, 2014

Contributor

This needs YARD documentation for the parameter and return type.

version settings["version"] if settings["version"]
install_dependencies
end
end

This comment has been minimized.

@sethvargo

sethvargo Apr 10, 2014

Contributor

We do not want to support this recipe. Please remove it.

@jsm

This comment has been minimized.

Contributor

jsm commented Apr 10, 2014

Any ideas on an alternative to using rubyzip?

@sethvargo

This comment has been minimized.

Contributor

sethvargo commented Apr 10, 2014

@jsm is there no way to get to the POM without unzipping?

@sethvargo

This comment has been minimized.

Contributor

sethvargo commented Apr 10, 2014

Or could we install the plugin and then circle back?

@jsm

This comment has been minimized.

Contributor

jsm commented Apr 23, 2014

Not sure what to do about the rubyzip stuff, but I did take out nokogiri. Could you run me through your testing setup so I can add that test?

Also, the reason I left that plugins recipe in for now, is that it installs rubyzip.

@sethvargo

This comment has been minimized.

Contributor

sethvargo commented Apr 28, 2014

@jsm is there any way we can grab the poms out of the repo (http://repo.jenkins-ci.org/releases/) instead of unzipping things on the local FS?

@jsm

This comment has been minimized.

Contributor

jsm commented Apr 29, 2014

From what I can tell, it doesn't have even close to all the plugins in there :/

@hschaeidt

This comment has been minimized.

Contributor

hschaeidt commented Jun 17, 2014

I just suggested a pull request to your changes. It gives the user the ability to switch the plugin mirror.

Link: jsm#1

Also I just added one simple test to test @jsm changes. I'm note sure about how the execution works, maybe you guys can check.

Hendrik

@hschaeidt

This comment has been minimized.

Contributor

hschaeidt commented Jun 23, 2014

@sethvargo @jsm

Looks like all the plugins can be found on Github at.

http://github.com/jenkinsci/${project.artifactId}-plugin

Maybe it is possible to get the information from the raw pom file there:

https://raw.githubusercontent.com/jenkinsci/< PLUGIN_ARTIFACT_NAME >-plugin/< VERSION_HERE >/pom.xml

@sethvargo

This comment has been minimized.

Contributor

sethvargo commented Jun 23, 2014

@hschaeidt interesting idea - it may work out. @jsm what do you think?

In my opinion, the efforts in this conversation are misplaced. This is a bug in Jenkins. I really think we should push on the Jenkins core team to fix this bug before creating a workaround solution. Pulling the plugin from GitHub seems like a good idea, but there's no reason why the install-plugin CLI command should behave differently than the WebUI. There's currently no way to programmatically install a plugin and its dependencies - I would consider that a bug.

Do we know if there is an open issue on JENKINS for this?

@hschaeidt

This comment has been minimized.

Contributor

hschaeidt commented Jun 23, 2014

@sethvargo you may be right about this. However in the meantime it is a pain to manually declare all plugins + dependencies + dependencies of dependencies.

I've found out that the puppet module is having a similar issue. They've posted a strange workaround.

The puppet issue: rtyler/puppet-jenkins#46
The workaround gist: https://gist.github.com/jedi4ever/898114

I couldn't find any related issue in the JENKINS project.

@sethvargo

This comment has been minimized.

Contributor

sethvargo commented Jun 23, 2014

@hschaeidt we should definitely create an issue in JENKINS then. Do you want to take that effort?

@hschaeidt

This comment has been minimized.

Contributor

hschaeidt commented Jun 26, 2014

I just doubled checked everything before opening an issue.
I just tried to install the plugins manually:

$ java -jar jenkins-cli.jar -s http://localhost:8080 install-plugin git
Installing git from update center

That installed me all hard dependencies with the plugin.

My test setup:

node.default['jenkins']['master']['install_method'] = 'war'
node.default['jenkins']['master']['version'] = '1.555'
node.default['jenkins']['master']['mirror'] = 'http://jenkins.mirror.isppower.de'
node.default['jenkins']['master']['source'] = "#{node['jenkins']['master']['mirror']}/war/#{node['jenkins']['master']['version']}/jenkins.war"

So in my point of vue everything works as expected through CLI. @sethvargo can you confirm?

@sethvargo

This comment has been minimized.

Contributor

sethvargo commented Jun 26, 2014

@hschaeidt what about transitive dependencies though? What version of Jenkins? It would be great if this stuff was fixed in Jenkins-land.

@hschaeidt

This comment has been minimized.

Contributor

hschaeidt commented Jun 27, 2014

@sethvargo they were installed too. I think the problems solution is much easier than we're thinking right now. I think the problem is the update-center. By downloading the jenkins.war it comes without any update-center data, the first updateCenter data is retrieved only some minutes after the jenkins server has started.

In the plugin library of this repository every plugin hpi is downloaded into the cache then installed from there, instead of using the jenkins update-center.

The jenkins-cli itself is operating exactly as expected. Only when you are using the updateCenter the dependencies and are being installed too. When installing from source those will be ignored. That may make sense because I think this option to install from source was designed to install private plugins that can't be cough through the update-center.

So the solution would be to use the update-center instead of downloading the hpi files manually.

An issue with workaround related to that can be found here:
https://issues.jenkins-ci.org/browse/JENKINS-10061
https://github.com/fnichol/chef-jenkins/issues/9

@sethvargo

This comment has been minimized.

Contributor

sethvargo commented Jun 30, 2014

Fixed as part of 3cb8738.

@sethvargo sethvargo closed this Jun 30, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment