-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
79 lines (69 loc) · 1.91 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
pipeline {
agent any
// tools {
// maven 'maven-x'
// }
options {
buildDiscarder(logRotator(numToKeepStr: '2', artifactNumToKeepStr: '2',daysToKeepStr:'2',artifactDaysToKeepStr: '1'))
}
stages {
stage('Build') {
steps {
echo 'Demo Build Message'
sh "mvn clean install -DskipTests"
}
}
stage('Run Tests') {
steps {
echo 'Running Tests'
sh 'mvn test'
}
post{
success {
echo 'Success and archiving it'
archiveArtifacts artifacts: '**/target/*.jar'
echo 'versioning'
sh 'mkdir -p versions/ cp $(find ../ -name "**/target/*.jar") versions/credwiz-$BUILD_ID'
}
changed{
echo 'versioning'
sh 'mkdir -p versions/ cp $(find ../ -name "**/target/*.jar") versions/credwiz-$BUILD_ID'
}
}
}
stage('checkstyle analysis'){
steps{
sh 'mvn checkstyle:checkstyle'
}
}
// stage('Sonar Analysis'){
// environment{
// scannerhome = tool 'sonar'
// }
// steps{
// withSonarQubeEnv('sonar'){
// sh '''${scannerHome}/bin/sonar-scanner -Dsonar.projectKey=credwiz \
// -Dsonar.projectName=vprofile-repo \
// -Dsonar.projectVersion=1.0 \
// -Dsonar.sources=user-servicesrc/ \
// -Dsonar.java.binaries=target/test-classes/com/stackroute/userservice \
// -Dsonar.junit.reportsPath=target/jacoco.exec \
// -Dsonar.jacoco.reportspath=target/jacoco.exec \
// -Dsonar.java.checkstyle.reportPaths=target/checkstyle-result.xml
// '''
// }
// }
// }
stage('Deploy Staging') {
steps {
echo 'Deploy to staging environment'
input 'OK to deploy to product'
}
}
stage('Deploy Production') {
steps {
echo 'Deploy to Prod'
}
}
}
}