Skip to content

Commit dc5629a

Browse files
committed
fix: modify update.sh script
fix log statement Dockerfile updated / not updated remove -s option remove -b option from help correct and update example options to use current Node.js versions and latest Debian release
1 parent e519cfc commit dc5629a

File tree

1 file changed

+12
-21
lines changed

1 file changed

+12
-21
lines changed

update.sh

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,21 @@ function usage() {
1111
$0 [-s] [MAJOR_VERSION(S)] [VARIANT(S)]
1212
1313
Examples:
14-
- update.sh # Update all images
15-
- update.sh -s # Update all images, skip updating Alpine and Yarn
16-
- 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 and Yarn
18-
- 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 and Yarn
20-
- update.sh . alpine # Update the alpine variant for all versions
14+
- update.sh # Update all images
15+
- update.sh 24 # Update all variants of version 24
16+
- update.sh 22,24 # Update all variants of version 22 and 24
17+
- update.sh 24 alpine3.23 # Update only alpine3.23's variants for version 24
18+
- update.sh 24 trixie,trixie-slim # Update only trixie & trixie-slim variants for version 24
19+
- update.sh . trixie # Update the trixie variant for all versions
2120
2221
OPTIONS:
23-
-s Security update; skip updating the yarn and alpine versions.
24-
-b CI config update only
2522
-h Show this message
2623
2724
EOF
2825
}
2926

30-
SKIP=false
31-
while getopts "sh" opt; do
27+
while getopts "h" opt; do
3228
case "${opt}" in
33-
s)
34-
SKIP=true
35-
shift
36-
;;
3729
h)
3830
usage
3931
exit
@@ -65,9 +57,7 @@ fi
6557
# TODO: Should be able to specify target architecture manually
6658
arch=$(get_arch)
6759

68-
if [ "${SKIP}" != true ]; then
69-
yarnVersion="$(curl -sSL --compressed https://yarnpkg.com/latest-version)"
70-
fi
60+
yarnVersion="$(curl -sSL --compressed https://yarnpkg.com/latest-version)"
7161

7262
function in_versions_to_update() {
7363
local version=$1
@@ -134,6 +124,9 @@ function update_node_version() {
134124
sed -Ei -e 's/^FROM (.*)/FROM '"$fromprefix"'\1/' "${dockerfile}-tmp"
135125
sed -Ei -e 's/^(ENV NODE_VERSION)=.*/\1='"${nodeVersion}"'/' "${dockerfile}-tmp"
136126

127+
currentYarnVersion="$(grep "ENV YARN_VERSION" "${dockerfile}" | cut -d'=' -f2)"
128+
sed -Ei -e 's/^(ENV YARN_VERSION=).*/\1'"${currentYarnVersion}"'/' "${dockerfile}-tmp"
129+
137130
# shellcheck disable=SC1004
138131
new_line=' \\\
139132
'
@@ -168,9 +161,7 @@ function update_node_version() {
168161
if diff -q "${dockerfile}-tmp" "${dockerfile}" > /dev/null; then
169162
echo "${dockerfile} is already up to date!"
170163
else
171-
if [ "${SKIP}" != true ]; then
172-
sed -Ei -e 's/^(ENV YARN_VERSION)=.*/\1='"${yarnVersion}"'/' "${dockerfile}-tmp"
173-
fi
164+
sed -Ei -e 's/^(ENV YARN_VERSION=).*/\1'"${yarnVersion}"'/' "${dockerfile}-tmp"
174165
echo "${dockerfile} updated!"
175166
fi
176167

0 commit comments

Comments
 (0)