Skip to content
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

plugin resources don't install dependency's #677

Open
ddryden opened this issue Nov 22, 2016 · 8 comments
Open

plugin resources don't install dependency's #677

ddryden opened this issue Nov 22, 2016 · 8 comments

Comments

@ddryden
Copy link

ddryden commented Nov 22, 2016

I've just applied quite a simple manifest and realised that the plugins don't install dependency's.

Class { 'jenkins': }
jenkins::plugin { 'git': }
jenkins::plugin { 'google-login': }

Then when i login to the installed jenkins instance I see the following error in Manage Jenkins:

There are dependency errors loading some plugins:
Jenkins Git plugin v3.0.1
workflow-scm-step v1.14.2 is missing. To fix, install v1.14.2 or later.
git-client v2.1.0 is missing. To fix, install v2.1.0 or later.
mailer v1.18 is missing. To fix, install v1.18 or later.
matrix-project v1.7.1 is missing. To fix, install v1.7.1 or later.
scm-api v1.3 is missing. To fix, install v1.3 or later.
ssh-credentials v1.12 is missing. To fix, install v1.12 or later.
Google Login Plugin v1.3
mailer v1.6 is missing. To fix, install v1.6 or later.

I've also noticed that the package list isn't populated.

@marcinzaremba
Copy link

marcinzaremba commented Nov 29, 2016

That is expected behavior. This class installs plugin by downloading them and putting them manually to Jenkins /var/lib/jenkins/plugins folder and during startup Jenkins installs them. If you want to resolve dependencies you can install via GUI or you can execute Groovy script to achieve the same goal.

@ddryden
Copy link
Author

ddryden commented Nov 30, 2016

Thanks, I didn't realise that was the intended behaviour. Is the Groovy script included with Jenkins?

@miguelwhite
Copy link

Can we implement a feature in this module to add a install_dependencies param that if set to true will run said Groovy script?

@jhoblitt
Copy link
Member

The update center does not provide recursive dependency information for anything but the latest release of a plugin. This means that in order to support installing a specifc plugin version we have to handle this "outside" of jenkins. We need to implement a constraint resolver that parses plugin metadata in order to support recursive resolution. @rtyler has made a good start on a gem to provide this functionality: https://github.com/rtyler/jpm If folks are interested in seeing recursive dependency resolution in this module, the fastest route would be contribute to that gem. Another path would be to get similar functionality implemented in the core and/or to rework how the update center handles metadata.

@mativillagra
Copy link

Hi. Sorry if this is not the correct why to ask something on an opening thread. But this is my case, I want to download Jenkins plugins from a local GIT repository, were I used this plugin (rtyler/jenkins), so I upload all the needed plugins to a folder on the GIT repository. Then I try to install them,

create_resources(jenkins::plugin,hiera('jenkins-plugin')) on a puppet manifests,

On a hiera yaml file
jenkins-plugin:
build-env:
name: build-env-propagator
source: puppet:///modules/jenkins_instance/plugins_jenkins/build-env-propagator.hpi
envinject-dependencies:
name: envinject

But I get the error,

Executing 'curl -s -S -k -L -o /app/Jenkins_puppet//plugins/build-env-propagator.hpi 'puppet:///modules/jenkins_instance/plugins_jenkins/build-env-propagator.hpi''�[0m
[192.168.3.58] out: �[mNotice: /Stage[main]/Jenkins_instance/Jenkins::Plugin[build-env]/Archive::Download[build-env-propagator.hpi]/Exec[download archive build-env-propagator.hpi and check sum]/returns: curl: (6) Couldn't resolve host 'puppet:'�[0m

Anyway, any idea how I can download plugins from a local GIT repository ? Thanks in advanced.

@jhoblitt
Copy link
Member

@mativillagra jenkins::plugin::source needs to be a URL with a protocol type supported by puppet/archive. You could install the file on the jenkins master with a file resource and then pass that path to jenkins::plugin. See https://forge.puppet.com/puppet/archive#puppet-url

@mativillagra
Copy link

@jhoblitt Thanks for the feedback. Actually I end up with a custom fix, just created a temp folder inside $JENKINS_HOME/plugins/temp put all the needed plugins there and then just copy over $JENKINS_HOME/plugins/ with an exec (puppet).

Let me ask if the solution you proposed is not intend to collapse with manifests/plugin.pp line 91

You already have a file resource like this

file { "${::jenkins::plugin_dir}/${plugin}" : this end up being $JENKINS_HOME/plugins/
owner => $::jenkins::user,
group => $::jenkins::group,
mode => '0644',
before => Service['jenkins'],
}

It will be nice that jenkins::plugin::source include others ways other than URL type. Say for example or others way, not always machines have the possibility of internet connection.

name: build-env-propagator
source: puppet:///modules/jenkins_instance/plugins_jenkins/build-env-propagator.hpi

Thanks!!!

nuclearsandwich added a commit to nuclearsandwich/buildfarm_deployment that referenced this issue Mar 21, 2017
Because the Jenkins update center only provides dependency information
for the current version of plugins, the plugin puppet directive cannot
due dependency resolution. This means that my changes do nothing, it's
also why pipeline-step-api was listed already and still not installed
correctly.

For now we'll just need to update docs to let people know that this is
expected behavior.

There is a project that may someday be able to resolve this for us:
https://github.com/rtyler/jpm

The issue tracking the jenkins-puppet dependency problem is
voxpupuli/puppet-jenkins#677
@mmarseglia
Copy link

I was able to get rtyler/jpm working enough to download plugins with my install of CJE. I have a fork at https://github.com/mmarseglia/jpm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants