Skip to content

Commit b385ac4

Browse files
committed
nightly-tarball scripts: more debugging and robustness
Check the exit status of major commands, as well as (optionally) output the pwd and command being executed (when debugging). Also, read the $debug variable from the environment; if it's set, go into debugging mode (vs. requiring a modification to the script to enable debugging mode). Signed-off-by: Jeff Squyres <[email protected]>
1 parent 0178307 commit b385ac4

File tree

3 files changed

+105
-36
lines changed

3 files changed

+105
-36
lines changed

contrib/build-server/hwloc-nightly-tarball.sh

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ script_uri=contrib/nightly/make_snapshot_tarball
2626
# helper scripts dir
2727
script_dir=$HOME/ompi/contrib/build-server
2828

29+
# Set this to any value for additional output; typically only when
30+
# debugging
31+
: ${debug:=}
32+
2933
# The tarballs to make
3034
if [ $# -eq 0 ] ; then
3135
# Branches v1.6 and earlier were not updated to build nightly
@@ -50,6 +54,26 @@ export LD_LIBRARY_PATH=$HOME_PREFIX/lib:$LD_LIBRARY_PATH
5054
#
5155
#####
5256

57+
debug() {
58+
if test -n "$debug"; then
59+
echo "=== DEBUG: $*"
60+
fi
61+
}
62+
63+
run_command() {
64+
debug "Running command: $*"
65+
debug "Running in pwd: `pwd`"
66+
if test -n "$debug"; then
67+
eval $*
68+
else
69+
eval $* > /dev/null 2>&1
70+
fi
71+
72+
if test $? -ne 0; then
73+
echo "=== Command failed: $*"
74+
fi
75+
}
76+
5377
# load the modules configuration
5478
. $MODULE_INIT
5579
module use $AUTOTOOL_MODULE
@@ -75,7 +99,7 @@ for branch in $branches; do
7599
script=$branch-`basename $script_uri`
76100

77101
echo "=== Getting script from: $raw_uri"
78-
wget --quiet --no-check-certificate --tries=10 $raw_uri/$branch/$script_uri -O $script
102+
run_command wget --quiet --no-check-certificate --tries=10 $raw_uri/$branch/$script_uri -O $script
79103
if test ! $? -eq 0 ; then
80104
echo "wget of hwloc nightly tarball create script failed."
81105
if test -f $script ; then
@@ -88,16 +112,15 @@ for branch in $branches; do
88112
chmod +x $script
89113

90114
module load "autotools/hwloc-$branch"
91-
# module load "tex-live/hwloc-$branch"
115+
# module load "tex-live/hwloc-$branch"
92116

93-
echo "=== Running script..."
94-
./$script \
117+
echo "=== Running script..."
118+
run_command ./$script \
95119
$build_root/$branch \
96120
$results_addr \
97121
$outputroot/$branch \
98122
$code_uri \
99-
$branch \
100-
>/dev/null 2>&1
123+
$branch
101124

102125
module unload autotools
103126
echo "=== Done running script"
@@ -123,21 +146,21 @@ for branch in $branches; do
123146
fi
124147
echo "=== Posting tarball to open-mpi.org"
125148
# tell the web server to cleanup old nightly tarballs
126-
ssh -p 2222 \
149+
run_command ssh -p 2222 \
127150
$output_ssh_target \
128151
"git/ompi/contrib/build-server/remove-old.pl 7 public_html/software/hwloc/nightly/$branch"
129152
# upload the new ones
130-
scp -P 2222 \
153+
run_command scp -P 2222 \
131154
$outputroot/$branch/hwloc-$latest_snapshot.tar.* \
132155
$output_ssh_target:public_html/software/hwloc/nightly/$branch/
133-
scp -P 2222 \
156+
run_command scp -P 2222 \
134157
$outputroot/$branch/latest_snapshot.txt \
135158
$output_ssh_target:public_html/software/hwloc/nightly/$branch/
136159
# direct the web server to regenerate the checksums
137-
ssh -p 2222 \
160+
run_command ssh -p 2222 \
138161
$output_ssh_target \
139162
"cd public_html/software/hwloc/nightly/$branch && md5sum hwloc* > md5sums.txt"
140-
ssh -p 2222 \
163+
run_command ssh -p 2222 \
141164
$output_ssh_target \
142165
"cd public_html/software/hwloc/nightly/$branch && sha1sum hwloc* > sha1sums.txt"
143166
fi
@@ -146,14 +169,14 @@ for branch in $branches; do
146169
# in here and clean up the old failed builds, we can accumulate
147170
# many over time. So remove any old failed builds that are over
148171
# 4 weeks old.
149-
${script_dir}/remove-old.pl 7 $build_root/$branch
172+
run_command ${script_dir}/remove-old.pl 7 $build_root/$branch
150173

151174
done
152175

153176
# If we had any new snapshots to send to coverity, process them now
154177

155178
for tarball in `cat $pending_coverity`; do
156-
${script_dir}/hwloc-nightly-coverity.pl \
179+
run_command ${script_dir}/hwloc-nightly-coverity.pl \
157180
--filename=$tarball \
158181
--coverity-token=$coverity_token \
159182
--verbose \

contrib/build-server/openmpi-nightly-tarball.sh

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
1111
1212

13+
# Set this to any value for additional output; typically only when
14+
# debugging
15+
: ${debug:=}
16+
1317
# svn repository uri
1418
master_code_uri=https://github.com/open-mpi/ompi.git
1519
master_raw_uri=https://raw.github.com/open-mpi/ompi
@@ -51,6 +55,26 @@ export LD_LIBRARY_PATH=$HOME_PREFIX/lib:$LD_LIBRARY_PATH
5155
#
5256
#####
5357

58+
debug() {
59+
if test -n "$debug"; then
60+
echo "=== DEBUG: $*"
61+
fi
62+
}
63+
64+
run_command() {
65+
debug "Running command: $*"
66+
debug "Running in pwd: `pwd`"
67+
if test -n "$debug"; then
68+
eval $*
69+
else
70+
eval $* > /dev/null 2>&1
71+
fi
72+
73+
if test $? -ne 0; then
74+
echo "=== Command failed: $*"
75+
fi
76+
}
77+
5478
# load the modules configuration
5579
. $MODULE_INIT
5680
module use $AUTOTOOL_MODULE
@@ -79,7 +103,7 @@ for branch in $branches; do
79103
script=$branch-`basename $script_uri`
80104

81105
echo "=== Getting script from: $raw_uri"
82-
wget --quiet --no-check-certificate --tries=10 $raw_uri/$branch/$script_uri -O $script
106+
run_command wget --quiet --no-check-certificate --tries=10 $raw_uri/$branch/$script_uri -O $script
83107
if test ! $? -eq 0 ; then
84108
echo "wget of OMPI nightly tarball create script failed."
85109
if test -f $script ; then
@@ -94,13 +118,12 @@ for branch in $branches; do
94118
module load "autotools/ompi-$branch"
95119

96120
echo "=== Running script..."
97-
./$script \
121+
run_command eval ./$script \
98122
$build_root/$branch \
99123
$results_addr \
100124
$outputroot/$branch \
101125
$code_uri \
102-
$branch \
103-
>/dev/null 2>&1
126+
$branch
104127

105128
module unload autotools
106129
echo "=== Done running script"
@@ -126,21 +149,21 @@ for branch in $branches; do
126149
fi
127150
echo "=== Posting tarball to open-mpi.org"
128151
# tell the web server to cleanup old nightly tarballs
129-
ssh -p 2222 \
152+
run_command ssh -p 2222 \
130153
$output_ssh_target \
131154
"git/ompi/contrib/build-server/remove-old.pl 7 public_html/nightly/$branch"
132155
# upload the new ones
133-
scp -P 2222 \
156+
run_command scp -P 2222 \
134157
$outputroot/$branch/openmpi-$latest_snapshot.tar.* \
135158
$output_ssh_target:public_html/nightly/$branch/
136-
scp -P 2222 \
159+
run_command scp -P 2222 \
137160
$outputroot/$branch/latest_snapshot.txt \
138161
$output_ssh_target:public_html/nightly/$branch/
139162
# direct the web server to regenerate the checksums
140-
ssh -p 2222 \
163+
run_command ssh -p 2222 \
141164
$output_ssh_target \
142165
"cd public_html/nightly/$branch && md5sum openmpi* > md5sums.txt"
143-
ssh -p 2222 \
166+
run_command ssh -p 2222 \
144167
$output_ssh_target \
145168
"cd public_html/nightly/$branch && sha1sum openmpi* > sha1sums.txt"
146169
fi
@@ -149,7 +172,7 @@ for branch in $branches; do
149172
# in here and clean up the old failed builds, we can accumulate
150173
# many over time. So remove any old failed builds that are over
151174
# 4 weeks old.
152-
${script_dir}/remove-old.pl 7 $build_root/$branch
175+
run_command ${script_dir}/remove-old.pl 7 $build_root/$branch
153176

154177
done
155178

@@ -158,7 +181,7 @@ done
158181

159182
for tarball in `cat $pending_coverity`; do
160183
echo "=== Submitting $tarball to Coverity..."
161-
${script_dir}/openmpi-nightly-coverity.pl \
184+
run_command ${script_dir}/openmpi-nightly-coverity.pl \
162185
--filename=$tarball \
163186
--coverity-token=$coverity_token \
164187
--verbose \

contrib/build-server/pmix-nightly-tarball.sh

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
1111
1212

13+
# Set this to any value for additional output; typically only when
14+
# debugging
15+
: ${debug:=}
16+
1317
# svn repository uri
1418
master_code_uri=https://github.com/pmix/master.git
1519
master_raw_uri=https://raw.github.com/pmix/master
@@ -51,6 +55,26 @@ export LD_LIBRARY_PATH=$HOME_PREFIX/lib:$LD_LIBRARY_PATH
5155
#
5256
#####
5357

58+
debug() {
59+
if test -n "$debug"; then
60+
echo "=== DEBUG: $*"
61+
fi
62+
}
63+
64+
run_command() {
65+
debug "Running command: $*"
66+
debug "Running in pwd: `pwd`"
67+
if test -n "$debug"; then
68+
eval $*
69+
else
70+
eval $* > /dev/null 2>&1
71+
fi
72+
73+
if test $? -ne 0; then
74+
echo "=== Command failed: $*"
75+
fi
76+
}
77+
5478
# load the modules configuration
5579
. $MODULE_INIT
5680
module use $AUTOTOOL_MODULE
@@ -84,7 +108,7 @@ for branch in $branches; do
84108
script=$branch-`basename $script_uri`
85109

86110
echo "=== Getting script from: $raw_uri"
87-
wget --quiet --no-check-certificate --tries=10 $raw_uri/$branch/$script_uri -O $script
111+
run_command wget --quiet --no-check-certificate --tries=10 $raw_uri/$branch/$script_uri -O $script
88112
if test ! $? -eq 0 ; then
89113
echo "wget of PMIX nightly tarball create script failed."
90114
if test -f $script ; then
@@ -97,16 +121,15 @@ for branch in $branches; do
97121
chmod +x $script
98122

99123
module load "autotools/pmix-$branch"
100-
# module load "libevent/pmix-$branch"
124+
# module load "libevent/pmix-$branch"
101125

102126
echo "=== Running script..."
103-
./$script \
127+
run_command ./$script \
104128
$build_root/$branch \
105129
$results_addr \
106130
$outputroot/$branch \
107131
$code_uri \
108-
$branch \
109-
>/dev/null 2>&1
132+
$branch
110133

111134
module unload autotools
112135
echo "=== Done running script"
@@ -132,21 +155,21 @@ for branch in $branches; do
132155
fi
133156
echo "=== Posting tarball to open-mpi.org"
134157
# tell the web server to cleanup old nightly tarballs
135-
ssh -p 2222 \
158+
run_command ssh -p 2222 \
136159
$output_ssh_target \
137160
"git/ompi/contrib/build-server/remove-old.pl 7 public_html/software/pmix/nightly/$branch"
138161
# upload the new ones
139-
scp -P 2222 \
162+
run_command scp -P 2222 \
140163
$outputroot/$branch/pmix-$latest_snapshot.tar.* \
141164
$output_ssh_target:public_html/software/pmix/nightly/$branch/
142-
scp -P 2222 \
165+
run_command scp -P 2222 \
143166
$outputroot/$branch/latest_snapshot.txt \
144167
$output_ssh_target:public_html/software/pmix/nightly/$branch/
145168
# direct the web server to regenerate the checksums
146-
ssh -p 2222 \
169+
run_command ssh -p 2222 \
147170
$output_ssh_target \
148171
"cd public_html/software/pmix/nightly/$branch && md5sum pmix* > md5sums.txt"
149-
ssh -p 2222 \
172+
run_command ssh -p 2222 \
150173
$output_ssh_target \
151174
"cd public_html/software/pmix/nightly/$branch && sha1sum pmix* > sha1sums.txt"
152175
fi
@@ -155,14 +178,14 @@ for branch in $branches; do
155178
# in here and clean up the old failed builds, we can accumulate
156179
# many over time. So remove any old failed bbuilds that are over
157180
# 4 weeks old.
158-
${script_dir}/remove-old.pl 7 $build_root/$branch
181+
run_command ${script_dir}/remove-old.pl 7 $build_root/$branch
159182
done
160183

161184
# If we had any new snapshots to send to coverity, process them now
162185

163186
for tarball in `cat $pending_coverity`; do
164187
echo "=== Submitting $tarball to Coverity..."
165-
${script_dir}/pmix-nightly-coverity.pl \
188+
run_command ${script_dir}/pmix-nightly-coverity.pl \
166189
--filename=$tarball \
167190
--coverity-token=$coverity_token \
168191
--verbose \

0 commit comments

Comments
 (0)