-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
55 lines (55 loc) · 1.66 KB
/
Jenkinsfile
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
pipeline {
agent any
tools {
maven 'my_mvn'
}
stages {
stage("Checkout") {
steps {
git branch: 'main', url: 'https://github.com/nholuongut/manik-calculator.git'
}
}
stage('Maven Clean') {
steps {
sh "mvn clean"
}
}
stage('Maven Build') {
steps {
sh "mvn compile"
}
}
stage("Unit Test") {
steps {
sh "mvn test"
}
}
stage("SonarQube Analysis") {
steps {
withCredentials([usernamePassword(credentialsId: 'sonarqube', passwordVariable: 'password', usernameVariable: 'username')]) {
withSonarQubeEnv('sonarqube-server') {
sh "mvn verify sonar:sonar -Dsonar.host.url=http://34.239.105.136:9000 -Dsonar.login=${username} -Dsonar.password=${password}"
}
}
}
}
stage("Maven Package") {
steps {
sh "mvn package"
}
}
stage("Deploy On Server") {
steps {
deploy adapters: [tomcat9(credentialsId: 'tomcat-9', path: '', url: 'http://34.239.105.136:8090')], contextPath: '/manik-calculator', war: '**/target/*.war'
}
}
}
post {
always {
junit 'target/surefire-reports/*.xml'
}
success {
echo "App URL: http://34.239.105.136:8090/manik-calculator/"
}
}
}