SHARE
TWEET

wip12-prod-wippo example script

a guest Jan 24th, 2020 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. pipeline {
  2.     agent any
  3.     environment {
  4.         SSHPASS = credentials('edmpass')
  5.     }
  6.     stages {
  7.         stage('checkout master'){
  8.             steps {
  9.                 checkout([$class: 'GitSCM',
  10.                     branches: [[name: '*/master']],
  11.                     userRemoteConfigs: [[url: 'https://github.com/wipcamp/12-wippo.git']]
  12.                 ])
  13.             }
  14.         }
  15.         stage('build production'){
  16.             options {
  17.                 timeout(time: 7, unit: 'MINUTES')
  18.             }
  19.             steps {
  20.                 catchError(buildResult: 'SUCCESS',
  21.                           message: 'yarn install got aborted. FORCED SUCCESS!') {
  22.                                 sh 'yarn'
  23.                 }
  24.                 catchError(buildResult: 'SUCCESS',
  25.                           message: 'yarn build got aborted. FORCED SUCCESS!') {
  26.                                 sh 'yarn build'
  27.                 }
  28.             }
  29.         }
  30.         stage('remove production'){
  31.             steps {
  32.                 sh """
  33.                set +x
  34.                sshpass -e ssh root@116.204.180.39 'rm -rf /var/www/12-wippo/build'
  35.                """
  36.             }
  37.         }
  38.         stage('deploy production'){
  39.             steps {
  40.                 sh """
  41.                set +x
  42.                sshpass -e scp -r build root@116.204.180.39:/var/www/12-wippo
  43.                """
  44.             }
  45.         }
  46.     }
  47.     post {
  48.         always {
  49.             deleteDir()
  50.         }
  51.         success {
  52.             echo "wip12-prod-wippo pipeline successful."
  53.         }
  54.         failure {
  55.             echo "wip12-prod-wippo pipeline failure."
  56.         }
  57.     }
  58. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top