forked from edgaregonzalez/nodejs-helloworld-api
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathJenkinsfile
More file actions
44 lines (44 loc) · 1008 Bytes
/
Jenkinsfile
File metadata and controls
44 lines (44 loc) · 1008 Bytes
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
pipeline {
agent any
tools {
nodejs 'nodejs21'
}
stages {
stage('Build') {
steps {
echo "Ejecutar npm install"
sh 'npm install'
}
}
stage('Test') {
steps {
echo "Ejecutar npm test push"
sh 'npm test'
}
post {
failure {
error("La prueba falló, no se ejecutará la aplicación.")
}
}
}
stage('Start') {
steps {
echo "Ejecutar npm start"
sh 'npm start > /dev/null 2>&1 &'
sh 'sleep 10'
}
}
stage('Request') {
steps {
echo "Ejecutar request"
sh 'curl http://localhost:3000'
}
}
}
post {
always {
echo "Parar la aplicación"
sh 'pkill -f "node"'
}
}
}