CICD Pipeline Java
CICD Pipeline Java
NOTE: MAKE SURE YOU ARE HAVING PASSWORDLESS LOGIN FROM JENKINS TO ALL APPLICATION
SERVERS
wget -O /etc/yum.repos.d/jenkins.repo
https://pkg.jenkins.io/redhat/jenkins.repo
rpm --import https://pkg.jenkins.io/redhat/jenkins.io.key
yum install jenkins -y
Make the jenkins to be running as root user like below.
[root@jenkins apache]# grep -v "^#" /etc/sysconfig/jenkins|grep -i user
JENKINS_USER="root"
chown -R root:root /var/lib/jenkins/ /var/cache/jenkins /var/log/jenkins
systemctl restart jenkins
systemctl enable jenkins
Once done with the above installation we are going to configure the build job as
part of the jenkins using our maven !!!
NOTE:
First hit the url "http://www-eu.apache.org/dist/tomcat/tomcat-8/" get the version
and change the variable
"Version" to the latest version number in the below execution.
Installation::
cd /root/tomcat8/webapps/manager/META-INF
Keep the context.xml file with below data ( Insimple please remove the
"value" part)
http://www.apache.org/licenses/LICENSE-2.0
[root@jenkins META-INF]#
Hint:: use: :%s/\t//g for replacing wide tab spaces !!
Configuring user :
cd /root/tomcat8/conf
vim tomcat-users.xml
add the below content.
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<user username="dvsdevops" password="dvsdevops" roles="manager-
gui,manager-script"/>
/root/tomcat8/bin/shutdown.sh
/root/tomcat8/bin/startup.sh
Now try to access the site using your user "dvsdevops" & password
"dvsdevops"
wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-
maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo
mvn --version
Note:
Enable the webhooks for Push & Pullrequest triggers
Add build step --> Invoke top-level Maven Targets --> type "clean package"
under goals --> Build --> Execute shell -->mkdir -p /root/myweb/; /bin/cp
/var/lib/jenkins/workspace/myweb-ci/target/myweb-0.*.war /root/myweb/ -f
--> save
Note: Make sure that you are clicking on githubwebhook poll scm option.
Note: When you are executing the above just change the hosts names as part of your
hosts file & change the
deployment code (myweb.yml) file accordingly !!