chore: Simplify yarn and alpine version update

Before commit 3f6cb089 (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.
This commit is contained in:
Orgad Shaneh 2025-07-10 22:19:44 +03:00
parent cc626c1cf1
commit 61380fa120
1 changed files with 2 additions and 8 deletions

View File

@ -66,7 +66,6 @@ fi
arch=$(get_arch)
if [ "${SKIP}" != true ]; then
alpine_version=$(get_config "./" "alpine_version")
yarnVersion="$(curl -sSL --compressed https://yarnpkg.com/latest-version)"
fi
@ -135,9 +134,6 @@ function update_node_version() {
sed -Ei -e 's/^FROM (.*)/FROM '"$fromprefix"'\1/' "${dockerfile}-tmp"
sed -Ei -e 's/^(ENV NODE_VERSION ).*/\1'"${nodeVersion}"'/' "${dockerfile}-tmp"
currentYarnVersion="$(grep "ENV YARN_VERSION" "${dockerfile}" | cut -d' ' -f3)"
sed -Ei -e 's/^(ENV YARN_VERSION ).*/\1'"${currentYarnVersion}"'/' "${dockerfile}-tmp"
# shellcheck disable=SC1004
new_line=' \\\
'
@ -172,11 +168,9 @@ function update_node_version() {
if diff -q "${dockerfile}-tmp" "${dockerfile}" > /dev/null; then
echo "${dockerfile} is already up to date!"
else
if [ "${SKIP}" = true ]; then
# Get the currently used Yarn version
yarnVersion="$(grep "ENV YARN_VERSION" "${dockerfile}" | cut -d' ' -f3)"
fi
if [ "${SKIP}" != true ]; then
sed -Ei -e 's/^(ENV YARN_VERSION ).*/\1'"${yarnVersion}"'/' "${dockerfile}-tmp"
fi
echo "${dockerfile} updated!"
fi