Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
operator
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
devops
operator
Compare revisions
9c6fe57a6cebd504bc1f8fbb24f686f8d7824384 to 9c5534fbe3fa7485e2ba86a2b1915d0aefb734db
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
ozg-cloud/devops/operator
Select target project
No results found
9c5534fbe3fa7485e2ba86a2b1915d0aefb734db
Select Git revision
Swap
Target
ozg-cloud/devops/operator
Select target project
ozg-cloud/devops/operator
1 result
9c6fe57a6cebd504bc1f8fbb24f686f8d7824384
Select Git revision
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (2)
OZG-7922 update versions
· b3b0dc73
Martin
authored
2 months ago
b3b0dc73
OZG-7922 adjust image tag generation
· 9c5534fb
Martin
authored
2 months ago
9c5534fb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Jenkinsfile
+24
-24
24 additions, 24 deletions
Jenkinsfile
pom.xml
+2
-2
2 additions, 2 deletions
pom.xml
with
26 additions
and
26 deletions
Jenkinsfile
View file @
9c5534fb
...
...
@@ -80,7 +80,7 @@ pipeline {
steps
{
script
{
FAILED_STAGE
=
env
.
STAGE_NAME
JAR_TAG
=
getPomVersion
(
'pom.xml'
).
replace
(
"SNAPSHOT"
,
"${env.BRANCH_NAME}-SNAPSHOT"
)
JAR_TAG
=
getPomVersion
().
replace
(
"SNAPSHOT"
,
"${env.BRANCH_NAME}-SNAPSHOT"
)
}
configFileProvider
([
configFile
(
fileId:
'maven-settings'
,
variable:
'MAVEN_SETTINGS'
)])
{
sh
"mvn -s $MAVEN_SETTINGS versions:set -DnewVersion=${JAR_TAG} -DprocessAllModules=true"
...
...
@@ -166,7 +166,7 @@ pipeline {
steps
{
script
{
FAILED_STAGE
=
env
.
STAGE_NAME
HELM_CHART_VERSION
=
generate
HelmChartVersion
()
HELM_CHART_VERSION
=
generate
ImageTag
()
;
testAndDeployKeycloakHelmChart
(
HELM_CHART_VERSION
)
}
...
...
@@ -177,7 +177,7 @@ pipeline {
steps
{
script
{
FAILED_STAGE
=
env
.
STAGE_NAME
HELM_CHART_VERSION
=
generate
HelmChartVersion
()
HELM_CHART_VERSION
=
generate
ImageTag
()
testAndDeployElasticsearchHelmChart
(
HELM_CHART_VERSION
)
}
...
...
@@ -259,19 +259,6 @@ String getHelmRepoUrl(){
return
"https://nexus.ozg-sh.de/service/rest/v1/components?repository=ozg-base-apps-snapshot"
}
String
generateHelmChartVersion
()
{
def
chartVersion
=
getPomVersion
(
'pom.xml'
)
if
(
isMainBranch
())
{
chartVersion
+=
"-${env.GIT_COMMIT.take(7)}"
}
else
if
(!
isReleaseBranch
())
{
chartVersion
+=
"-${env.BRANCH_NAME}"
}
return
chartVersion
.
replaceAll
(
'_'
,
'-'
)
}
Boolean
isMainBranch
()
{
return
env
.
BRANCH_NAME
==
'main'
}
...
...
@@ -370,20 +357,33 @@ Void tagAndPushDockerImage(String imageName, String newTag){
}
}
String
getPomVersion
(
String
pomFile
){
def
pom
=
readMavenPom
file:
pomFile
String
generateImageTag
()
{
if
(
isReleaseBranch
())
{
return
getPomVersion
()
}
return
"${getPomVersion()}-${validateBranchName(env.BRANCH_NAME)}${getCommitHash()}"
.
replaceAll
(
"_"
,
"-"
)
}
String
getPomVersion
(){
def
pom
=
readMavenPom
file:
'pom.xml'
return
pom
.
version
}
String
generateImageTag
()
{
def
imageTag
=
"${env.BRANCH_NAME}-${getPomVersion('pom.xml')}"
if
(
env
.
BRANCH_NAME
==
'main'
)
{
imageTag
+=
"-${env.GIT_COMMIT.take(7)}"
String
validateBranchName
(
branchName
)
{
int
maxLength
=
20
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."
}
return
branchName
}
return
imageTag
String
getCommitHash
()
{
return
"-${env.GIT_COMMIT.take(7)}"
;
}
String
getParentPomVersion
(
String
filePath
)
{
...
...
This diff is collapsed.
Click to expand it.
pom.xml
View file @
9c5534fb
...
...
@@ -48,13 +48,13 @@
</modules>
<properties>
<operator-sdk.version>
5.
4.1
</operator-sdk.version>
<operator-sdk.version>
5.
6.0
</operator-sdk.version>
<!-- tools -->
<reflections.version>
0.10.2
</reflections.version>
<validation-api.version>
2.0.1.Final
</validation-api.version>
<!-- test -->
<kubernetes-server-mock.version>
6.13.
4
</kubernetes-server-mock.version>
<kubernetes-server-mock.version>
6.13.
5
</kubernetes-server-mock.version>
<io.javaoperatorsdk.version>
0.9.7
</io.javaoperatorsdk.version>
<!-- plugin -->
...
...
This diff is collapsed.
Click to expand it.