test inside current docker image

This commit is contained in:
Derek DeJonghe 2020-06-15 17:19:00 -04:00
parent 56ee7b103d
commit cf7e92bc1d
2 changed files with 13 additions and 16 deletions

4
Jenkinsfile vendored
View File

@ -57,9 +57,7 @@ pipeline {
} }
stage('Test') { stage('Test') {
agent { agent {
docker { dockerfile true
image "rightbrainnetworks/auto-semver:${env.VERSION}"
}
} }
steps steps
{ {

View File

@ -21,19 +21,18 @@ def get_version(build=0,version_format=None,dot=False):
logger.debug("v_hash and c_hash do not match!") logger.debug("v_hash and c_hash do not match!")
branch = subprocess.Popen(['git', 'rev-parse', '--abbrev-ref', 'HEAD'], stdout=subprocess.PIPE, branch = subprocess.Popen(['git', 'rev-parse', '--abbrev-ref', 'HEAD'], stdout=subprocess.PIPE,
stderr=DEVNULL, cwd='.').stdout.read().decode('utf-8').rstrip() stderr=DEVNULL, cwd='.').stdout.read().decode('utf-8').rstrip()
if version_format: semver = SemVer()
semver = SemVer() semver.merged_branch = branch
semver.merged_branch = branch version_type = semver.get_version_type()
version_type = semver.get_version_type() p = subprocess.Popen(['bumpversion', '--dry-run', '--verbose', '--current-version', get_tag_version(), version_type], stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd='.')
p = subprocess.Popen(['bumpversion', '--dry-run', '--verbose', '--current-version', get_tag_version(), version_type], stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd='.') bump_output = p.stderr.read().decode()
bump_output = p.stderr.read().decode() next_version = match = re.search("New version will be '([0-9]*.[0-9]*.[0-9]*)'", bump_output).group(1)
next_version = match = re.search("New version will be '([0-9]*.[0-9]*.[0-9]*)'", bump_output).group(1)
if version_format == 'npm':
if version_format == 'npm': return "{}-{}.{}".format(next_version,branch.replace('/','-'),build)
return "{}-{}.{}".format(next_version,branch.replace('/','-'),build) if version_format == 'maven':
if version_format == 'maven': qualifier = 'SNAPSHOT' if build == 0 else build
qualifier = 'SNAPSHOT' if build == 0 else build return "{}-{}-{}".format(next_version,branch.replace('/','-'),qualifier)
return "{}-{}-{}".format(next_version,branch.replace('/','-'),qualifier)
if dot: if dot:
branch = branch.replace('/','.') branch = branch.replace('/','.')
return branch return branch