-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathJenkinsfile
87 lines (70 loc) · 2.68 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
80
81
82
83
84
85
86
node{
checkout scm
def mvnHome
dir('BuildQuality'){
stage('Preparation'){
git 'https://github.com/devopsevd/simple-spring.git'
mvnHome = tool 'Maven'
}
stage('Build') {
// Run the maven build
if (isUnix()) {
sh "'${mvnHome}/bin/mvn' -Dmaven.test.failure.ignore clean package"
} else {
bat(/"${mvnHome}\bin\mvn" -Dmaven.test.failure.ignore clean package/)
}
}
stage('SonarQube Analysis') {
// def mvnHome
//mvnHome = tool 'Maven'
withSonarQubeEnv('Sonar') {
if (isUnix()) {
sh "'${mvnHome}/bin/mvn' org.sonarsource.scanner.maven:sonar-maven-plugin:3.3.0.603:sonar -f pom.xml "+
" -Dsonar.projectKey=org.sonarqube:java-sonar " +
" -Dsonar.projectKey=org.sonarqube:java-sonar " +
" -Dsonar.projectName='Java :: Simple Spring Project' " +
" -Dsonar.projectVersion=1.0 " +
" -Dsonar.language=java " +
" -Dsonar.sources=. " +
" -Dsonar.tests=. " +
" -Dsonar.test.inclusions='**/*Test*/**' " +
" -Dsonar.exclusions='**/*Test*/**' "
} else {
bat (/"${mvnHome}\bin\mvn" org.sonarsource.scanner.maven:sonar-maven-plugin:3.3.0.603:sonar -f pom.xml -Dsonar.projectKey=org.sonarqube:java-sonar -Dsonar.projectName="Java :: Simple Spring Project" /)
}
}
}
stage('Unit Test Results') {
junit '**/target/surefire-reports/TEST-*.xml'
//archive 'target/*.jar'
}
}
}
stage name:'Deploy to staging', concurrency:1
node {
//sh 'sudo docker run -d -p=3000:80 --network=bundlev2_prodnetwork nginx'
dir('BuildQuality'){
sh 'sudo docker-compose up -d --build'
}
}
node{
def mvnHome
dir('FunctionalTests'){
stage('Get Functional Test Scripts'){
git 'https://github.com/devopsevd/jenkins-selenium-int-testing.git'
mvnHome = tool 'Maven'
}
stage('Run Tests') {
sh "'${mvnHome}/bin/mvn' -Dgrid.server.url=http://seleniumhub:4444/wd/hub clean test "
}
stage('Functional Test Results') {
junit '**/target/surefire-reports/TEST-*.xml'
}
}
}
stage name:'Shutdown staging'
node {
dir('BuildQuality'){
sh 'sudo docker-compose stop'
}
}