Steps to build and deploy a war file to tomcat server using Jenkins Pipeline as Code - cloudeguru/Jenkins GitHub Wiki

## Architecture:

Below are the steps to deploy a war file to tomcat using Jenkins Pipeline as Code.

  1. Make sure that your Jenkins and Tomcat servers are running.

  2. Login to the Jenkins instance. Go to Manage Jenkins. Go to Plugins and in Available plugins search for SSH Agent and install it. This plugin is required for SSH into tomcat server.

  1. Also install another plugin Pipeline groovy lib. This is required for Pipeline
  1. # Set Up Webhook in GitHub:

Go to your GitHub repository. Navigate to "Settings" -> "Webhooks". Click on "Add webhook". In the "Payload URL" field, enter the URL of your Jenkins server followed by /github-webhook/ (e.g., http://your-jenkins-server/github-webhook/). Don't forget the / at the end of this jenkins url Choose the content type as application/json. Select the events you want Jenkins to trigger builds for (e.g., "Pushes" or "Pull requests"). Click "Add webhook" to save.

## Settings:

## Webhooks:

## Add Webhook

## Add Jenkins URL and Choose Content Type as Application/Json

## Choose an event for which a webhook trigger is required

## Now verify if webhook is working fine:

Click on your added webhook

If there is green tick on recent deliveries tab the connection is sucessful

  1. In Jenkins server choose GitHub hook trigger for GITScm polling option.
  1. Add the Jenkinsfile to root of the project directory in Github.