Академический Документы
Профессиональный Документы
Культура Документы
4. Enable Git SCM to fetch source code from Github repository, I have taken java code which can
be built with Maven build tool and output artifact is war
5. Select credentials if github repo is protected/private
6. In Branch section mention the Parameter variable “Branch”
CI-CD Demo with Jenkins
12. If you want to deploy this WAR to a target server, the we have to install one plugin called
“Publish Over SSH”, this plugin allow us to send build artifacts to a remove server with ssh and
we can also execute commands on remote server
13. After installing plugin got to Global setting of Jenkins and Add a New SSH Server
14. Fill required values, Name, Hostname, user , Password or SSH key
15. I have used username and password
CI-CD Demo with Jenkins
16. Test Connection, it should return Success
17. Now come back to Jenkins Job, got to Post build Section
18. Select send build artifacts over SSH
19. Select Target Server
20. Select Source files, as our Source files is generated in Workspace/target folder
21. And war name is CounterWebApp.war
22. Now mention an intermediate folder on remote server, I have mentioned war , this folder will
be created in /root / of the target machine
23. Now mention commands to deploy war file
24. First I am removing old war and folder from webapps directory of tomcat
25. Now copy latest war from “war ” directory to webapps folder
26. If necessary tomcat restart can be issued
CI-CD Demo with Jenkins
27. As post build action , if build fails an email can be sent to stake holders, to use this SMTP
configuration should be valid in jenkins global configuration
35. Click on console output to see each step by step verbose log
CI-CD Demo with Jenkins
37. Build was successful, war was created using maven and deployed to target server
CI-CD Demo with Jenkins
40. Hit tomcat server IP(I have nginx as proxy to access tomcat on port 80) with WAR name as
context, i.e. CounterWebApp, Application will load
41. Pass a value in URL after context and it will show on the web page and counter will increase
CI-CD Demo with Jenkins
This whole project can aslo be created as Jenkins Pipeline JOB, with Groovy Script