Thu Jan 18 2018
Copied to clipboard! Copy reply
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
#!/usr/bin/env groovy

@Library('jenkins-shared-library')
import com.rosettastone.JenkinsShared

pipeline {
  agent { label 'needsSeriousRam' }
  options {
    buildDiscarder(logRotator(numToKeepStr: '25'))
  }
  stages {
    stage('merge_in_master') {
      steps {
        setupApp(appName: 'zoom', defaultHipchatRoom: 'Zoom')
        mergeInMaster()
      }
    }
    stage('commit_stage') {
      steps {


        // standard buildApp, but not using a node and stashing public
        timestamps {
          deleteDir()
          checkout scm
          script {
            try {
              def SHOULD_SKIP_E2E_TESTS = sh (script: "git log -1 | grep '\\[ci e2e skip\\]'", returnStatus: true)
              def SHOULD_SKIP_UNIT_TESTS = sh (script: "git log -1 | grep '\\[ci unit skip\\]'", returnStatus: true)
              sh "bash -c \"export SHOULD_SKIP_E2E_TESTS=${SHOULD_SKIP_E2E_TESTS} && export SHOULD_SKIP_UNIT_TESTS=${SHOULD_SKIP_UNIT_TESTS} && bin/ci\""
              stash name: 'public', includes: 'public/**'
            } finally {
              junit 'test/reports/*.xml'
            }
          }
        }
      }
      post {
        always {
          archiveArtifacts allowEmptyArchive: true, artifacts: 'test/screenshots/**/*.png'
        }
      }
    }
    stage('deploy_to_test') {
      steps {
        deleteDir()
        unstash 'public'
        sh "ssh deploy@opxdev.lan.flt 'mkdir -p /usr/website/content/resources.rosettastone.com/rs/zoom/builds'"
        sh "ssh deploy@opxdev.lan.flt 'mkdir -p /usr/website/content/resources.rosettastone.com/rs/zoom/feature'"
        sh "ssh deploy@opxdev.lan.flt 'mkdir -p /usr/website/content/resources.rosettastone.com/rs/zoom/releases'"
        // sh "ssh deploy@opxdev.lan.flt 'mkdir -p /usr/website/content/resources.rosettastone.com/rs/zoom/storybook'"
        sh "rsync -auvz ./public/ deploy@opxdev.lan.flt:/usr/website/content/resources.rosettastone.com/rs/zoom/builds/${BUILD_TAG}"
        // sh "rsync -auvz ./storybook-static/ deploy@opxdev.lan.flt:/usr/website/content/resources.rosettastone.com/rs/zoom/storybook/${BUILD_TAG}"
        sh "ssh deploy@opxdev.lan.flt 'ln -nsf /usr/website/content/resources.rosettastone.com/rs/zoom/builds/${BUILD_TAG} /usr/website/content/resources.rosettastone.com/rs/zoom/${BRANCH_NAME}'"
      }
    }

    stage('community_integration_tests') {
      steps {
        timestamps {
          deleteDir()
          checkout scm

          script {
            try {
              def SHOULD_SKIP_E2E_TESTS = sh (script: "git log -1 | grep '\\[ci e2e skip\\]'", returnStatus: true)
              def SHOULD_SKIP_UNIT_TESTS = sh (script: "git log -1 | grep '\\[ci unit skip\\]'", returnStatus: true)
              sh "bash -c \"export SHOULD_SKIP_E2E_TESTS=${SHOULD_SKIP_E2E_TESTS} && export SHOULD_SKIP_UNIT_TESTS=${SHOULD_SKIP_UNIT_TESTS} && bin/ci-acceptance\""
            } finally {
              junit 'test/reports/*.xml'
            }
          }
        }
      }
      post {
        always {
          archiveArtifacts allowEmptyArchive: true, artifacts: 'test/screenshots/**/*.png'
        }
      }
    }

    stage('dev_deploy') {
      when {
        branch 'master'
      }
      steps {
        sh "ssh deploy@opxdev.lan.flt 'cp -r /usr/website/content/resources.rosettastone.com/rs/zoom/builds/${BUILD_TAG} /usr/website/content/resources.rosettastone.com/rs/zoom/releases/${BUILD_NUMBER}'"
        sh "curl https://totale-dev.dev.rosettastone.com/api/config/update_zoom_release?branch_name=releases/${BUILD_NUMBER}"
      }
    }

    stage('merge_back') {
      when {
        branch 'master'
      }
      steps {
        echo 'take the version we just deployed and merge it into all active feature branches, where active feature branches include those with open pull requests'
        mergeMasterToAllActiveBranches()
      }
    }

  }
  post {
    always {
      sendNotificationOnFailureAndBackToNormal()
      postProcessBuild(processTestResults: false)
    }
  }
}