Configuring Jenkins plugins with Puppet - jenkins

I'm using the rtyler/jenkins Puppet module to deploy my Jenkins instance. One thing I can't seem to find documentation on is how to use Puppet to configure the Jenkins plugins once I've installed them. Can someone point me to some documentation and/or write a quick example? Thanks.

the module he provides is only for managing/configuring jenkins and managing plugins. All plugins are vastly different, there is no possibility his scripts would be able to manage the wide breadth of jenkins plugins out there. You would want to try to capture that using jenkins backups or by looking into how each module allows configuration.

For anyone interested in how to pull this off, I'm using the Jenkins SCM plugin available here: https://wiki.jenkins-ci.org/display/JENKINS/SCM+Sync+configuration+plugin
This requires manually setting up Jenkins and having the plugin sync all the configuration settings to a repository. All future Jenkins instances provisioned by Puppet will need to have all the necessary plugins installed, but the SCM plugin will automatically download all the necessary settings. However, do note that some of the plugins will require you to manually add includes into the SCM to begin tracking them: https://wiki.jenkins-ci.org/display/JENKINS/SCM+Sync+Config+shared+additionnal+includes

Related

Is there some way to pull in Jenkins plugins from a shared pipeline library?

Jenkins publishes plugins which contains primarily, or only, additional pipeline steps.
For example, pipeline-utility-steps would be nice to have, because it has the tar task.
But getting additional plugins installed in the Jenkins instance comes with some difficulty - only one or two devs have access to do so, and they're reluctant to add more plugins, because more plugins installed means more work overall - they have to be tested for cross-compatibility, kept up to date, tracked for vulnerabilities, etc.
Jenkins lets us maintain our own shared pipeline libraries, which we are already using as a place to put all our own custom steps.
Is there some way we can make use of the shared pipeline library feature, to also gain access to existing Jenkins plugins without installing them in Jenkins?
For example, can we directly import a Jenkins plugin into a pipeline somehow to use its steps?
Or can we do something in our shared pipeline library to make it also pull in additional vars from some other Jenkins plugin?
Similar questions:
Is there a way to include a jar in a Jenkins Pipeline folder-level shared library? asks about one specific way this might be possible

How to use AWS Parameter Store Build Wrapper Jenkins plugin

I want to use the AWS Parameter Store Build Wrapper Jenkins plugin in my build.
https://plugins.jenkins.io/aws-parameter-store/
Above is the link to that plugin. The issue is I didn't find any proper source on how to use that plugin in the jenkinsfile.
When I installed that plugin to my local Jenkins, I couldn't see how to configure that plugin in any jenkins build configuration page as well.
If anyone can shed some light on this issue, that would be great.
My ultimate goal is to access some things from the AWS Parameter store. If there's any other way that I can achieve this, I'm more than happy to use that way instead of this plugin as well.

Can I store Jenkins configuration in the project repo (like Travis CI)?

How do you maintain the Jenkins job configuration in SCM along side the source code?
As source code evolves, so does the job configuration. It would be ideal to be able to keep the job configuration in SCM, for the following benefits:
easy to see who a history of the changes, including the author and the description
able to rebuild old branch/tag by checking out the revision and build just work
not having to scroll through the UI to find the appropriate section and make change
I see there is a Jenkins Job Builder plugin. I prefer a solution along the lines of Travis CI, where the job configuration is maintained in a YAML file (.travis.yml). Any good suggestions?
Note: Most of our projects are using Java & Maven.
Update 2016: Jenkins now provides a Jenkinsfile which provides exactly this. This is supported by the core Jenkins developers and actively developed.
Benefits:
Creating a Jenkinsfile, which is checked into source control, provides a number of immediate benefits:
Code review/iteration on the Pipeline
Audit trail for the Pipeline
Single source of truth for the Pipeline, which can be viewed and edited by multiple members of the project.
I've written a plugin that does this!
Other than my plugin, you have some (limited) options with existing Jenkins plugins:
Use a single test script
If you configure your Jenkins to simply run:
$ bash run_tests.sh
You can then check in a run_tests.sh file into your SCM repo and you're now tracking changes for how you run tests. However, this won't track configuration of any plugins.
Similarly, if you're using Maven, the Maven Project Plugin simply runs a specified goal for your repo.
The Literate Plugin does allow Jenkins to run the commands in your README.md, but it hasn't yet been released.
Track changes to Jenkins configuration
You can use the SCM Sync configuration plugin to write configuration changes to SCM, so you at least have a persistent record. This is global, across all projects on your Jenkins instance.
There's also the job config history plugin, which stores config history on the filesystem.
Write Jenkins configuration from SCM
The Jenkins job builder project you mentioned lets you check config changes into SCM and have them applied to your Jenkins instance. Again, this is across all projects on your Jenkins instance.
Write Jenkins configuration from another job
You can use the Job DSL Plugin with a repo of groovy scripts. Jenkins then polls that repo, executes the groovy scripts, which create job configurations.
Discussions
Issue 996 (now closed) discusses this, and it has also been discussed on the mailing list: 'Keeping track of Hudson's configuration changes', and 'save hudson config in svn'.
you can do this all with the workflow plugin and a lot more. Workflow is one of the most advanced technics to use jenkins and it has a very strong support.
It is based on a groovy DSL and allows you to keep the whole configuration in the SCM of your choise (e.g. GIT, SVN...).

Puppet Plugin for Jenkins

How to integrate Jenkins with Puppet?
As of now i am integrating Jenkins with Puppet. But We dont know which puppet plugin will support for jenkins. Can you please help on us.
It depends on what you want to achieve. If you simply want to deploy the manifests, there is no need for a puppet plugin. You could use the Publish over SSH plugin or something that let you push your code to the puppet master.
To actually execute puppet commands a generic job configuration would be fine.
If you are looking for a full chain of source control, tests and deployment for your manifests, you should take a look at Gerrit and how to integrate it with Jenkins using the Gerrit Trigger plugin

Retrieving old builds for re-deployment in Jenkins

I have built an automated deployment system using Jenkins, Subversion and ANT on a set of environments. It all works, allowing me to deploy old tagged releases to a set of environments or automatically deploy the latest build using the Subversion Release Manager within Jenkins.
The problem is on the client site, we have to utilise Perforce (which does not currently have a Release Manager plugin within Jenkins [don't really want to write one, but possible]). What is the best way to setup up Jenkins to be able to deploy certain releases to environments? I started looking at Ivy and Artifactory as a possibility.
If anyone has any suggestions, or any guides online, that would be great!
We currently build a WAR file for each Subversion checkin - and make this available with the copy artifact plugin. Redeploy is merely a matter of executing the deploy task for this WAR.

Resources