Jenkinsfile 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Powered by Infostretch
  2. pipeline{
  3. agent any
  4. options {
  5. buildDiscarder(logRotator(numToKeepStr: '30'))
  6. }
  7. triggers {
  8. pollSCM('H/15 * * * *')
  9. }
  10. stages{
  11. stage ('openvpn - Checkout') {
  12. steps {
  13. checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: '', url: 'https://git.snppla.net/snppla/openvpn.git']]])
  14. }
  15. }
  16. stage ('openvpn - Build') {
  17. steps{
  18. // Shell build step
  19. sh """
  20. docker build . -t $DOCKER_REGISTRY/$DOCKER_USER/$JOB_NAME:${env.BRANCH_NAME} --pull
  21. docker login $DOCKER_REGISTRY/$DOCKER_USER -u $DOCKER_USER -p $DOCKER_PASSWORD
  22. docker push $DOCKER_REGISTRY/$DOCKER_USER/$JOB_NAME:${env.BRANCH_NAME}
  23. """
  24. }
  25. }
  26. }
  27. post {
  28. failure {
  29. mail to: "${env.ALERT_EMAIL}",
  30. subject: "Failed Pipeline: ${currentBuild.fullDisplayName}",
  31. body: "Something is wrong with ${env.BUILD_URL}"
  32. }
  33. fixed
  34. {
  35. mail to: "${env.ALERT_EMAIL}",
  36. subject: "Pipeline fixed: ${currentBuild.fullDisplayName}",
  37. body: "The pipeline was fixed with ${env.BUILD_URL}"
  38. }
  39. }
  40. }