@@ -156,11 +156,14 @@ function update_node_version() {
156
156
157
157
if is_alpine " ${variant} " ; then
158
158
alpine_version=" ${variant#* alpine} "
159
- checksum=" \" $(
159
+ checksum=$(
160
160
curl -sSL --compressed " https://unofficial-builds.nodejs.org/download/release/v${nodeVersion} /SHASUMS256.txt" | grep " node-v${nodeVersion} -linux-x64-musl.tar.xz" | cut -d' ' -f1
161
- ) \" "
161
+ )
162
+ if [ -z " $checksum " ]; then
163
+ fatal " Failed to fetch checksum for version ${nodeVersion} "
164
+ fi
162
165
sed -Ei -e " s/(alpine:)0.0/\\ 1${alpine_version} /" " ${dockerfile} -tmp"
163
- sed -Ei -e " s/CHECKSUM=CHECKSUM_x64/CHECKSUM=${checksum} /" " ${dockerfile} -tmp"
166
+ sed -Ei -e " s/CHECKSUM=CHECKSUM_x64/CHECKSUM=\" ${checksum} \" /" " ${dockerfile} -tmp"
164
167
165
168
# Use python2 for nodejs < 14 on alpine
166
169
if [ " $version " -lt 14 ]; then
@@ -203,9 +206,12 @@ for version in "${versions[@]}"; do
203
206
# See details in function.sh
204
207
IFS=' ' read -ra variants <<< " $(get_variants " ${parentpath} " )"
205
208
209
+ pids=()
210
+
206
211
if [ -f " ${version} /Dockerfile" ]; then
207
212
if [ " ${update_version} " -eq 0 ]; then
208
213
update_node_version " ${baseuri} " " ${versionnum} " " ${parentpath} /Dockerfile.template" " ${version} /Dockerfile" &
214
+ pids+=($! )
209
215
fi
210
216
fi
211
217
@@ -227,9 +233,15 @@ for version in "${versions[@]}"; do
227
233
cp " ${parentpath} /docker-entrypoint.sh" " ${version} /${variant} /docker-entrypoint.sh"
228
234
if [ " ${update_version} " -eq 0 ] && [ " ${update_variant} " -eq 0 ]; then
229
235
update_node_version " ${baseuri} " " ${versionnum} " " ${template_file} " " ${version} /${variant} /Dockerfile" " ${variant} " &
236
+ pids+=($! )
230
237
fi
231
238
done
232
239
done
233
240
234
- wait
241
+ # The reason we explicitly wait on each pid is so the return status of this script is set properly
242
+ # if one of the jobs fails. If we just called "wait", the exit status would always be 0
243
+ for pid in " ${pids[@]} " ; do
244
+ wait " $pid "
245
+ done
246
+
235
247
info " Done!"
0 commit comments