add a check for already existing release tag

also run cleanup in post-always Jenkinsfile block

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2019-07-29 13:28:31 -04:00 committed by Jakub
parent 9de77b21b2
commit 5f763439cb
7 changed files with 32 additions and 16 deletions

View File

@ -184,7 +184,13 @@ prepare-release: clean-release
clean-release: clean-release:
rm -rf $(RELEASE_DIR) rm -rf $(RELEASE_DIR)
release: check-existing-release:
@git ls-remote --exit-code origin "v$(RELEASE_TAG)" >/dev/null && \
echo "$(YELLOW)Release tag already exists: v$(RELEASE_TAG)$(RESET)"; \
echo "Remove the tag/release if you want to re-create it."; \
exit 1
release: check-existing-release
@read -p "Are you sure you want to create a new GitHub $(RELEASE_TYPE) against $(RELEASE_BRANCH) branch? (y/n): " REPLY; \ @read -p "Are you sure you want to create a new GitHub $(RELEASE_TYPE) against $(RELEASE_BRANCH) branch? (y/n): " REPLY; \
if [ $$REPLY = "y" ]; then \ if [ $$REPLY = "y" ]; then \
latest_tag=$$(git describe --tags `git rev-list --tags --max-count=1`); \ latest_tag=$$(git describe --tags `git rev-list --tags --max-count=1`); \

View File

@ -108,9 +108,11 @@ pipeline {
} }
} } } }
} // stage(Release) } // stage(Release)
stage('Cleanup') { steps { dir(env.STATUS_PATH) {
sh 'make clean-release'
} } } // stage(Cleanup)
} // stages } // stages
post {
always { dir(env.STATUS_PATH) {
sh 'make clean-release'
} }
}
} }

View File

@ -69,14 +69,13 @@ pipeline {
stage('Upload') { steps { script { stage('Upload') { steps { script {
env.PKG_URL = lib.uploadArtifact("pkg/${artifact}") env.PKG_URL = lib.uploadArtifact("pkg/${artifact}")
} } } } } }
stage('Cleanup') { steps { dir(env.STATUS_PATH) {
sh 'make clean'
sh "rm -fr ${dest}"
} } }
} // stages } // stages
post { post {
success { script { load("${CI_DIR}/ghcmgr.groovy").postBuild(true) } } success { script { load("${CI_DIR}/ghcmgr.groovy").postBuild(true) } }
failure { script { load("${CI_DIR}/ghcmgr.groovy").postBuild(false) } } failure { script { load("${CI_DIR}/ghcmgr.groovy").postBuild(false) } }
always { dir(env.STATUS_PATH) {
sh 'make clean'
sh "rm -fr ${dest}"
} }
} // post } // post
} // pipeline } // pipeline

View File

@ -68,8 +68,10 @@ pipeline {
} } } } } } } }
} // stages } // stages
post { post {
always { dir(env.STATUS_PATH) { sh 'make clean-docker-images' } }
success { script { load("${CI_DIR}/ghcmgr.groovy").postBuild(true) } } success { script { load("${CI_DIR}/ghcmgr.groovy").postBuild(true) } }
failure { script { load("${CI_DIR}/ghcmgr.groovy").postBuild(false) } } failure { script { load("${CI_DIR}/ghcmgr.groovy").postBuild(false) } }
always { dir(env.STATUS_PATH) {
sh 'make clean-docker-images'
} }
} // post } // post
} // pipeline } // pipeline

View File

@ -67,14 +67,13 @@ pipeline {
stage('Upload') { steps { script { stage('Upload') { steps { script {
env.PKG_URL = lib.uploadArtifact("pkg/${artifact}") env.PKG_URL = lib.uploadArtifact("pkg/${artifact}")
} } } } } }
stage('Cleanup') { steps { dir(env.STATUS_PATH) {
sh 'make clean'
sh "rm -fr ${dest}"
} } }
} // stages } // stages
post { post {
success { script { load("${CI_DIR}/ghcmgr.groovy").postBuild(true) } } success { script { load("${CI_DIR}/ghcmgr.groovy").postBuild(true) } }
failure { script { load("${CI_DIR}/ghcmgr.groovy").postBuild(false) } } failure { script { load("${CI_DIR}/ghcmgr.groovy").postBuild(false) } }
always { dir(env.STATUS_PATH) {
sh 'make clean'
sh "rm -fr ${dest}"
} }
} // post } // post
} // pipeline } // pipeline

View File

@ -67,5 +67,9 @@ pipeline {
post { post {
success { script { load("${CI_DIR}/ghcmgr.groovy").postBuild(true) } } success { script { load("${CI_DIR}/ghcmgr.groovy").postBuild(true) } }
failure { script { load("${CI_DIR}/ghcmgr.groovy").postBuild(false) } } failure { script { load("${CI_DIR}/ghcmgr.groovy").postBuild(false) } }
always { dir(env.STATUS_PATH) {
sh 'make clean'
sh "rm -fr ${dest}"
} }
} // post } // post
} // pipeline } // pipeline

View File

@ -74,5 +74,9 @@ pipeline {
post { post {
success { script { load("${CI_DIR}/ghcmgr.groovy").postBuild(true) } } success { script { load("${CI_DIR}/ghcmgr.groovy").postBuild(true) } }
failure { script { load("${CI_DIR}/ghcmgr.groovy").postBuild(false) } } failure { script { load("${CI_DIR}/ghcmgr.groovy").postBuild(false) } }
always { dir(env.STATUS_PATH) {
sh 'make clean'
sh "rm -fr ${dest}"
} }
} // post } // post
} }