-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
60 lines (57 loc) · 2.31 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
pipeline {
agent any
stages {
stage('Build images and push them to Dockerhub') {
steps {
sh '''#!/usr/bin/env bash
# Make Bash Great Again
set -o errexit # exit when a command fails.
set -o nounset # exit when using undeclared variables
set -o pipefail # catch non-zero exit code in pipes
# set -o xtrace # uncomment for bug hunting
docker build -t webarchiv/vyvoj:naki .
docker push webarchiv/vyvoj:naki
'''
}
}
stage('Deploy vyvoj to Test Environment: https://app.webarchiv.cz/vyvoj') {
when {
anyOf { branch 'main'; branch 'production'}
}
environment {
SSH_CREDS = credentials('ansible')
}
steps {
sh '''#!/usr/bin/env bash
# Make Bash Great Again
set -o errexit # exit when a command fails.
set -o nounset # exit when using undeclared variables
set -o pipefail # catch non-zero exit code in pipes
# set -o xtrace # uncomment for bug hunting
# Upcoming script is deployed via Seeder repository.
ssh -o "StrictHostKeyChecking=no" -i ${SSH_CREDS} ${SSH_CREDS_USR}@10.3.0.110 sudo /home/ansible/seeder/update_vyvoj.sh
'''
}
}
stage('Deploy vyvoj to Production Environment: https://webarchiv.cz/vyvoj') {
when {
anyOf { branch 'production'}
}
environment {
SSH_CREDS = credentials('ansible')
}
steps {
input "Přísáhám před krutým a přísným bohem, že https://app.webarchiv.cz/vyvoj je v perfektním stavu a stvrzuji, že může jít do produkce na https://webarchiv.cz/vyvoj."
sh '''#!/usr/bin/env bash
# Make Bash Great Again
set -o errexit # exit when a command fails.
set -o nounset # exit when using undeclared variables
set -o pipefail # catch non-zero exit code in pipes
# set -o xtrace # uncomment for bug hunting
# Upcoming script is deployed via Seeder repository.
ssh -o "StrictHostKeyChecking=no" -i ${SSH_CREDS} ${SSH_CREDS_USR}@10.3.0.50 sudo /home/ansible/seeder/update_vyvoj.sh
'''
}
}
}
}