-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
40 lines (34 loc) · 919 Bytes
/
Jenkinsfile
File metadata and controls
40 lines (34 loc) · 919 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
pipeline {
agent any
stages {
stage('Checkout') {
steps {
git branch: 'main',
url: 'https://github.com/shahealamit/devops-ci-cd-demo'
}
}
stage('Build with Maven') {
steps {
sh 'mvn clean package'
}
}
stage('Deploy to Tomcat') {
steps {
echo "Stopping Tomcat..."
sh 'sudo systemctl stop tomcat || true'
echo "Copying WAR to Tomcat..."
sh 'sudo cp target/devops-web.war /opt/tomcat/tomcat/webapps/devops-web.war'
echo "Starting Tomcat..."
sh 'sudo systemctl start tomcat'
}
}
}
post {
success {
echo "Deployment Successful!"
}
failure {
echo "Deployment Failed!!"
}
}
}