-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathJenkinsfile
More file actions
64 lines (56 loc) · 1.88 KB
/
Copy pathJenkinsfile
File metadata and controls
64 lines (56 loc) · 1.88 KB
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
// Define an empty map for storing remote SSH connection parameters
def remote = [:]
pipeline {
agent any
environment {
user = credentials('agroadvisory_user')
host = credentials('agroadvisory_host')
name = credentials('agroadvisory_name')
ssh_key = credentials('agroadvisory_key')
}
stages {
stage('Ssh to connect 192.168.199.121 server') {
steps {
script {
// Set up remote SSH connection parameters
remote.allowAnyHosts = true
remote.identityFile = ssh_key
remote.user = user
remote.name = name
remote.host = host
}
}
}
stage('Download latest release') {
steps {
script {
sshCommand remote: remote, command: """
cd /opt/nagroadvisory/front_back/
rm -fr front_backup_\$(date +"%Y%m%d")
mkdir front_backup_\$(date +"%Y%m%d")
cp -r /opt/nagroadvisory/front/* front_backup_\$(date +"%Y%m%d")
rm -fr releaseFront.zip
rm -rf build
curl -LOk https://github.com/CIAT-DAPA/fertilizer_frontend/releases/latest/download/releaseFront.zip
unzip releaseFront.zip -d build
rm -r releaseFront.zip
cp -r build/* /opt/nagroadvisory/front/
rm -rf build
"""
}
}
}
}
post {
failure {
script {
echo 'fail :c'
}
}
success {
script {
echo 'everything went very well!!'
}
}
}
}