-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathJenkinsfile
73 lines (66 loc) · 2.14 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
@Library('jenkings') _
pipeline {
agent none
stages {
stage('Preparation & Build') {
agent {
label 'docker-qemu'
}
environment {
img = null
}
stages {
stage('Build Image') {
steps {
script {
img = docker.build('alkesst/pytelbot:armv7', '--pull -f Dockerfile-armv7 .')
}
}
}
stage('Push dev image') {
when { branch 'dev' }
steps {
script {
docker.withRegistry('https://registry.hub.docker.com', 'alkesst_dockerhub') {
img.push('armv7-dev')
}
}
}
}
stage('Push image') {
when { branch 'master' }
steps {
script {
docker.withRegistry('https://registry.hub.docker.com', 'alkesst_dockerhub') {
img.push('armv7')
}
}
}
}
}
}
stage('Deployment'){
agent {
node {
label 'majorcadevs'
}
}
when { branch 'master' }
steps {
sshagent(credentials : ['casita-rpi']) {
script {
sh 'ssh -o StrictHostKeyChecking=no -p 1223 -l pi casita.melchor9000.me "cd /home/pi/docker/pytelbot && docker-compose pull bot && docker-compose up -d bot"'
}
}
}
}
}
post {
success {
telegramSend 'Chavales, `s e l f` se ha actualizado\n\n@alkesst @melchor629', '-1001104881568'
}
failure {
telegramSend 'Oh no, [build log](' + env.BUILD_URL + ')... @alkesst @melchor629', '-1001104881568'
}
}
}