Racism is unacceptable and has no place in our bloggers community. #BlackLivesMatter #WhatMatters2020
Showing posts with label jenkins. Show all posts
Showing posts with label jenkins. Show all posts

11 February 2018

JENKINS: a Continuous Integration Tool

Getting started with Jenkins is 3 step process:

- Install Jenkins
- Download the required plugins
- Configure the plugins & create project

Installing Jenkins

$ wget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add -
$ sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
$ sudo apt-get update
$ sudo apt-get install jenkins
above steps will automatically start Jenkins

Starting Jenkins when configured as a service

$ sudo systemctl start jenkins
$ sudo systemctl status jenkin

Upgrade Jenkins

$ sudo apt-get update
$ sudo apt-get install jenkins

If your /etc/init.d/jenkins file fails to start jenkins then,
edit the /etc/default/jenkins to replace the HTTP_PORT=8080 to HTTP_PORT=8081
or
$ cd /var/share/jenkins/
$ java -jar jenkins.war (this will setup a new jenkins from begining)
I prefer to use as below, this will start old jenkins without any delay:
$ service jenkins restart

Running docker container of Jenkins

$ docker pull punitporwal07/jenkins
# docker run -d -p 8081:8080 -v jenkins-data:/software/jenkins punitporwal07/jenkins:tag
(to understand this command in brief check here Docker)

Useful Plugins

 you can push from manage plugins tab/ push from back-end into plugins dir
- Build pipeline: to chain multiple jobs
- Delivery pipeline: this will visualize deliver pipelines (upstream/downstream)
- Weblogic deployer: this is used to deploy a jar/war/ear to any weblogic target
- Deploy to container: to deploy war/ear to a tomcat/glassfish container
Roles strategy: this plugin allows you to assign roles to different user of jenkins

Automate deployment on Tomcat using Jenkins pipeline

(benefits.war as example on tomcat 8.x for Linux)
- install Deploy to container plugin, restart jenkins to reflect changes
- create new project/workspace & select post build action as: Deploy war/ear to a container
- add properties as below:-
   - war/ear files: **/*.war
   - context path: benefits.war (provided you need to push this war file into your workspace)
   - select container from drop-down list: tomcat 8.x
   - Add credentials: tomcat/tomcat (provided you have added this user in conf/tomcat-user.xml with all the required roles)
   - Tomcat URL: http://localhost:8080/
- apply/save you project and build it to validate the result.

Automate deployment on Weblogic using jenkins pipeline

 (benefits.war as example on Weblogic 10.3.6)
- install Weblogic deployer plugin, restart jenkins to reflect changes
- configure the plugin,
- create new project/workspace
- Add post build action as: Deploy the artifact to any weblogic environment (if no configuration has been set, the plugin will display an error message, else it will open up a new window)
- add properties as below:-
   - Task Name: give any task name
   - Environment: from drop down list select your AdminServer ( provided you have created configuration.xml and added it to Weblogic deployer Plugin)
   - Name: The name used by WebLogic server to display the deployed component
   - Base directory of deployment : give path to your deployment.war or push it to your workspace and leave it blank
   - Built resource to deploy: give your deployment.war name
   - Targets: give target name
- Apply/save you project and build it to validate the result.

k/r,
P