Chef deployment using Declarative Pipeline - jenkins

I would like to create a declarative Jenkins pipeline setup for the continues integration and Deployment, My only confusion was how Jenkins and chef are going to communicate in this process, after the continue integration, I want the chef to take over and install the Jar or Zip packages and deploy them on the several nodes from Jfrog Repo. Here maven is my build tool. In Jenkins pipeline I can setup until the build is done , is there any thing that I can do in the Post section of the pipeline for the chef communication for deployment or it has to be done. Please share some suggestion.

You can achieve this by putting workstation in one of the jenkins node.
Check out the below image for the same, instead of Ansible use Chef. I suppose this might work, haven't use chef recently.
Link: https://thenucleargeeks.com/2020/06/07/jenkins-openshift-pipeline/

Related

Jenkins job - no options found under pipeline section

I have started learning Jenkins recently.
I installed docker on a server which I created on AWS server and using docker I have installed Jenkins.
I wanted to test a Hello pipeline stage by creating new item, but when I go to the pipeline tab I cant see any options like pipeline script or pipeline script from SCM . I have installed git plugin and pipeline plugin also seems to be installed successfully. I am not able to continue my study further. I will be really thankful if someone can help me here.
In reality the pipeline plugin is not just one plugin but a bunch of 6 to 8 plugins. So you may want to install all the pipeline related items in your available plugins section of Manage Jenkins. Once this is done, a reboot of Jenkins is required for the changes to take effect. Here are some of them:
https://plugins.jenkins.io/build-pipeline-plugin/
https://www.jenkins.io/doc/pipeline/steps/pipeline-build-step/
https://plugins.jenkins.io/pipeline-stage-view/

Continuous Deployment using Jenkins and Docker

We are building a java based high-availability service for a financial application. I am part of the team for managing continuous integration using Jenkins.
Lately we introduced continuous deployment too in the list and we opted for Docker containers.
Here is the the infrastructure:
The production cluster will have 3 RHEL machines running the following docker containers on each of them:
3 instances of Wildfly
Cassandra
Nginx
Application IDE is Netbeans and source code is in git.
Currently we are doing manual deployment on this infrastructure.
Please suggest me some tools which I use with Jenkins to complete the continuous deployment process.
You might want jenkins to trigger on each push to your jenkins repository. There are plugins that help you do that with a webhook.Gitlab-plugin is a solution similar solution exist for Github and other git solutions.
Instead of heavily relying on bash and jenkins configuration you might want to setup a jenkins pipeline with the jenkins pipeline plugin or even pipeline: multibranch plugin. With those you can automate your build in groovy code (jenkinsfile) in a repository with the possibility to add functunality with other plugins building on them.
You can then use the docker pipeline plugin to easily build docker containers, push docker images and run code inside docker containers.
I would suggest building your services inside docker so that your jenkins machine does not have all the different dependencies installed (and therefore maybe conflicting versions). Use docker containers with all the dependencies and run your build code in there with the docker pipeline plugin from groovy.
Install a registry solution to push and pull your docker images to.
Use the Pipeline: Shared Groovy Libraries to extract libraries from your jenkinsfiles so that they can be reused. Those library files should have their own repository which your jenkins knows about and keeps up to date. Possibly you can even have an entire pipeline process shared between multiple projects which simply add parameters in their jenkinsfile.
A lot of text and no examples. If you think something is interesting and you want to see some code just ask. I am currently setting all this up.

Jenkins Puppet integration

My development setup is such that for every svn checkin code is built,unit tested, packaged and published in Artifactory. Now I want to automate my deployment process & run integration(Selenium) test as part of this process. I am thinking of using Puppet to managed the deployment
Is puppet the correct tool for this
What is the process I should use to trigger puppet master to initiate a fresh installation on agents, I couldn't find any Jenkins plugin that would actually trigger puppet. One option is to call
puppet apply ...
as a Jenkins post build task
Any suggestions welcome, thank you.
Have a look at this Selenium Jenkins article from Saucelabs, a service that automates cross-browser testing. Though they are a vendor with a service to sell, the article covers how to do Selenium testing yourself with Jenkins. It also exposes common pain points you are likely to run into with this approach.
A Puppet master doesn't serve the function of orchestrating client convergences. Take a look at Mcollective. This is a tool that will allow you to trigger puppet runs on target systems from a Jenkins agent via script commands.
Some Mcollective getting started material:
http://www.slideshare.net/PuppetLabs/presentation-16281121
http://puppetlabs.com/mcollective

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

Best way to use Jenkins to install snapshot on remote machine?

I'm running Jenkins on one server and want to use chef and automatically install a snapshot (including runtime artifacts etc) on a separate server.
Currently Jenkins will use ssh to invoke chef on the seperate machine. Is there a better way?
Maven is also involved in this.
I've found that majority of "Deploy" type plugins are lacking in customization. We use "Execute" (bash or batch) build steps to trigger deployment scripts on remote machines (written in house, be they Puppet, Chef, or plain bash/batch).
The correlation between builds and deployments is achieved through "Promotions" and explained in detail here:
How to promote a specific build number from another job in Jenkins?

Resources