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

Pipeline2 #44

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
28 changes: 28 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
pipeline {
agent any
stages {
stage('checkout') {
steps {
sh 'rm -rf hello-world-war'
sh 'git clone https://github.com/Kavana147/hello-world-war.git'
}
}
stage('build') {
steps {
dir('hello-world-war') {
sh 'mvn package'
}
}
}
stage('deploy') {
steps {
sh 'sudo cp -r /var/lib/jenkins/workspace/Multipipeline_pipeline2/hello-world-war/target/hello-world-war-1.0.0.war /opt/apache-tomcat-9.0.64/webapps/'
sh 'sudo sh /opt/apache-tomcat-9.0.64/bin/shutdown.sh'
sh 'sudo sh /opt/apache-tomcat-9.0.64/bin/startup.sh'
sh 'echo "Successfully deployed"'
}

}
}

}
8 changes: 5 additions & 3 deletions src/main/webapp/index.jsp
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<html>
<head>
<title>Hello World!</title>
<title>Hello DevOps</title>
</head>
<body>
<h1>Hello World!</h1>
<h1>Hello DevOps!</h1>
<h2>We are learning Deployment on 7-july</h2>
<p>
It is now
<%= new java.util.Date() %></p>
<p>
You are coming from
<%= request.getRemoteAddr() %></p>
</body>
</body>