Skip to content

Latest commit

 

History

History
95 lines (72 loc) · 4.07 KB

File metadata and controls

95 lines (72 loc) · 4.07 KB

Tasks

Prerequisistes:

  • Install Docker
  • Install Maven
  • Create first jenkins jobs

image image move to build and select execute shell if you want to run linux command. image ** you can write command like ls,whoami etc**

save and apply image image image image

  • Create a war file using jenkins

  • Login to your jenkins Server then Select free style and click on Ok image Select Source Code Management image click on Git and provide repo url image image Now got to build step and select maven target image image Save and apply click on build now image in Workspce you can check your war file created image

  • Set up build trigger

Go to build trigger and select build periodically image Modify any schedule as per your need image This will trigger after every 15 mins image Same for SCM poll image

  • Test Environment variable for Jenkins

To access Jenkins Environemenr variable Please go to Build steps and select Execute shell image ** Click on See the list of available environment variables** image

Test any environment varaible image

  • Deploy war file to tomcat server
  • Add Jenikins user to sudo file using below options so that jenkins user can execute command with sudo
visudo

jenkins ALL=(ALL) NOPASSWD: ALL

Now check the commands below image

Dockerfile to deploy

FROM tomcat:8.0-alpine
LABEL maintainer=""

ADD studentapp-2.5-SNAPSHOT.war /usr/local/tomcat/webapps/

EXPOSE 8080
CMD ["catalina.sh", "run"]
  • Create a docker image and run that
docker build -t myapp .
docker run dit -p 80:8080 myapp
  • Make a test
ip address:port/warfile