-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
46 lines (46 loc) · 1.46 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
pipeline {
agent any
options {
skipStagesAfterUnstable()
}
stages {
stage('Build') {
steps {
sh 'pip3 install -r requirements.txt'
}
}
stage('Test'){
steps {
sh 'echo its pass the test stage'
}
}
stage('Deploy to Staging') {
steps {
sh 'ssh -o StrictHostKeyChecking=no [email protected] "source venv/bin/activate; \
cd polling; \
git pull origin master; \
pip install -r requirements.txt; --no-warn-script-location; \
python manage.py migrate; \
deactivate; \
sudo systemctl restart nginx; \
sudo systemctl restart gunicorn "'
}
}
stage('Deploy to Production') {
input{
message "shall we deploy to production?"
ok "yes pls"
}
steps {
sh 'ssh -o StrictHostKeyChecking=no [email protected] "source venv/bin/activate; \
cd polling; \
git pull origin master; \
pip install -r requirements.txt; --no-warn-script-location; \
python manage.py migrate; \
deactivate; \
sudo systemctl restart nginx; \
sudo systemctl restart gunicorn "'
}
}
}
}