Skip to content

Commit a80938c

Browse files
committed
Update versions.sh to handle unreleased non-rc versions better
1 parent 7200fe7 commit a80938c

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

versions.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ fi
164164

165165
for version in "${versions[@]}"; do
166166
rcVersion="${version%-rc}"
167+
export version rcVersion
167168
channel='stable'
168169

169170
versionOptions="$(grep "^$rcVersion[.]" <<<"$dockerVersions")"
@@ -174,14 +175,17 @@ for version in "${versions[@]}"; do
174175
channel='test'
175176
fi
176177

177-
fullVersion="$(grep $rcGrepV -E -- '-(rc|tp|beta)' <<<"$versionOptions" | tail -1)"
178-
if [ -z "$fullVersion" ]; then
178+
if ! fullVersion="$(grep $rcGrepV -E -- '-(rc|tp|beta)' <<<"$versionOptions" | tail -1)" || [ -z "$fullVersion" ]; then
179+
if currentNull="$(jq -r '.[env.version] == null' versions.json)" && [ "$currentNull" = 'true' ]; then
180+
echo >&2 "warning: skipping '$version' (does not appear to be released yet)"
181+
json="$(jq <<<"$json" -c '.[env.version] = null')"
182+
continue
183+
fi
179184
echo >&2 "error: cannot find full version for $version"
180185
exit 1
181186
fi
182187

183188
# if this is a "-rc" release, let's make sure the release it contains isn't already GA (and thus something we should not publish anymore)
184-
export version rcVersion
185189
if [ "$rcVersion" != "$version" ] && rcFullVersion="$(jq <<<"$json" -r '.[env.rcVersion].version // ""')" && [ -n "$rcFullVersion" ]; then
186190
latestVersion="$({ echo "$fullVersion"; echo "$rcFullVersion"; } | sort -V | tail -1)"
187191
if [[ "$fullVersion" == "$rcFullVersion"* ]] || [ "$latestVersion" = "$rcFullVersion" ]; then

0 commit comments

Comments
 (0)