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

OZG-6923 add commitId to feature branch helm version

parent 2701a9c1
No related branches found
No related tags found
No related merge requests found
......@@ -144,17 +144,22 @@ void deployHelmChart(String helmChartName, String helmChartVersion) {
}
}
String generateHelmChartBuildVersion() {
def chartVersion = getHelmChartVersion()
if (isMasterBranch()) {
chartVersion += "-${env.GIT_COMMIT.take(7)}"
String validateBranchName(branchName) {
int maxLength = 30
if (branchName.length() > maxLength) {
String originalBranchName = branchName
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()) {
chartVersion += "-${env.BRANCH_NAME}"
return branchName
}
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