Skip to content

Commit bc18c33

Browse files
committed
Handle case where latest version is a release
1 parent 1ae340d commit bc18c33

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

version-timestamps.sh

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,15 @@ processGAV() {
2525
debug processGAV $@
2626
g=$1; a=$2; v=$3
2727
releaseTimestamp=$(releaseTimestamp "$g" "$a" "$v")
28-
newestSnapshot=$(newestSnapshot "$g" "$a")
29-
lastDeployed=$(snapshotTimestamp "$g" "$a" "$newestSnapshot")
28+
latestVersion=$(latestVersion "$g" "$a")
29+
case "$latestVersion" in
30+
*-SNAPSHOT)
31+
lastDeployed=$(snapshotTimestamp "$g" "$a" "$latestVersion")
32+
;;
33+
*)
34+
lastDeployed=$(releaseTimestamp "$g" "$a" "$latestVersion")
35+
;;
36+
esac
3037
echo "$g:$a:$v $releaseTimestamp $lastDeployed"
3138
}
3239

@@ -61,9 +68,9 @@ releaseTimestamp() {
6168
esac
6269
}
6370

64-
# Given a GA, discerns the newest snapshot version.
65-
newestSnapshot() {
66-
debug newestSnapshot $@
71+
# Given a GA, discerns the latest version (snapshot or release).
72+
latestVersion() {
73+
debug latestVersion $@
6774
# Extract <versioning><latest> value.
6875
extractTag latest $@
6976
}
@@ -93,7 +100,7 @@ extractTag() {
93100
# Extract versioning/latest from the remote metadata.
94101
metadata=$(downloadMetadata "$g" "$av")
95102
tagValue=$(echo "$metadata" | tagValue "$tag")
96-
debug "newestSnapshot: $tag -> $tagValue"
103+
debug "extractTag: $tag -> $tagValue"
97104
test "$tagValue" || die 1 "No $tag tag in metadata:\n$metadata"
98105
echo "$tagValue"
99106
;;

0 commit comments

Comments
 (0)