jenkins-scripts/predeploy/Jenkinsfile
Primakov Alexandr Alexandrovich 3529316fdd
Some checks failed
platform/gitea-bro-js/jenkins-scripts/pipeline/head There was a failure building this commit
platform/bro-js/jenkins-scripts/pipeline/head There was a failure building this commit
fix predeploy no tag error
2024-08-07 23:36:29 +03:00

70 lines
2.5 KiB
Groovy

// stage ('predeploy') {
// echo 'checking tag'
// script {
// def tag = sh(returnStdout: true, script: "git tag --contains").trim()
// def branchName = sh(returnStdout: true, script: "git rev-parse --abbrev-ref HEAD").trim()
// if (tag) {
// echo 'found tag ' + tag
// addBadge(
// icon: 'completed.gif',
// text: "Release ${tag}")
// def tagNoV = tag.substring(1)
// sh "cd ${TARGET_FOLDER}; echo '${tagNoV}' > ${DEPLOY_VERSION_VAR}";
// // sh "cd ${TARGET_FOLDER} ; echo 'mkdir ${tagNoV}; mv ./${branchName}/* ./${tagNoV}; rm -r -d ./${branchName}; rm ${DEPLOY_VERSION_VAR}' > ${DEPLOY_VERSION_VAR}"
// } else {
// echo 'tag not found'
// addBadge(
// icon: 'info.gif',
// text: "Сборка в master")
// sh "cd ${TARGET_FOLDER}; echo '${branchName}' > ${DEPLOY_VERSION_VAR}"
// // sh "cd ${TARGET_FOLDER} ; echo 'rm ${DEPLOY_VERSION_VAR}' > ${DEPLOY_VERSION_VAR}"
// }
// }
// }
// stage ('archiving') {
// // Archive the build output artifacts.
// script {
// archiveArtifacts artifacts: "${TARGET_FOLDER}/*/**"
// }
// }
def tagModule = load "${JEN_FILES_TMP_NAME}/groovy/tag.groovy"
stage ('predeploy') {
echo 'checking tag'
script {
tag = tagModule.calcTag()
def branchName = sh(returnStdout: true, script: "git rev-parse --abbrev-ref HEAD").trim()
if (tag) {
println "found tag ${tag}"
addBadge(
icon: 'completed.gif',
text: "Release ${tag}")
def tagNoV = tagModule.getTagNoV()
sh "mkdir ${tagNoV}"
sh "mv ${TARGET_FOLDER}/* ${tagNoV}"
archiveArtifacts artifacts: "${tagNoV}/*/**"
} else {
echo 'tag not found'
addBadge(
icon: 'info.gif',
text: "Сборка в ${branchName}")
// sh "cd ${TARGET_FOLDER}; echo '${branchName}' > ${DEPLOY_VERSION_VAR}"
sh "mkdir ${branchName}"
sh "mv ${TARGET_FOLDER}/* ${branchName}"
// sh "cd ${TARGET_FOLDER} ; echo 'rm ${DEPLOY_VERSION_VAR}' > ${DEPLOY_VERSION_VAR}"
archiveArtifacts artifacts: "${branchName}/*/**"
}
}
}
// stage ('archiving') {
// // Archive the build output artifacts.
// script {
// archiveArtifacts artifacts: "${TARGET_FOLDER}/*/**"
// }
// }