Compare commits

..

2 Commits

Author SHA1 Message Date
Ruakij 78f2d896b6 Merge branch 'dev' 11 months ago
Ruakij 1d4b59b7cc Add Jenkinsfile 11 months ago

35
Jenkinsfile vendored

@ -48,34 +48,39 @@ spec:
userRemoteConfigs: scm.userRemoteConfigs 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 "Version: $version"
echo "Git Commit: $gitCommit"
IMAGE_TAG = "--destination $IMAGE_PUSH_DESTINATION:$gitCommit "
if (GIT_BRANCH == "main") { if (GIT_BRANCH == "main") {
IMAGE_TAG += "--destination $IMAGE_PUSH_DESTINATION:latest " IMAGE_TAG += "--destination $IMAGE_PUSH_DESTINATION:latest "
def parts = version.split('.') if(version){
if(parts.size() > 0){ def parts = version.split('.')
for (int i = 0; i < parts.size(); i++) { if(parts.size() > 0){
def versionTag = parts[0..i].join(".") for (int i = 0; i < parts.size(); i++) {
IMAGE_TAG += "--destination $IMAGE_PUSH_DESTINATION:$versionTag " def versionTag = parts[0..i].join(".")
IMAGE_TAG += "--destination $IMAGE_PUSH_DESTINATION:$versionTag "
}
} }
}else {
IMAGE_TAG += "--destination $IMAGE_PUSH_DESTINATION:$version "
} }
} else { } else {
IMAGE_TAG += "--destination $IMAGE_PUSH_DESTINATION:$GIT_BRANCH " IMAGE_TAG += "--destination $IMAGE_PUSH_DESTINATION:$GIT_BRANCH "
def parts = version.split('.') if(version){
if(parts.size() > 0){ def parts = version.split('.')
for (int i = 0; i < parts.size(); i++) { if(parts.size() > 0){
def versionTag = parts[0..i].join(".") for (int i = 0; i < parts.size(); i++) {
IMAGE_TAG += "--destination $IMAGE_PUSH_DESTINATION:$GIT_BRANCH-$versionTag " 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" echo "Image-Tags: $IMAGE_TAG"
} }
} }

Loading…
Cancel
Save