From 61380fa120671347f520f3d6b088bcdc356a0ffe Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Thu, 10 Jul 2025 22:19:44 +0300 Subject: [PATCH] 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. --- update.sh | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/update.sh b/update.sh index cd73b6e22a..88dcec1155 100755 --- a/update.sh +++ b/update.sh @@ -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)" + if [ "${SKIP}" != true ]; then + sed -Ei -e 's/^(ENV YARN_VERSION ).*/\1'"${yarnVersion}"'/' "${dockerfile}-tmp" fi - sed -Ei -e 's/^(ENV YARN_VERSION ).*/\1'"${yarnVersion}"'/' "${dockerfile}-tmp" echo "${dockerfile} updated!" fi