-
Notifications
You must be signed in to change notification settings - Fork 235
Expand file tree
/
Copy pathjenkinsfile-cicd
More file actions
56 lines (55 loc) · 1.76 KB
/
jenkinsfile-cicd
File metadata and controls
56 lines (55 loc) · 1.76 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
pipeline{
agent any
tools{
maven 'maven-3.9'
}
stages{
stage('checkout the code'){
steps{
git url:'https://github.com/bcreddydevops/chinna-app.git', branch: 'main'
}
}
stage('build the code'){
steps{
sh 'mvn clean package'
}
}
stage('Generate sonarqube-analysis'){
steps{
withSonarQubeEnv(installationName: 'sonarqube-8', credentialsId: 'jenkins-sonar-token') {
sh 'mvn sonar:sonar'
}
}
}
stage('Upload War file to Nexus'){
steps{
nexusArtifactUploader artifacts: [
[
artifactId: 'devops',
classifier: '',
file: 'target/hiring.war',
type: 'war'
]
],
credentialsId: 'nexus-credentials',
groupId: 'in.javahome',
nexusUrl: '52.90.34.45:8081',
nexusVersion: 'nexus3',
protocol: 'http',
repository: 'spring-initial',
version: '0.0.1'
}
}
stage('Deploy War file to Tommcat'){
steps{
sshagent(['tomcat-credentials']) {
sh """
scp -o StrictHostKeyChecking=no target/*.war ubuntu@54.173.252.57:/opt/apache-tomcat-9.0.72/webapps
ssh -o StrictHostKeyChecking=no ubuntu@54.173.252.57 /opt/apache-tomcat-9.0.72/bin/shutdown.sh
ssh -o StrictHostKeyChecking=no ubuntu@54.173.252.57 /opt/apache-tomcat-9.0.72/bin/startup.sh
"""
}
}
}
}
}