summaryrefslogtreecommitdiff
path: root/hack/get_release_info.sh
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-04-12 12:16:44 -0700
committerGitHub <noreply@github.com>2021-04-12 12:16:44 -0700
commit6933d4611a94097681a1d8435290d9bb1c59f1f4 (patch)
tree34333507f5c964c36ac3ae34ed8fff225fe5ef94 /hack/get_release_info.sh
parentddffc7fa803fa22033459fd5666679179c3581bc (diff)
parentb6b0b6e8bd0f8c75fe9411f722a43f9305c6137a (diff)
downloadpodman-6933d4611a94097681a1d8435290d9bb1c59f1f4.tar.gz
podman-6933d4611a94097681a1d8435290d9bb1c59f1f4.tar.bz2
podman-6933d4611a94097681a1d8435290d9bb1c59f1f4.zip
Merge pull request #9381 from cevich/add_make_release
Reorganize and overhaul Makefile & release archive workflows
Diffstat (limited to 'hack/get_release_info.sh')
-rwxr-xr-xhack/get_release_info.sh18
1 files changed, 17 insertions, 1 deletions
diff --git a/hack/get_release_info.sh b/hack/get_release_info.sh
index 69cf8cd57..b3e208ac9 100755
--- a/hack/get_release_info.sh
+++ b/hack/get_release_info.sh
@@ -14,11 +14,27 @@ valid_args() {
cut -d '*' -f 1
}
+# `git describe` will never produce a useful version number under all
+# branches. This is because the podman release process (see `RELEASE_PROCESS.md`)
+# tags release versions only on release-branches (i.e. never on master).
+# Scraping the version number directly from the source, is the only way
+# to reliably obtain the number from all the various contexts supported by
+# the `Makefile`.
+scrape_version() {
+ local v
+ # extract the value of 'var Version'
+ v=$(sed -ne 's/^var\s\+Version\s\+=\s.*("\(.*\)").*/\1/p' <version/version.go)
+ # If it's empty, something has changed in version.go, that would be bad!
+ test -n "$v"
+ # Value consumed literally, must not have any embedded newlines
+ echo -n "$v"
+}
+
unset OUTPUT
case "$1" in
# Wild-card suffix needed by valid_args() e.g. possible bad grep of "$(echo $FOO)"
VERSION*)
- OUTPUT="${CIRRUS_TAG:-$(git fetch --tags && git describe HEAD 2> /dev/null)}"
+ OUTPUT="${CIRRUS_TAG:-$(scrape_version)}"
;;
NUMBER*)
OUTPUT="$($0 VERSION | sed 's/-.*//')"