|
|
|
@ -48,34 +48,39 @@ spec:
|
|
|
|
|
userRemoteConfigs: scm.userRemoteConfigs
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
def version = sh (returnStdout: true, script: "git describe --tags --long --always $GIT_COMMIT").trim()
|
|
|
|
|
def version = sh (returnStdout: true, script: "git describe --tags --long $GIT_COMMIT").trim()
|
|
|
|
|
def gitCommit = sh (returnStdout: true, script: "git rev-parse --short $GIT_COMMIT").trim()
|
|
|
|
|
echo "Version: $version"
|
|
|
|
|
echo "Git Commit: $gitCommit"
|
|
|
|
|
|
|
|
|
|
IMAGE_TAG = "--destination $IMAGE_PUSH_DESTINATION:$gitCommit "
|
|
|
|
|
|
|
|
|
|
if (GIT_BRANCH == "main") {
|
|
|
|
|
IMAGE_TAG += "--destination $IMAGE_PUSH_DESTINATION:latest "
|
|
|
|
|
|
|
|
|
|
if(version){
|
|
|
|
|
def parts = version.split('.')
|
|
|
|
|
if(parts.size() > 0){
|
|
|
|
|
for (int i = 0; i < parts.size(); i++) {
|
|
|
|
|
def versionTag = parts[0..i].join(".")
|
|
|
|
|
IMAGE_TAG += "--destination $IMAGE_PUSH_DESTINATION:$versionTag "
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
IMAGE_TAG += "--destination $IMAGE_PUSH_DESTINATION:$version "
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
IMAGE_TAG += "--destination $IMAGE_PUSH_DESTINATION:$GIT_BRANCH "
|
|
|
|
|
|
|
|
|
|
if(version){
|
|
|
|
|
def parts = version.split('.')
|
|
|
|
|
if(parts.size() > 0){
|
|
|
|
|
for (int i = 0; i < parts.size(); i++) {
|
|
|
|
|
def versionTag = parts[0..i].join(".")
|
|
|
|
|
IMAGE_TAG += "--destination $IMAGE_PUSH_DESTINATION:$GIT_BRANCH-$versionTag "
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
IMAGE_TAG += "--destination $IMAGE_PUSH_DESTINATION:$GIT_BRANCH-$version "
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
echo "Image-Tags: $IMAGE_TAG"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|