mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2024-11-21 16:27:51 -06:00
60 lines
1.7 KiB
Bash
Executable File
60 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# Copyright (c) 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.
|
|
#
|
|
|
|
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 [ -e "$TAG" ]
|
|
then
|
|
printf "There are no tags attached to the current branch. bailing out\n"
|
|
exit 5
|
|
fi
|
|
if [[ $TAG =~ ([0-9]+)\.([0-9]+)\.([0-9]+)(-preview)? ]]
|
|
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}' (from revision ${REVISION}) does not match #.#.#-preview 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
|
|
|
|
printf "%s.%s.%s-preview\n" "${@:2:3}"
|
|
|
|
|