jenkins-scripts/predeploy/Jenkinsfile

72 lines
2.6 KiB
Plaintext
Raw Normal View History

2024-08-05 18:04:29 +03:00
// 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"
2020-03-02 22:35:26 +03:00
stage ('predeploy') {
2020-03-02 22:47:41 +03:00
echo 'checking tag'
script {
2024-08-05 18:04:29 +03:00
tag = tagModule.calcTag()
echo "tag is -> ${tag}"
println "tagNoV is -> ${tagModule.getTagNoV()}"
2020-03-04 23:25:29 +03:00
def branchName = sh(returnStdout: true, script: "git rev-parse --abbrev-ref HEAD").trim()
2020-03-04 19:41:58 +03:00
if (tag) {
2024-08-05 18:04:29 +03:00
println "found tag ${tag}"
2020-09-23 23:00:31 +03:00
addBadge(
2024-03-21 10:11:04 +03:00
icon: 'completed.gif',
2020-09-23 23:00:31 +03:00
text: "Release ${tag}")
2024-08-05 18:04:29 +03:00
def tagNoV = tagModule.getTagNoV()
sh "mkdir ${tagNoV}"
sh "mv ${TARGET_FOLDER}/* ${tagNoV}"
archiveArtifacts artifacts: "${tagNoV}/*/**"
2020-03-02 22:47:41 +03:00
} else {
echo 'tag not found'
2020-09-23 23:00:31 +03:00
addBadge(
icon: 'info.gif',
text: "Сборка в master")
2024-08-05 18:04:29 +03:00
// sh "cd ${TARGET_FOLDER}; echo '${branchName}' > ${DEPLOY_VERSION_VAR}"
sh "mkdir ${branchName}"
sh "mv ${TARGET_FOLDER}/* ${branchName}"
2020-03-04 23:25:29 +03:00
// sh "cd ${TARGET_FOLDER} ; echo 'rm ${DEPLOY_VERSION_VAR}' > ${DEPLOY_VERSION_VAR}"
2024-08-05 18:04:29 +03:00
archiveArtifacts artifacts: "${TARGET_FOLDER}/*/**"
2020-03-02 22:35:26 +03:00
}
}
2020-03-02 22:47:41 +03:00
}
2020-03-02 22:35:26 +03:00
2024-08-05 18:04:29 +03:00
// stage ('archiving') {
// // Archive the build output artifacts.
// script {
// archiveArtifacts artifacts: "${TARGET_FOLDER}/*/**"
// }
// }