This repository has been archived by the owner on Apr 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
deploy.gradle
executable file
·113 lines (94 loc) · 2.76 KB
/
deploy.gradle
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
apply from: project.file("$projectRoot/locations.gradle")
if (project.core_version == "legacy") {
apply from: project.file("deploy_legacy.gradle")
} else {
deploy {
targets {
target('coprocessor') {
directory = '/home/vision/'
maxChannels = 1
timeout = 3
failOnMissing = true
locations {
ssh {
address = "CJVision.local"
user = 'vision'
password = 'CJfrc'
ipv6 = false
}
}
}
}
artifacts {
// Common properties
all {
targets << 'coprocessor'
dependsOn('build')
predeploy << {
if (project.hasProperty('purge')) {
execute('sudo rm -r *')
execute('echo 0000 | sudo tee /home/vision/team')
}
}
}
if (!project.hasProperty('purge')) {
// Deploy cj-vision src dir
fileTreeArtifact("cjVision_main") {
directory = "$device_cjVision_src/main"
files = fileTree(dir: "$cj_vision_dir/main")
}
// Deploy cj-vision src dir entry
fileTreeArtifact("cjVision_entry") {
directory = "$device_cjVision_src/entry"
files = fileTree(dir: "$cj_vision_dir/entry")
}
// Deploy cj-vision common dir
fileTreeArtifact("cjVision_common") {
directory = "$device_cjVision_common"
files = fileTree(dir: "$cj_vision_common_dir")
}
// Deploy User files
fileTreeArtifact("coproc_user_src") {
directory = "$device_coproc_src"
files = fileTree(dir: "$coproc_vision_main")
}
// Deploy User deploy
fileTreeArtifact("coproc_user_deploy") {
directory = "$device_coproc_deploy"
files = fileTree(dir: "$coproc_vision_deploy")
}
/**
* Makefile and resources (compiling and services)
*/
// Deploy resources (compiles and starts up service)
fileTreeArtifact("vision_resources") {
files = fileTree(dir: "$cj_vision_dir/resources")
postdeploy << {
execute('sudo ln -sf $(pwd)/system/vision.service /etc/systemd/system')
execute('sudo systemctl daemon-reload; sudo systemctl enable vision')
}
postdeploy << {
execute('sudo cp -n /etc/ssh/sshd_config /etc/ssh/sshd_config.old')
execute('sudo cp $(pwd)/system/sshd_config /etc/ssh/sshd_config')
}
}
fileArtifact("makefile") {
directory = "$device_cjVision_src"
file = file("$cj_vision_dir/Makefile")
predeploy << {
execute('sudo systemctl stop vision || true')
}
postdeploy << {
execute('make coproc=1 build/cjVision || false')
execute('chmod +x build/cjVision')
if (project.hasProperty('stop')) {
execute('sudo systemctl daemon-reload; sudo service vision stop; sudo service vision status')
} else {
execute('sudo systemctl daemon-reload; sudo service vision restart; sudo service vision status')
}
}
}
}
}
}
}