@@ -12,13 +12,15 @@ library("ods-jenkins-shared-library@${odsGitRef}")
1212odsComponentPipeline(
1313 imageStreamTag : " ${ odsNamespace} /jenkins-agent-maven:${ odsImageTag} " ,
1414 branchToEnvironmentMapping : [
15- ' *' : ' dev' ,
15+ ' *' : ' dev' ,
1616 " ${ odsGitRef} " : ' test'
17- ]
17+ ],
18+ debug : true
1819) { context ->
1920 stageBuild(context)
2021 odsComponentStageScanWithSonar(context, [branch : ' *' ])
2122 odsComponentStageBuildOpenShiftImage(context)
23+ stageCreatedImageTagLatest(context)
2224}
2325
2426def stageBuild (def context ) {
@@ -40,6 +42,7 @@ def stageBuild(def context) {
4042
4143 def status = sh(
4244 script : " ./gradlew clean test shadowJar --stacktrace --no-daemon" ,
45+ label : " gradle build" ,
4346 returnStatus : true
4447 )
4548 if (status != 0 ) {
@@ -48,6 +51,7 @@ def stageBuild(def context) {
4851
4952 status = sh(
5053 script : " cp build/libs/*-all.jar ./docker/app.jar" ,
54+ label : " copy resources into docker context" ,
5155 returnStatus : true
5256 )
5357 if (status != 0 ) {
@@ -56,3 +60,13 @@ def stageBuild(def context) {
5660 }
5761 }
5862}
63+
64+ def stageCreatedImageTagLatest (def context ) {
65+ stage(' Tag created image' ) {
66+ def targetImageTag = context. gitBranch. replace(' /' ,' _' ). replace(' -' ,' _' )
67+ sh(
68+ script : " oc -n ${ context.targetProject} tag ${ context.componentId} :${ context.shortGitCommit} ${ context.componentId} :${ targetImageTag} " ,
69+ label : " Set tag '${ targetImageTag} ' on is/${ context.componentId} "
70+ )
71+ }
72+ }
0 commit comments