Merge pull request #48 from RightBrain-Networks/bugfix/docker-format
add docker format support
This commit is contained in:
commit
3d82649a80
@ -31,7 +31,7 @@ def get_version(build=0,version_format=None,dot=False):
|
||||
bump_output = p.stdout.read().decode('utf-8').rstrip()
|
||||
next_version = re.search("new_version=([0-9]*.[0-9]*.[0-9]*)", bump_output).group(1)
|
||||
|
||||
if version_format == 'npm':
|
||||
if version_format in ('npm','docker'):
|
||||
return "{}-{}.{}".format(next_version,branch.replace('/','-'),build)
|
||||
if version_format == 'maven':
|
||||
qualifier = 'SNAPSHOT' if build == 0 else build
|
||||
@ -46,7 +46,7 @@ def main():
|
||||
parser = argparse.ArgumentParser(description='Get Version or Branch.')
|
||||
parser.add_argument('-d', '--dot', help='Switch out / for . to be used in docker tag', action='store_true', dest='dot')
|
||||
parser.add_argument('-D', '--debug', help='Sets logging level to DEBUG', action='store_true', dest='debug', default=False)
|
||||
parser.add_argument('-f', '--format', help='Format for pre-release version syntax', choices=['npm','maven'], default=None)
|
||||
parser.add_argument('-f', '--format', help='Format for pre-release version syntax', choices=['npm','maven','docker'], default=None)
|
||||
parser.add_argument('-b', '--build-number', help='Build number, used in pre-releases', default=0)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
@ -66,6 +66,11 @@ class TestGetVersion(unittest.TestCase):
|
||||
subprocess.call(['git', 'checkout', '-b', 'patch/branch'])
|
||||
branch = get_version.get_version(version_format='npm')
|
||||
self.assertEqual(branch, "0.0.1-patch-branch.0")
|
||||
def test_branch_docker_pre_release(self):
|
||||
create_git_environment()
|
||||
subprocess.call(['git', 'checkout', '-b', 'patch/branch'])
|
||||
branch = get_version.get_version(build=2,version_format='docker')
|
||||
self.assertEqual(branch, "0.0.1-patch-branch.2")
|
||||
def test_branch_maven_pre_release(self):
|
||||
create_git_environment()
|
||||
subprocess.call(['git', 'checkout', '-b', 'minor/branch'])
|
||||
|
Loading…
Reference in New Issue
Block a user