Skip to content

Commit 7b0a617

Browse files
authored
Merge pull request #738 from LaurentGoderre/fix-update
Fix the update script for only a specific version
2 parents 9e2a121 + eb8000c commit 7b0a617

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

update.sh

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ set -ue
55

66
cd "$(cd "${0%/*}" && pwd -P)"
77

8-
IFS=' ' read -ra versions <<<"$(get_versions . "$@")"
8+
IFS=' ' read -ra versions <<<"$(get_versions .)"
9+
IFS=' ' read -ra update_versions <<<"$(get_versions . "$@")"
910
if [ ${#versions[@]} -eq 0 ]; then
1011
fatal "No valid versions found!"
1112
fi
@@ -18,6 +19,19 @@ arch=$(get_arch)
1819

1920
yarnVersion="$(curl -sSL --compressed https://yarnpkg.com/latest-version)"
2021

22+
function in_versions_to_update() {
23+
local version=$1
24+
25+
for version_to_update in "${update_versions[@]}"; do
26+
if [ "${version_to_update}" = "${version}" ]; then
27+
echo 0
28+
return
29+
fi
30+
done
31+
32+
echo 1
33+
}
34+
2135
function update_node_version() {
2236

2337
local baseuri=$1
@@ -91,14 +105,17 @@ for version in "${versions[@]}"; do
91105
# Skip "docs" and other non-docker directories
92106
[ -f "$version/Dockerfile" ] || continue
93107

94-
info "Updating version $version..."
95-
96108
parentpath=$(dirname "$version")
97109
versionnum=$(basename "$version")
98110
baseuri=$(get_config "$parentpath" "baseuri")
111+
update=$(in_versions_to_update "$version")
99112

100113
add_stage "$baseuri" "$version" "default"
101-
update_node_version "$baseuri" "$versionnum" "$parentpath/Dockerfile.template" "$version/Dockerfile" &
114+
115+
if [ "$update" -eq 0 ]; then
116+
info "Updating version $version..."
117+
update_node_version "$baseuri" "$versionnum" "$parentpath/Dockerfile.template" "$version/Dockerfile" &
118+
fi
102119

103120
# Get supported variants according the target architecture
104121
# See details in function.sh
@@ -108,7 +125,10 @@ for version in "${versions[@]}"; do
108125
# Skip non-docker directories
109126
[ -f "$version/$variant/Dockerfile" ] || continue
110127
add_stage "$baseuri" "$version" "$variant"
111-
update_node_version "$baseuri" "$versionnum" "$parentpath/Dockerfile-$variant.template" "$version/$variant/Dockerfile" "$variant" &
128+
129+
if [ "$update" -eq 0 ]; then
130+
update_node_version "$baseuri" "$versionnum" "$parentpath/Dockerfile-$variant.template" "$version/$variant/Dockerfile" "$variant" &
131+
fi
112132
done
113133
done
114134

0 commit comments

Comments
 (0)