-
Notifications
You must be signed in to change notification settings - Fork 2
/
Jenkinsfile
79 lines (78 loc) · 3.03 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 none
stages {
stage('Fill templates test') {
when { branch 'dev' }
agent { label 'Master' }
steps {
slackSend (message: "BUILD START: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' CHECK THE RESULT ON: https://cd.daf.teamdigitale.it/blue/organizations/jenkins/daf-srv-storage/activity")
sh 'ansible-playbook ansible/main.yml --extra-vars "@/ansible/settings.yml"'
}
}
stage('Fill templates prod') {
when { branch 'master' }
agent { label 'prod' }
steps {
slackSend (message: "BUILD START: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' CHECK THE RESULT ON: https://cd.daf.teamdigitale.it/blue/organizations/jenkins/daf-srv-storage/activity")
sh 'ansible-playbook ansible/main.yml --extra-vars "@/ansible/settings.yml"'
}
}
stage('Compile test') {
when { branch 'dev' }
agent { label 'Master' }
steps {
sh 'sbt clean compile'
}
}
stage('Compile prod') {
when { branch 'master'}
agent { label 'prod' }
steps {
sh 'sbt clean compile'
}
}
stage('Publish test') {
when { branch 'dev' }
agent { label 'Master' }
steps {
sh 'sbt docker:publish'
}
}
stage('Publish prod') {
when { branch 'master'}
agent { label 'prod' }
steps {
sh 'sbt docker:publish'
}
}
stage('Deploy test') {
when { branch 'dev' }
agent { label 'Master' }
environment {
DEPLOY_ENV = 'test'
KUBECONFIG = '/var/lib/jenkins/.kube/config.teamdigitale-staging'
}
steps {
sh 'cd kubernetes; sh deploy.sh'
slackSend (color: '#00FF00', message: "SUCCESSFUL: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}] deployed in '${env.DEPLOY_ENV}' https://cd.daf.teamdigitale.it/blue/organizations/jenkins/daf-srv-storage/activity")
}
}
stage('Deploy production') {
when { branch 'master' }
agent { label 'prod' }
environment {
DEPLOY_ENV = 'prod'
KUBECONFIG = '/home/centos/.kube/config.teamdigitale-production'
}
steps {
sh 'cd kubernetes; sh deploy.sh'
slackSend (color: '#00FF00', message: "SUCCESSFUL: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}] deployed in '${env.DEPLOY_ENV}' https://cd.daf.teamdigitale.it/blue/organizations/jenkins/daf-srv-storage/activity")
}
}
}
post {
failure {
slackSend (color: '#ff0000', message: "FAIL: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' https://cd.daf.teamdigitale.it/blue/organizations/jenkins/daf-srv-storage/activity")
}
}
}