Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Jenkinsfile_Shirisha #41

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions Jenkinsfile_Shirisha
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
node('nodes')
{
echo 'Jenkins Node Name:-'
echo "${env.NODE_NAME}"

properties([buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '2', daysToKeepStr: '', numToKeepStr: '2'))])

def MAVEN_HOME = tool name: "Maven - 3.9.1"

stage('get code from github')
{
git branch: 'dev', credentialsId: '47285e52-f8e7-47a4-9570-d36eef4acbee', url: 'https://github.com/ShirishaMitti/maven-web-application.git'
}

//${Environment_name} is choice parameter & ${Executed_by} is string parameter.
//echo "Gihub branch name is ${Environment_name}. Executing Build with parameters by Shirisha."
//echo ${Executed_by}

stage('Build')
{
sh "${MAVEN_HOME}/bin/mvn clean package"
}

stage('Deploying war to Tomcat server')
{
deploy adapters: [tomcat9(credentialsId: '68d86d50-002c-4342-827e-e473bd0a94c7', path: '', url: 'http://54.167.112.121:1332/')], contextPath: '/mavenSpringWeb_app', war: '**/maven-web-application.war'
}

stage('Send Email to user after application deployment')
{
emailext body: '''Hi Shirisha,

Congrats. Build $BUILD_NUMBER is $BUILD_STATUS. Please check below for more details.

$BUILD_URL

Thanks,
Jenkins''', subject: '$PROJECT_NAME ---> Build $BUILD_NUMBER is $BUILD_STATUS', to: '[email protected],[email protected]'
}

}