mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2024-12-24 08:00:00 -06:00
69 lines
1.8 KiB
Bash
Executable File
69 lines
1.8 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# Copyright (c) 2023 nosqlbench
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
#
|
|
|
|
if [ "$1" == "-n" ]
|
|
then numeric=true
|
|
elif [ "$1" == "-s" ]
|
|
then short=true
|
|
fi
|
|
|
|
set -e
|
|
|
|
export REVISION=$(mvn help:evaluate -Dexpression=revision -q -DforceStdout)
|
|
if [[ $REVISION =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)-SNAPSHOT$ ]]
|
|
then
|
|
printf "The revision matches the format, continuing\n" 1>&2
|
|
set -- "${BASH_REMATCH[@]}"
|
|
VERSION_STRING="${@:2:3}"
|
|
else
|
|
printf "The revision format for '${REVISION}' does not match #.#.#-SNAPSHOT form. bailing out\n"
|
|
exit 3
|
|
fi
|
|
|
|
export TAG=$(git describe --exact-match --tags)
|
|
if [[ $TAG =~ ([0-9]+)\.([0-9]+)\.([0-9]+)(-release)? ]]
|
|
then
|
|
printf "The tag format matches the version, continuing\n" 1>&2
|
|
set -- "${BASH_REMATCH[@]}"
|
|
TAG_STRING="${@:2:3}"
|
|
else
|
|
printf "The tag format for '${TAG}' does not match #.#.#-release form. bailing out\n" 1>&2
|
|
exit 4
|
|
fi
|
|
|
|
printf "version(${VERSION_STRING}) tag(${TAG_STRING})\n" 1>&2
|
|
|
|
if [ "${VERSION_STRING}" == "${TAG_STRING}" ]
|
|
then
|
|
printf "version and tag match, continuing\n" 1>&2
|
|
else
|
|
printf "version and tag do not match: bailing out\n" 1>&2
|
|
exit 5
|
|
fi
|
|
|
|
if [ "$numeric" == "true" ]
|
|
then
|
|
printf "%s.%s.%s\n" "${@:2:3}"
|
|
elif [ "$short" == "true" ]
|
|
then
|
|
printf "%s.%s\n" "${@:2:2}"
|
|
else
|
|
printf "%s.%s.%s-release\n" "${@:2:3}"
|
|
fi
|
|
|
|
|