fix(kube): replace special caracters in branch name again

This commit is contained in:
Philippe Caseiro 2023-06-19 16:44:24 +02:00
parent bad27aa934
commit d252924f22
1 changed files with 3 additions and 2 deletions

View File

@ -24,6 +24,7 @@ String buildAndPublishImage(Map options = [:]) {
String dockerRepositoryCredentialsId = options.get('dockerRepositoryCredentialsId', 'reg.cadoles.com-jenkins')
Boolean dryRun = options.get('dryRun', true)
Boolean skipVerifications = options.get('skipVerification', false)
String currentBranch = env.BRANCH_NAME.replaceAll("[^a-zA-Z]+","_")
String projectRepository = env.JOB_NAME
if (env.BRANCH_NAME ==~ /^PR-.*$/) {
@ -47,7 +48,7 @@ String buildAndPublishImage(Map options = [:]) {
stage("Build image '${imageName}:${imageTag}'") {
git.withHTTPCredentials(gitCredentialsId) {
sh """
CURRENT_BRANCH=$( echo ${BRANCH_NAME} | | tr -c '[:alnum:]\n\r' '_'| tr '[:upper:]' '[:lower:]') make
CURRENT_BRANCH=${currentBranch} make
"""
}
}
@ -62,7 +63,7 @@ String buildAndPublishImage(Map options = [:]) {
utils.when(!dryRun) {
retry(2) {
sh """
CURRENT_BRANCH=$( echo ${BRANCH_NAME} | | tr -c '[:alnum:]\n\r' '_'| tr '[:upper:]' '[:lower:]') make
CURRENT_BRANCH=${currentBranch} make release
"""
}
}