Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
alfa
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OZG-Cloud
app
alfa
Commits
488f6da2
Commit
488f6da2
authored
5 months ago
by
OZGCloud
Browse files
Options
Downloads
Patches
Plain Diff
OZG-6923 update imageTag/helmVersion in jenkinsfile.admin
parent
974eecdc
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Jenkinsfile
+2
-2
2 additions, 2 deletions
Jenkinsfile
Jenkinsfile.admin
+16
-20
16 additions, 20 deletions
Jenkinsfile.admin
with
18 additions
and
22 deletions
Jenkinsfile
+
2
−
2
View file @
488f6da2
...
@@ -346,10 +346,10 @@ String buildVersionName() {
...
@@ -346,10 +346,10 @@ String buildVersionName() {
return
getRootPomVersion
(
pomFile
)
return
getRootPomVersion
(
pomFile
)
}
}
if
(
isBarrierefreiheitBranch
())
{
if
(
isBarrierefreiheitBranch
())
{
return
"${getRootPomVersion(pomFile)}-barrierefreiheit${getCommitHash()}"
.
replaceAll
(
"_"
,
"-"
)
return
"${getRootPomVersion(pomFile)}-barrierefreiheit${
validateBranchName(env.BRANCH_NAME)}${
getCommitHash()}"
.
replaceAll
(
"_"
,
"-"
)
}
}
return
"${getRootPomVersion(pomFile)}-${validateBranchName(env.BRANCH_NAME)}
-
${
env.GIT_COMMIT.take(7
)}"
.
replaceAll
(
"_"
,
"-"
)
return
"${getRootPomVersion(pomFile)}-${validateBranchName(env.BRANCH_NAME)}${
getCommitHash(
)}"
.
replaceAll
(
"_"
,
"-"
)
}
}
Void
tagAndPushDockerImage
(
String
newTag
){
Void
tagAndPushDockerImage
(
String
newTag
){
...
...
This diff is collapsed.
Click to expand it.
Jenkinsfile.admin
+
16
−
20
View file @
488f6da2
...
@@ -63,7 +63,7 @@ pipeline {
...
@@ -63,7 +63,7 @@ pipeline {
steps {
steps {
script {
script {
FAILED_STAGE=env.STAGE_NAME
FAILED_STAGE=env.STAGE_NAME
IMAGE_TAG =
generateImageTag
()
IMAGE_TAG =
buildVersionName
()
tagAndPushDockerImage(IMAGE_TAG)
tagAndPushDockerImage(IMAGE_TAG)
...
@@ -81,7 +81,7 @@ pipeline {
...
@@ -81,7 +81,7 @@ pipeline {
steps {
steps {
script {
script {
FAILED_STAGE=env.STAGE_NAME
FAILED_STAGE=env.STAGE_NAME
HELM_CHART_VERSION =
generateHelmChart
Version()
HELM_CHART_VERSION =
build
Version
Name
()
dir('alfa-client/apps/admin') {
dir('alfa-client/apps/admin') {
sh "./run_helm_test.sh"
sh "./run_helm_test.sh"
...
@@ -146,14 +146,22 @@ Boolean isReleaseBranch() {
...
@@ -146,14 +146,22 @@ Boolean isReleaseBranch() {
return env.BRANCH_NAME == 'release-admin'
return env.BRANCH_NAME == 'release-admin'
}
}
String generateImageTag() {
def validateBranchName(branchName) {
def imageTag = "${env.BRANCH_NAME}-${VERSION}"
int maxLength = 30
if (branchName.length() > maxLength) {
if (isMasterBranch()) {
String originalBranchName = branchName
imageTag += "-${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."
}
}
return branchName
}
return imageTag
String buildVersionName() {
if (isReleaseBranch()) {
return "${VERSION}"
}
return "${VERSION}-${validateBranchName(env.BRANCH_NAME)}-${env.GIT_COMMIT.take(7)}".replaceAll("_", "-")
}
}
Void cloneGitopsRepo() {
Void cloneGitopsRepo() {
...
@@ -247,18 +255,6 @@ Void deployHelmChart(String helmChartVersion) {
...
@@ -247,18 +255,6 @@ Void deployHelmChart(String helmChartVersion) {
}
}
}
}
}
}
String generateHelmChartVersion() {
def chartVersion = "${VERSION}"
if (isMasterBranch()) {
chartVersion += "-${env.GIT_COMMIT.take(7)}"
}
else if (!isReleaseBranch()) {
chartVersion += "-${env.BRANCH_NAME}"
}
return chartVersion.replaceAll("_", "-")
}
Boolean isMasterBranch() {
Boolean isMasterBranch() {
return env.BRANCH_NAME == 'master'
return env.BRANCH_NAME == 'master'
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment