Skip to content
Snippets Groups Projects
Commit 32131cf8 authored by OZGCloud's avatar OZGCloud
Browse files

Merge pull request 'OZG-6923 add commitId to helm version in feature branch'...

Merge pull request 'OZG-6923 add commitId to helm version in feature branch' (#5) from OZG-6923 into master

Reviewed-on: https://git.ozg-sh.de/ozgcloud-app/elster-transfer/pulls/5
parents 2701a9c1 a896e8dd
No related branches found
No related tags found
No related merge requests found
...@@ -144,17 +144,22 @@ void deployHelmChart(String helmChartName, String helmChartVersion) { ...@@ -144,17 +144,22 @@ void deployHelmChart(String helmChartName, String helmChartVersion) {
} }
} }
String generateHelmChartBuildVersion() { String validateBranchName(branchName) {
def chartVersion = getHelmChartVersion() int maxLength = 18
if (branchName.length() > maxLength) {
if (isMasterBranch()) { String originalBranchName = branchName
chartVersion += "-${env.GIT_COMMIT.take(7)}" branchName = branchName.substring(0, maxLength)
echo "WARNING: Branch name '${originalBranchName}' exceeded ${maxLength} characters. " +
"It has been truncated to '${branchName}' for deployment purposes."
} }
else if (!isReleaseBranch()) { return branchName
chartVersion += "-${env.BRANCH_NAME}"
} }
return chartVersion.replaceAll("_", "-") String generateHelmChartBuildVersion() {
if (isReleaseBranch()) {
return getHelmChartVersion().replaceAll("_", "-")
}
return "${getHelmChartVersion()}-${validateBranchName(env.BRANCH_NAME)}-${env.GIT_COMMIT.take(7)}".replaceAll("_", "-")
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment