2
2
3
3
# deploy artifacts to a directory, in preparation for GitHub deployment
4
4
5
- # Default to success
5
+ # Initialize globals used to track failures.
6
6
exit_status=0
7
+ declare -a failures # Array
7
8
8
9
ROOT=$( dirname $( dirname $( realpath ${BASH_SOURCE[0]} ) ) )
9
10
@@ -14,58 +15,75 @@ function deploy_log() {
14
15
echo " [DEPLOY] $( date) $* "
15
16
}
16
17
18
+ # Put "FAIL" between [DEPLOY] and date to make it easier to grep for failures (ie.., "\[DEPLOY\] FAIL" RE does the trick)
19
+ # Don't put "FAIL" in [DEPLOY] so that we can first grep for [DEPLOY] and see all messages from this deploy.sh script.
20
+ # Record failures but don't exit so that we can see which artifacts pass & fail.
21
+ function deploy_fail() {
22
+ echo " [DEPLOY] FAIL $( date) $* "
23
+ failures+=(" $* " ) # Append to array
24
+ exit_status=1
25
+ }
26
+
17
27
function deploy_mkdir() {
18
28
[[ $# -ne 1 ]] && {
19
- deploy_log " deploy_mkdir(): Passed $# args but it needs 1"
29
+ deploy_fail " deploy_mkdir(): Passed $# args but it needs 1"
30
+
31
+ # Exit if args are wrong.
20
32
exit 1
21
33
}
22
34
23
35
local dst_dir=" $1 "
24
36
mkdir -p $dst_dir || {
25
- deploy_log " mkdir -p $dst_dir failed"
26
- exit_status=1
37
+ deploy_fail " mkdir -p $dst_dir failed"
27
38
}
28
39
}
29
40
30
41
function deploy_do() {
31
- deploy_log " $@ "
42
+ deploy_log
43
+ deploy_log ' vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv'
44
+ deploy_log " ./do $* "
45
+ deploy_log ' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'
46
+ deploy_log
32
47
./do " $@ " || {
33
- deploy_log " ./do $* failed"
34
- exit_status=1
48
+ deploy_fail " ./do $* "
35
49
}
36
50
}
37
51
38
52
function deploy_cp_recursive() {
39
53
[[ $# -ne 2 ]] && {
40
- deploy_log " deploy_cp_recursive(): Passed $# args but it needs 2"
54
+ deploy_fail " deploy_cp_recursive(): Passed $# args but it needs 2"
55
+
56
+ # Exit if args are wrong.
41
57
exit 1
42
58
}
43
59
44
60
local src_dir=" $1 "
45
61
local dst_dir=" $2 "
46
62
47
63
cp -R ${src_dir} ${dst_dir} || {
48
- deploy_log " cp -R ${src_dir} ${dst_dir} failed"
49
- exit_status=1
64
+ deploy_fail " cp -R ${src_dir} ${dst_dir} failed"
50
65
}
51
66
}
52
67
53
68
function deploy_cp() {
54
69
[[ $# -ne 2 ]] && {
55
- deploy_log " deploy_cp(): Passed $# args but it needs 2"
70
+ deploy_fail " deploy_cp(): Passed $# args but it needs 2"
71
+
72
+ # Exit if args are wrong.
56
73
exit 1
57
74
}
58
75
59
76
local src_file=" $1 "
60
77
local dst_dir=" $2 "
61
78
62
79
cp ${src_file} ${dst_dir} || {
63
- deploy_log " cp ${src_file} ${dst_dir} failed"
64
- exit_status=1
80
+ deploy_fail " cp ${src_file} ${dst_dir} failed"
65
81
}
66
82
}
67
83
68
- deploy_log " Starting"
84
+ deploy_log ' ***************************************************************'
85
+ deploy_log ' * DEPLOY STARTING *'
86
+ deploy_log ' ***************************************************************'
69
87
70
88
deploy_mkdir $DEPLOY_DIR
71
89
deploy_mkdir $DEPLOY_DIR /example_cfg
@@ -174,17 +192,17 @@ cat <<- EOF > $DEPLOY_DIR/index.html
174
192
<li><a href="$PAGES_URL /isa_explorer/browser/ext_table.html">Extensions</a></li>
175
193
<li><a href="$PAGES_URL /isa_explorer/browser/inst_table.html">Instructions</a></li>
176
194
<li><a href="$PAGES_URL /isa_explorer/browser/csr_table.html">CSRs</a></li>
177
- <li><a href="$PAGES_URL /isa_explorer.xlsx">Excel version (includes Extensions, Instructions, CSRs)</a></li>
195
+ <li><a href="$PAGES_URL /isa_explorer/spreadsheet/isa_explorer .xlsx">Excel version (includes Extensions, Instructions, CSRs)</a></li>
178
196
</ul>
179
197
180
198
<br/>
181
199
<h3>Profile Releases</h3>
182
200
<ul>
183
- <li><a href="$PAGES_URL /pdfs/RVI20 .pdf">RVI20 Profile Release</a></li>
184
- <li><a href="$PAGES_URL /pdfs/RVA20 .pdf">RVA20 Profile Release</a></li>
185
- <li><a href="$PAGES_URL /pdfs/RVA22 .pdf">RVA22 Profile Release</a></li>
186
- <li><a href="$PAGES_URL /pdfs/RVA23 .pdf">RVA23 Profile Release</a></li>
187
- <li><a href="$PAGES_URL /pdfs/RVB23 .pdf">RVB23 Profile Release</a></li>
201
+ <li><a href="$PAGES_URL /pdfs/RVI20ProfileRelease .pdf">RVI20 Profile Release</a></li>
202
+ <li><a href="$PAGES_URL /pdfs/RVA20ProfileRelease .pdf">RVA20 Profile Release</a></li>
203
+ <li><a href="$PAGES_URL /pdfs/RVA22ProfileRelease .pdf">RVA22 Profile Release</a></li>
204
+ <li><a href="$PAGES_URL /pdfs/RVA23ProfileRelease .pdf">RVA23 Profile Release</a></li>
205
+ <li><a href="$PAGES_URL /pdfs/RVB23ProfileRelease .pdf">RVB23 Profile Release</a></li>
188
206
</ul>
189
207
190
208
<br/>
@@ -223,6 +241,26 @@ cat <<- EOF > $DEPLOY_DIR/index.html
223
241
</html>
224
242
EOF
225
243
226
- deploy_log " Complete"
244
+ [[ $exit_status -eq 1 ]] && {
245
+ deploy_log
246
+ deploy_log ' ***************************************************************'
247
+ deploy_log ' * DEPLOY FAILED *'
248
+ deploy_log ' ***************************************************************'
249
+ deploy_log
250
+ deploy_log " LIST OF FAILURES:"
251
+
252
+ # Iterate through each failure array element.
253
+ for f in " ${failures[@]} " ; do
254
+ deploy_log " $f "
255
+ done
256
+ }
257
+
258
+ deploy_log
259
+ deploy_log " Overall exit status is $exit_status "
260
+ deploy_log
261
+
262
+ deploy_log ' ***************************************************************'
263
+ deploy_log ' * DEPLOY COMPLETE *'
264
+ deploy_log ' ***************************************************************'
227
265
228
266
exit $exit_status
0 commit comments