Skip to content

Commit bcdac65

Browse files
authored
Merge pull request #2421 from nschonni/skip-alpine-security-failure
fix: Don't fail on Alpine checksums for Security releases
2 parents 6a173f6 + 69aa9b2 commit bcdac65

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

update.sh

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ function usage() {
1212
1313
Examples:
1414
- update.sh # Update all images
15-
- update.sh -s # Update all images, skip updating Alpine
15+
- update.sh -s # Update all images, skip updating Alpine if the musl build isn't available
1616
- update.sh 8,10 # Update all variants of version 8 and 10
17-
- update.sh -s 8 # Update version 8 and variants, skip updating Alpine
17+
- update.sh -s 8 # Update version 8 and variants, skip updating Alpine if the musl build isn't available
1818
- update.sh 8 alpine # Update only alpine's variants for version 8
19-
- update.sh -s 8 bullseye # Update only bullseye variant for version 8, skip updating Alpine
19+
- update.sh -s 8 bullseye # Update only bullseye variant for version 8, skip updating Alpine if the musl build isn't available
2020
- update.sh . alpine # Update the alpine variant for all versions
2121
2222
OPTIONS:
@@ -26,9 +26,11 @@ function usage() {
2626
EOF
2727
}
2828

29+
SKIP_ALPINE=false
2930
while getopts "sh" opt; do
3031
case "${opt}" in
3132
s)
33+
SKIP_ALPINE=true
3234
shift
3335
;;
3436
h)
@@ -57,7 +59,7 @@ if [ ${#versions[@]} -eq 0 ]; then
5759
fi
5860

5961
# Global variables
60-
# Get architecure and use this as target architecture for docker image
62+
# Get architecture and use this as target architecture for docker image
6163
# See details in function.sh
6264
# TODO: Should be able to specify target architecture manually
6365
arch=$(get_arch)
@@ -145,11 +147,15 @@ function update_node_version() {
145147
)
146148
if [ -z "$checksum" ]; then
147149
rm -f "${dockerfile}-tmp"
148-
fatal "Failed to fetch checksum for version ${nodeVersion}"
150+
if [ "${SKIP_ALPINE}" = true ]; then
151+
echo "${nodeVersion} is missing the musl build for ${variant}, but skipping for security release!"
152+
else
153+
fatal "Failed to fetch checksum for musl build version ${nodeVersion}"
154+
fi
155+
else
156+
sed -Ei -e "s/(alpine:)0.0/\\1${alpine_version}/" "${dockerfile}-tmp"
157+
sed -Ei -e "s/CHECKSUM=CHECKSUM_x64/CHECKSUM=\"${checksum}\"/" "${dockerfile}-tmp"
149158
fi
150-
sed -Ei -e "s/(alpine:)0.0/\\1${alpine_version}/" "${dockerfile}-tmp"
151-
sed -Ei -e "s/CHECKSUM=CHECKSUM_x64/CHECKSUM=\"${checksum}\"/" "${dockerfile}-tmp"
152-
153159
elif is_debian "${variant}"; then
154160
sed -Ei -e "s/(buildpack-deps:)name/\\1${variant}/" "${dockerfile}-tmp"
155161
elif is_debian_slim "${variant}"; then
@@ -173,7 +179,10 @@ function update_node_version() {
173179
rm "${dockerfile}-tmp-e"
174180
fi
175181

176-
mv -f "${dockerfile}-tmp" "${dockerfile}"
182+
# Guard the move because Alpine sometimes will be missing
183+
if [ -f "${dockerfile}-tmp" ]; then
184+
mv -f "${dockerfile}-tmp" "${dockerfile}"
185+
fi
177186
)
178187
}
179188

0 commit comments

Comments
 (0)