-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
110 lines (62 loc) · 2.92 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
node {
stage('Descargar Fuentes') {
echo 'Descargando Fuentes ....'
dir('facturacion-web') {
git '/c/workspace/wsDevOpsFinal/curso-devops-agosto-master'
}
}
stage('Compilar') {
echo 'Compilando ....'
bat 'mvn -f facturacion-web/pom.xml clean compile'
}
stage('Pruebas Unitarias') {
echo 'Ejecutando Pruebas Unitarias ....'
bat 'mvn -f facturacion-web/pom.xml test'
junit '**/target/surefire-reports/*.xml'
}
stage('Pruebas de Integración') {
echo 'Ejecutando Pruebas de Integracion'
bat "mvn -f facturacion-web/pom.xml verify -DskipUTs=true"
step([$class: 'JUnitResultArchiver', testResults: '**/target/failsafe-reports/*.xml'])
}
stage('Análisis Estático con Sonar') {
withSonarQubeEnv('sonar-devops') {
bat 'mvn -f facturacion-web/pom.xml sonar:sonar -Dsonar.projectName=facturacion-web-$BUILD-NUMBER'
//bat 'mvn clean verify sonar:sonar -Dsonar.projectName=example-project -Dsonar.projectKey=example-project -Dsonar.projectVersion=$BUILD_NUMBER'
}
}
//QUALITY GATE
stage('Generar Build') {
echo 'Generando Build ...'
bat 'mvn -f facturacion-web/pom.xml package -DskipTests=true'
}
stage('Versionar') {
def server = Artifactory.server 'MiArtifactory'
def uploadSpec = """{
"files": [
{
"pattern": "target/*.jar",
"target": "facturacion-web/desarrollo/${BUILD_NUMBER}/",
"props": "pruebas-unitarias=si;pruebas-integracion=si;analisis-codigo-estatico=si"
}
]
}"""
server.upload(uploadSpec)
}
stage('Pruebas Funcionales') {
echo 'Ejecutando pruebas funcionales ...'
dir('facturacion-web-auto-ui') {
git '/c/workspace/wsDevOpsFinal/facturacion-web-automatizacion-ui'
bat 'mvn test'
//publicar reporte testNG
step([$class: 'Publisher'])
}
}
stage('Pruebas de Rendimiento') {
echo 'Ejecutando pruebas de rendimiento ...'
withEnv(['JMETER_HOME=C:\\herramientas\\apache-jmeter-4.0']) {
bat "C:\\herramientas\\apache-jmeter-4.0\\bin\\jmeter.bat -Jjmeter.save.saveservice.output_format=xml -n -t facturacion-web/src/main/resources/jmeter/plan-pruebas-facturacion-web.jmx -l facturacion-web/src/main/resources/jmeter/plan-pruebas-facturacion-web.jtl"
perfReport errorFailedThreshold: 0, errorUnstableThreshold: 0, percentiles: '0,50,90,100', relativeFailedThresholdNegative: 0.0, relativeFailedThresholdPositive: 0.0, relativeUnstableThresholdNegative: 0.0, relativeUnstableThresholdPositive: 0.0, sourceDataFiles: 'facturacion-web/src/main/resources/jmeter/plan-pruebas-facturacion-web.jtl'
}
}
}