Bugfix intenum

Fix creds

attempt documented workaround

Set system prop

Use privileged container to work around Jenkins bug

Remove property set
This commit is contained in:
Layla 2020-11-22 23:15:47 -05:00
parent 11a4ff35fc
commit f3bc97206a
3 changed files with 20 additions and 14 deletions

7
Jenkinsfile vendored
View File

@ -1,4 +1,4 @@
library('pipeline-library')
library('pipeline-library@bugfix/durable-task-workaround')
pipeline {
options { timestamps() }
@ -18,7 +18,7 @@ pipeline {
stage('Self Version') {
steps {
withCredentials([usernamePassword(credentialsId: env.DOCKER_CREDENTIALS, usernameVariable: 'DOCKER_USERNAME', passwordVariable: 'DOCKER_PASSWORD')]) {
sh("docker login -u ${DOCKER_USERNAME} -p ${DOCKER_PASSWORD}")
sh("docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD")
}
runAutoSemver("rightbrainnetworks/auto-semver:${SELF_SEMVER_TAG}")
}
@ -59,6 +59,7 @@ pipeline {
agent {
docker {
image "rightbrainnetworks/auto-semver:${env.VERSION}"
args "--privileged"
}
}
steps
@ -85,7 +86,7 @@ pipeline {
// Authenticate & push to DockerHub
withCredentials([usernamePassword(credentialsId: env.DOCKER_CREDENTIALS, usernameVariable: 'DOCKER_USERNAME', passwordVariable: 'DOCKER_PASSWORD')]) {
sh("""
docker login -u ${DOCKER_USERNAME} -p ${DOCKER_PASSWORD}
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
docker push rightbrainnetworks/auto-semver:${env.VERSION}
""")
}

View File

@ -1,6 +1,8 @@
import argparse
import re
import subprocess
import sys
import traceback
from enum import IntEnum
from semver.utils import get_tag_version
from semver.logger import logging, logger, console_logger
@ -111,7 +113,7 @@ class SemVer(object):
config_file = file.read()
# version repo
logger.debug("Running bumpversion of type: " + self.version_type)
logger.debug("Running bumpversion of type: " + str(self.version_type.name))
bump_version(get_tag_version(), self.version_type)
return self
@ -146,20 +148,22 @@ class SemVer(object):
return self
def main():
parser = argparse.ArgumentParser(description='Bump Semantic Version.')
parser.add_argument('-n','--no-push', help='Do not try to push', action='store_false', dest='push')
parser.add_argument('-g','--global-user', help='Set git user at a global level, helps in jenkins', action='store_true', dest='global_user')
parser.add_argument('-D', '--debug', help='Sets logging level to DEBUG', action='store_true', dest='debug', default=False)
args = parser.parse_args()
if args.debug:
console_logger.setLevel(logging.DEBUG)
try:
parser = argparse.ArgumentParser(description='Bump Semantic Version.')
parser.add_argument('-n','--no-push', help='Do not try to push', action='store_false', dest='push')
parser.add_argument('-g','--global-user', help='Set git user at a global level, helps in jenkins', action='store_true', dest='global_user')
parser.add_argument('-D', '--debug', help='Sets logging level to DEBUG', action='store_true', dest='debug', default=False)
args = parser.parse_args()
if args.debug:
console_logger.setLevel(logging.DEBUG)
SemVer(global_user=args.global_user).run(push=args.push)
except Exception as e:
logger.error(e)
if args.debug:
tb = sys.exc_info()[2]
traceback.print_tb(tb)
if e == NO_MERGE_FOUND:
exit(1)
elif e == NOT_MAIN_BRANCH:

View File

@ -40,6 +40,7 @@ def call(dockerImage = "rightbrainnetworks/auto-semver:latest", debug = false) {
break
}
env.SEMVER_NEW_VERSION = sh(script: "grep -Po '${regex}' .bumpversion.cfg", returnStdout: true).trim()
env.SEMVER_RESOLVED_VERSION = getVersion("-d ${args}")
env.VERSION = env.SEMVER_RESOLVED_VERSION