forked from SUSE/rmt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
23 lines (21 loc) · 1.63 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
node('scc-jenkins-node-chucker') {
stage('checkout') {
git url: 'https://github.com/suse/rmt.git', branch: 'master'
}
stage('build and push the image') {
sh 'docker build -t registry.scc.suse.de/rmt:latest .'
sh 'docker push registry.scc.suse.de/rmt:latest'
}
stage('staging deploy') {
sh 'ssh [email protected] -t "docker pull registry.scc.suse.de/rmt:latest"'
try {
sh 'ssh [email protected] -t "docker stop rmt_production && docker rm rmt_production || true"'
sh 'ssh [email protected] -t "docker stop rmt_cron && docker rm rmt_cron || true"'
}
finally {
sh 'ssh [email protected] -t "docker run --restart=always -d --name rmt_production --network=rmt_network -e SECRET_KEY_BASE=\\$SECRET_KEY_BASE -e RMT_ORGANIZATION_USERNAME=\\$RMT_ORGANIZATION_USERNAME -e RMT_ORGANIZATION_PASSWORD=\\$RMT_ORGANIZATION_PASSWORD -v /media/rmt-data/:/srv/www/rmt/public/ -v /var/run/mysql/mysql.sock:/var/run/mysql/mysql.sock registry.scc.suse.de/rmt"'
sh 'ssh [email protected] -t "docker exec rmt_production bundle exec rails db:migrate"'
sh 'ssh [email protected] -t "docker run --restart=always -d --name rmt_cron --network=rmt_network -e SECRET_KEY_BASE=\\$SECRET_KEY_BASE -e RMT_ORGANIZATION_USERNAME=\\$RMT_ORGANIZATION_USERNAME -e RMT_ORGANIZATION_PASSWORD=\\$RMT_ORGANIZATION_PASSWORD -v /media/rmt-data/:/srv/www/rmt/public/ -v /var/www/rmt/shared/config/crontab:/etc/config/crontab -v /var/run/mysql/mysql.sock:/var/run/mysql/mysql.sock registry.scc.suse.de/rmt cron -n /etc/config/crontab"'
}
}
}