Comments (15)
For plugin list w/ version, from the unix command line:
curl -d @- http://jenkins301:8080/scriptText <<\EOF
script=def plugins=jenkins.model.Jenkins.instance.getPluginManager().getPlugins();plugins.each {println "${it.getShortName()} (${it.getVersion()})"}
EOF
from puppet-jenkins.
Groovy seems like a scary proposition, have you looked at the plugin manager API yet? See http://localhost:8080/pluginManager/api/
from puppet-jenkins.
Hadn't seen it yet. It doesn't seem to be able to show you the current list of plugins, at least not from:
http://HOSTNAME:8080/pluginManager/api/xml
It might have a different end point. Which wouldn't suck, btw.
The groovy code i posted is only ugly because I wanted the name & version number.. if you just want the name, it's not so bad....
However, better ways to do this are always good. All I need is commands that can be run from ruby (or shell) to include in the package provider type for puppet. I came up w/ it a few months ago, but haven't had time to do work on it really, due to - real work.
from puppet-jenkins.
I'm going to take this ticket over and look into prototyping something for the Duckworth release
from puppet-jenkins.
Please, do! My ruby has probably gotten to the point where I could do this.. but... my time isn't available. If i write code, i'm probably going to be writing monitoring code or such to integrate flapjack, sensu, mcollective and other things...
from puppet-jenkins.
@matthewbarr FYI, I've decided to move my work out of the puppet-jenkins
repository on this and to create a general purpose ruby gem which we can integrate: the Jenkins Plugin Manager
I've spoken with some of the Puppet folks, and unfortunately there's not a good way to include a gem inside of a Puppet module. I'm planning to submodule the gem into the repository and do something like this (FYI):
begin
require 'jpm/api'
raise StandardError if JPM::Version < '1.0'
rescue LoadError, StandardError => ex
# Can't load the gem from the file system, let's dig it out of the module package
require 'puppet/jenkins/gems/jpm/api'
end
This way if somebody has the gem installed, and of the appropriate version, we'll just use that, otherwise default to the one we have. "Why not always use the one in the module?" I would assume you're thinking. My belief is that by trying to install from the system, we can pick up non-API breaking changes/fixes without needing to always update a release of the Puppet module.
from puppet-jenkins.
@rtyler, I remember hearing discussion about using a custom puppet provider for this. Is that still part of the plan or no?
from puppet-jenkins.
@jchristi Most definitely! I've been making some progress with this but the past couple weekends I've not had the time. Fingers crossed for this weekend :)
from puppet-jenkins.
@jchristi is what you're using based on the jpm
work that I already did, or based off something else?
from puppet-jenkins.
@rtyler, oops, wrong issue.
from puppet-jenkins.
Also, good to hear about the custom provider approach (I probably could have inferred that had I read the title!)
from puppet-jenkins.
What's the status of this? Has it been abandoned in favor of another method or is resourcing the constraint?
from puppet-jenkins.
@lewisheadden As-is, it is better to manage plugins completely behind Jenkins' back due to internal API limitations (read: oh-the-horrors-I-have-seen). It appears that the chef community has come to the same conclusion.
from puppet-jenkins.
@matthewbarr / @rtyler What do you guys want to do with this issue? I spent several days banging my head against the wall trying to implement this by calling Jenkins' API. There's missing functionality, the update center is a bit wacky, and the async nature of plugin installation is a PITA to deal with. I may have code on a branch somewhere but my conclusion was that it was much was both easier and provided more functionality to manage plugins behind jenkins' back.
from puppet-jenkins.
I poked around the API and I found that this code works very well for us (but needs to be improved to check if/wait until Jenkins is running and lots of other stuff):
define my::jenkins_plugin ($ensure = 'present') {
if !($ensure in ['present', 'absent']) {
fail('jenkins_plugin ensure parameter must be absent or present')
}
include my::jenkins_tools
$jenkins_url = 'http://localhost:8080'
if ($ensure == 'present') {
exec { "Install Jenkins $title plugin":
command => "/usr/bin/curl -f ${jenkins_url}/pluginManager/install?plugin.${title}.default",
unless => "/usr/bin/curl -f ${jenkins_url}/updateCenter/plugin/${title}/api/xml?xpath=plugin/installed",
notify => Exec['Soft Restart Jenkins'],
require => Service['jenkins'],
}
} else {
exec { "Uninstall Jenkins $title plugin":
command => "/usr/bin/curl -XPOST -f ${jenkins_url}/pluginManager/plugin/${title}/doUninstall",
onlyif => "/usr/bin/curl -f ${jenkins_url}/updateCenter/plugin/${title}/api/xml?xpath=plugin/installed",
notify => Exec['Soft Restart Jenkins'],
require => Service['jenkins'],
}
}
}
class my::jenkins_tools {
exec { 'Soft Restart Jenkins':
command => '/usr/bin/curl -f http://localhost:8080/updateCenter/safeRestart',
refreshonly => true,
}
}
Let me know if you're interested, then I will expand on this POC.
from puppet-jenkins.
Related Issues (20)
- Plugin download / installation not idempotent HOT 1
- Add a way to set the open files limit in systemd service HOT 1
- Error HOT 1
- Error HOT 1
- Support: casc HOT 1
- Jenkins is no longer forking (--daemon has been removed) HOT 2
- Does no longer work with jenkins 2.332.1 or 2.335 onwards
- Support for Jenkins < 2.332 HOT 1
- Fact 'jenkins_plugins' can exceed value length limit: 4096 HOT 2
- Convert Terminology to match current Jenkins Terminology HOT 1
- Puppet removes plugin when plugin was installed using the Jenkins ui
- How to install jenkins on a mounted partition HOT 1
- Class jenkins::slave : Rights issues on the jenkins-slave file with systemd
- Non-atomic default plugins update can cause havoc.
- Removes quotes from $JAVA_ARGS, otherwise java fails to start
- Jenkins Redhat repo certificate has expired HOT 2
- undefined method strip HOT 8
- jenkins_plugins fact is locale-dependent which can cause a plugin installation loop HOT 2
- jenkins-cli.jar has been renamed in the jenkins rpm. HOT 6
- jenkins present.pp does not fix single-quotes for xml 1.1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from puppet-jenkins.