#!/usr/bin/env groovy
pipeline {
    agent any

    stages {
        stage('Test') {
            steps {
              // print the environment
              sh("printenv")

              // output for collapse setions plugin
              echo "END JENKINS SETUP"

              // run regression tests
              sh("cd test && ./test_driver.sh 4 ${env.BRANCH_NAME} ${env.CHANGE_BRANCH}")
            }
        }
    }
    post {
         always {
                 echo 'Tests Complete'
         }
         success {
                 sh("cd test && ./notify.py passed ${env.BRANCH_NAME} ${env.BUILD_URL}")
         }
         failure {
                 sh("cd test && ./notify.py failed ${env.BRANCH_NAME} ${env.BUILD_URL}")
         }
         fixed {
                 sh("cd test && ./notify.py fixed ${env.BRANCH_NAME} ${env.BUILD_URL}")
         }
    }
}
