Skip to content

Instantly share code, notes, and snippets.

@matheusvt2
Created February 28, 2020 23:05
Show Gist options
  • Save matheusvt2/49e762510a60dab5503fca170194e08c to your computer and use it in GitHub Desktop.
Save matheusvt2/49e762510a60dab5503fca170194e08c to your computer and use it in GitHub Desktop.
post example
post {//Apos o build (com ou sem erros) sempre executa esses comandos
always {
script{
if(env.ProjectEnv == "VENV"){
println "Apagando arquivos temporários..."
sh "conda remove --yes -p ${WORKSPACE}/VirtualEnv/${BUILD_TAG} --all"
sh ''' cd ${WORKSPACE}
ls -la
rm -fr *
ls -la
'''
println "Arquivos temporários apagados."
}else if(env.ProjectEnv == "DOCKER"){
println "Removendo build nome ${dockerhub}/jenkins-python-full-pipeline:${BUILD_NUMBER}"
sh "docker rmi ${dockerhub}/jenkins-python-full-pipeline:${BUILD_NUMBER}"
sh "docker logout"
}
}
}
}//Fim do post Pipeline
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment