Jenkins: 11 - Automated Deployment in Jenkins(Tomcat sample.war)

Automated Deployment in Jenkins

 

put sample.war in project workspace

place sample.war in the build workspace

/opt/jenkins/workspace/AutomatedDeploymentTest/sample.war

 

General

Description

<h3>Deploy a war file to system</h3>

Use Custom Workspace

${JENKINS_HOME}/workspace/AutomatedDeploymentTest

Display Name

AutomatedDeploymentTest

 

Build

Command

pwd

 

Post Build

Deploy WAR/EAR file to container

**/*.war

Context path

sample.war

Containers

Tomcat 7.x

Credentials

deployer | deployer

Note: Tomcat user MUST have 'manager-script' role assigned in tomcat [ /opt/tomcat/conf/tomcat-users.xml ]

<user username="deployer" password="deployer" roles="manager-script"/>

Tomcat URL

http://192.168.0.103:8081

Build results

 

Console Output

Started by user JenkinsAdmin
Building in workspace /var/lib/jenkins/workspace/AutomatedDeploymentTest
[AutomatedDeploymentTest] $ /bin/sh -xe /tmp/jenkins2879921196486664738.sh
+ pwd
/var/lib/jenkins/workspace/AutomatedDeploymentTest
Deploying /var/lib/jenkins/workspace/AutomatedDeploymentTest/sample.war to container Tomcat 7.x Remote with context sample.war
  [/var/lib/jenkins/workspace/AutomatedDeploymentTest/sample.war] is not deployed. Doing a fresh deployment.
  Deploying [/var/lib/jenkins/workspace/AutomatedDeploymentTest/sample.war]
Finished: SUCCESS

 

 


Tomcat Host App Manager

 

http://192.168.0.103:8081/sample.war/

Sample "Hello, World" Application

This is the home page for a sample application used to illustrate the source directory organization of a web application utilizing the principles outlined in the Application Developer's Guide.

To prove that they work, you can execute either of the following links:

 

http://192.168.0.103:8081/sample.war/hello.jsp

Sample Application JSP Page

This is the output of a JSP page that is part of the Hello, World application.

 

http://192.168.0.103:8081/sample.war/hello

Sample Application Servlet

This is the output of a servlet that is part of the Hello, World application.

 


Add Credentials to Jenkins

  • Manage Jenkins > Credentials
    • Include
    • ?????

 

Configure Credentials > Add

  • Provider: User Credentials Provider
  • Type: Username & Password

 

Project > Tomcat Container

  • Add Credentials
    • Username & Password
      • Username: deployer
      • Password: deployer
      • Description Deployment User