Skip to content

Commit c723fcb

Browse files
committed
chore: Simplify yarn and alpine version update
Before commit 3f6cb08 (fix: only update yarn if there are other changes to the dockerfile), yarnVersion depended on SKIP, so the substitute that followed made sense. This commit removed the condition and changed it to just substitute the version with itself, which doesn't make much sense. Just remove it, and also move the real replace inside SKIP condition. Also remove initial assignment to alpine_version, which is never used.
1 parent cc626c1 commit c723fcb

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

update.sh

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ fi
6666
arch=$(get_arch)
6767

6868
if [ "${SKIP}" != true ]; then
69-
alpine_version=$(get_config "./" "alpine_version")
7069
yarnVersion="$(curl -sSL --compressed https://yarnpkg.com/latest-version)"
7170
fi
7271

@@ -135,13 +134,9 @@ function update_node_version() {
135134
sed -Ei -e 's/^FROM (.*)/FROM '"$fromprefix"'\1/' "${dockerfile}-tmp"
136135
sed -Ei -e 's/^(ENV NODE_VERSION ).*/\1'"${nodeVersion}"'/' "${dockerfile}-tmp"
137136

138-
currentYarnVersion="$(grep "ENV YARN_VERSION" "${dockerfile}" | cut -d' ' -f3)"
139-
sed -Ei -e 's/^(ENV YARN_VERSION ).*/\1'"${currentYarnVersion}"'/' "${dockerfile}-tmp"
140-
141137
# shellcheck disable=SC1004
142138
new_line=' \\\
143139
'
144-
145140
# Add GPG keys
146141
for key_type in "node" "yarn"; do
147142
while read -r line; do
@@ -172,11 +167,9 @@ function update_node_version() {
172167
if diff -q "${dockerfile}-tmp" "${dockerfile}" > /dev/null; then
173168
echo "${dockerfile} is already up to date!"
174169
else
175-
if [ "${SKIP}" = true ]; then
176-
# Get the currently used Yarn version
177-
yarnVersion="$(grep "ENV YARN_VERSION" "${dockerfile}" | cut -d' ' -f3)"
170+
if [ "${SKIP}" != true ]; then
171+
sed -Ei -e 's/^(ENV YARN_VERSION ).*/\1'"${yarnVersion}"'/' "${dockerfile}-tmp"
178172
fi
179-
sed -Ei -e 's/^(ENV YARN_VERSION ).*/\1'"${yarnVersion}"'/' "${dockerfile}-tmp"
180173
echo "${dockerfile} updated!"
181174
fi
182175

0 commit comments

Comments
 (0)