-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
74 lines (71 loc) · 2.69 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
pipeline {
agent any
stages {
stage('Instalamos dependencias') {
steps {
slackSend (channel: '#ci-front', color: '#1126c2', message: "Empezamos tarea: '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})")
sh '''
echo "Instalamos dependencias"
npm i
'''
}
post {
success {
slackSend (channel: '#ci-front', color: '#3ab811', message: "Dependencias instaladas: Success '${env.JOB_NAME} [${env.BUILD_NUMBER}]'")
}
failure {
slackSend (channel: '#ci-front', color: '#fc3903', message: "Dependencias instaladas: Failure '${env.JOB_NAME} [${env.BUILD_NUMBER}]'")
slackSend (channel: '#ci-front', color: '#fc3903', message: "Tarea acabada: HA HABIDO UN ERROR'${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})")
}
}
}
stage('Compilamos') {
steps {
sh '''
echo "Compilamos "
npm run build
'''
}
post {
success {
slackSend (channel: '#ci-front', color: '#3ab811', message: "Compile: Success '${env.JOB_NAME} [${env.BUILD_NUMBER}]'")
}
failure {
slackSend (channel: '#ci-front', color: '#fc3903', message: "Compile: Failure '${env.JOB_NAME} [${env.BUILD_NUMBER}]'")
slackSend (channel: '#ci-front', color: '#fc3903', message: "Tarea acabada: HA HABIDO UN ERROR '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})")
}
}
}
stage('Notificamos end of desarrollo pipe') {
when{
branch 'desarrollo'
}
steps {
slackSend (channel: '#ci-front', color: '#1126c2', message: "Job dev: TERMINADO OK '${env.JOB_NAME} [${env.BUILD_NUMBER}]'")
}
}
stage('Desplegamos apache') {
when{
branch 'Produccion'
}
steps{
sh '''
ls -la /var/www/tresee/
rm -rf /var/www/tresee/*
mv dist/spa/* /var/www/tresee/
ls -la /var/www/tresee/
'''
}
post {
success {
slackSend (channel: '#ci-front', color: '#3ab811', message: "Deploy: Success '${env.JOB_NAME} [${env.BUILD_NUMBER}]'")
slackSend (channel: '#ci-front', color: '#1126c2', message: "Tarea acabada: OK '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})")
}
failure {
slackSend (channel: '#ci-front', color: '#fc3903', message: "Deploy: Failure '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})")
slackSend (channel: '#ci-front', color: '#fc3903', message: "Tarea acabada: BAD_STATUS '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})")
}
}
}
}
}