Commit 1f4fb597 authored by Kelvin Rodriguez's avatar Kelvin Rodriguez Committed by Jesse Mapel
Browse files

Jenkins Build Script update (#3533)

* Updated pipeline to use TestPreferences where necessary

* Updated pipeline truth data

* Made preference parameter position consistant

* Updated pipeline truth data again

* Jenkins

* Jenkins

* Jenkins

* Jenkins

* Jenkins

* Jenkins

* Jenkins

* Jenkins

* Jenkins

* Jenkins

* Jenkins

* Jenkins

* Jenkins

* Jenkins

* Jenkins

* Jenkins

* Jenkins

* Jenkins

* Jenkins

* Jenkins

* Jenkins

* Jenkins

* Jenkins

* Jenkins

* Jenkins

* Jenkins

* Jenkins

* Jenkins

* Jenkins

* Jenkins

* Jenkins

* Jenkins

* Jenkins

* Jenkins

* Jenkins

* Jenkins

* Jenkins

* Jenkins

* Jenkins

* Jenkins

* Jenkins

* Jenkins

* Jenkins

* Changed testing avoid which failure

* Removed echo

* Pointed at install bin instead of build bin

* Added a forgotten /

* Added the actual install directory

* Changed isisroot to point to install directory

* More tweeks to the groovy script

* Removed conda prefix echo

* Moved path update to a single line

* new groove

* new groove

* new groove

* new groove

* new groove

* Updated spice rotation test with isis variable

* Testing with appjit

* Only testing app jit

* Changed app test to -R

* More messing with stuffs

* Added check for catlab

* Changed install directory location

* Changed paths again

* Echoed pwd in checkout

* Retry the print

* Pathing one more time

* Paths

* updated build.groovy

* Update Jenkinsfile (#3525)

* Update Jenkinsfile

* Update Jenkinsfile

* Update Jenkinsfile

* Update Jenkinsfile

* Update Jenkinsfile

* Update Jenkinsfile

* Update Jenkinsfile

* Update Jenkinsfile

* Update Jenkinsfile

* Update Jenkinsfile

* Update Jenkinsfile

* Update Jenkinsfile

* Update Jenkinsfile

* Update Jenkinsfile

* Update Jenkinsfile

* Update Jenkinsfile

* Update Jenkinsfile

* Update Jenkinsfile

* Update Jenkinsfile

* Update Jenkinsfile

* Update Jenkinsfile
parent 5e324a4a
Loading
Loading
Loading
Loading
+40 −24
Original line number Diff line number Diff line
node {
    withEnv(["ISISROOT=" + "${workspace}" + "/build/", "ISIS3TESTDATA=/usgs/cpkgs/isis3/testData/", "ISIS3DATA=/usgs/cpkgs/isis3/data/"]) {
        stage ("Checkout") {
            checkout scm
            sh 'git clone https://github.com/abseil/googletest.git gtest'
        }
// vim: ft=groovy

        stage ("Build") {
            conda config --prepend channels anaconda
            conda config --append channels conda-forge
            conda config --append channels usgs-astrogeology
            conda config --prepend default_channels anaconda
            conda env create -n isis3 -f environment.yml
            source activate isis3
            mkdir -p ./install ./build && cd build
            cmake -GNinja -DJP2KFLAG=OFF -Dpybindings=OFF -DCMAKE_INSTALL_PREFIX=../install -Disis3Data=/usgs/cpkgs/isis3/data -Disis3TestData=/usgs/cpkgs/isis3/testData ../isis
pipeline 
{
    agent any
    stages
    {
        stage('CI')
        {
            parallel
            {
                stage('Mac')
                {
                    agent{ label 'mac'}
                    steps{
                        build 'ISIS-Builds/Mac'
                    }
                }
                stage('CentOS')
                {
                    steps
                    {
                        build 'ISIS-Builds/CentOS'
                    }
                }
                stage('Fedora')
                {
                    steps
                    {
                        build 'ISIS-Builds/Fedora'
                    }
               
       stage("Test") {
            set +e
            ninja -j8 && ninja install
            source /usgs/cpkgs/isis3/isis3mgr_scripts/initIsisCmake.sh .
            ctest -V -R _unit_ --timeout 500
            ctest -V -R _app_ --timeout 500
            ctest -V -R _module_ --timeout 500
                }
                stage('Ubuntu')
                {
                    steps
                    {
                        build 'ISIS-Builds/Ubuntu'
                    }
                }
            }
        }
    }
}

build.groovy

0 → 100644
+232 −0
Original line number Diff line number Diff line
// vim: ft=groovy

def isisDataPath = '/isisData/data'

def isisMgrScripts = '/isisData/data/isis3mgr_scripts'

def isisTestDataPath = "/isisData/testData"

def isisEnv = [
    "ISIS3DATA=${isisDataPath}",
    "ISIS3TESTDATA=${isisTestDataPath}",
    "ISIS3MGRSCRIPTS=${isisMgrScripts}"
]

def cmakeFlags = [
    "-DJP2KFLAG=OFF",
    "-Dpybindings=OFF",
    "-DCMAKE_BUILD_TYPE=RELEASE"
]

def build_ok = true
def errors = []

// Helpers for setting commit status
def getRepoUrl() {
    return sh(script: "git config --get remote.origin.url", returnStdout: true).trim()
}

def getCommitSha() {
    return sh(script: "git rev-parse HEAD", returnStdout: true).trim()
}

def setGitHubBuildStatus(status) {
    def repoUrl = getRepoUrl()
    def commitSha = getCommitSha()

    step([
        $class: 'GitHubCommitStatusSetter',
        reposSource: [$class: "ManuallyEnteredRepositorySource", url: repoUrl],
        commitShaSource: [$class: "ManuallyEnteredShaSource", sha: commitSha],
        errorHandlers: [[$class: 'ShallowAnyErrorHandler']],
        statusResultSource: [
          $class: 'ConditionalStatusResultSource',
          results: [
            [$class: 'BetterThanOrEqualBuildResult', result: 'SUCCESS', state: 'SUCCESS', message: status],
            [$class: 'BetterThanOrEqualBuildResult', result: 'FAILURE', state: 'FAILURE', message: status],
            [$class: 'AnyBuildResult', state: 'FAILURE', message: 'Loophole']
          ]
        ]
    ])
}

node("${env.OS.toLowerCase()}") {
    stage ("Checkout") {
        env.STAGE_STATUS = "Checking out ISIS"
        checkout scm
        isisEnv.add("ISISROOT=${pwd()}/build")
        cmakeFlags.add("-DCMAKE_INSTALL_PREFIX=${pwd()}/install")
    }

    stage("Create environment") {
        env.STAGE_STATUS = "Creating conda environment"
        sh '''
            # Use the conda cache running on the Jenkins host
            conda config --set channel_alias http://dmz-jenkins.wr.usgs.gov
            conda config --set always_yes True
            conda create -n isis python=3
        '''

        if (env.OS.toLowerCase() == "centos") {
            sh 'conda env update -n isis -f environment_gcc4.yml --prune'
        } else {
            sh 'conda env update -n isis -f environment.yml --prune'
        }
    }

    withEnv(isisEnv) {
        dir("${env.ISISROOT}") {
            try {
                stage ("Build") {
                    env.STAGE_STATUS = "Building ISIS on ${env.OS}"
                    sh """
                        source activate isis
                        echo `ls ../`
                        echo `pwd`
                        cmake -GNinja ${cmakeFlags.join(' ')} ../isis
                        ninja -j4 install
                        python ../isis/scripts/isis3VarInit.py --data-dir ${env.ISIS3DATA} --test-dir ${env.ISIS3TESTDATA}
                    """
                }
            }
            catch(e) {
                build_ok = false
                errors.add(env.STAGE_STATUS)
                println e.toString()
            }

            if (build_ok) {

                try{
                    stage("UnitTests") {
                        dir("${env.ISISROOT}") {
                            env.STAGE_STATUS = "Running unit tests on ${env.OS}"
                                sh """
                                    source activate isis
                                    echo $ISIS3TESTDATA
                                    echo $ISIS3DATA

                                    # environment variables
                                    export ISISROOT=${env.ISISROOT}
                                    export ISIS3TESTDATA="/isisData/testData"
                                    export ISIS3DATA="/isisData/data"
                                    export PATH=`pwd`/../install/bin:/home/jenkins/.conda/envs/isis/bin:$PATH

                                    automos -HELP
                                    catlab -HELP
                                    tabledump -HELP

                                    ctest -R _unit_ -j4 -VV
                                    source deactivate
                                """

                        }
                    }
                }
                catch(e) {
                    build_ok = false
                    echo e.toString()
                }

                try{
                    stage("AppTests") {
                        env.STAGE_STATUS = "Running app tests on ${env.OS}"
                        sh """
                            source activate isis
                            echo $ISIS3TESTDATA
                            echo $ISIS3DATA
                            echo $PATH

                            # environment variables
                            export ISISROOT=${env.ISISROOT}
                            export ISIS3TESTDATA="/isisData/testData"
                            export ISIS3DATA='/isisData/data'
                            export PATH=`pwd`/../install/bin:/home/jenkins/.conda/envs/isis/bin:$PATH

                            catlab -HELP
                            tabledump -HELP

                            ctest -R _app_ -j4 -VV
                            source deactivate

                        """
                    }
                }
                catch(e) {
                    build_ok = false
                    errors.add(env.STAGE_STATUS)
                    println e.toString()
                }

                try{
                    stage("ModuleTests") {
                        env.STAGE_STATUS = "Running module tests on ${env.OS}"
                        sh """
                            source activate isis
                            echo $ISIS3TESTDATA
                            echo $ISIS3DATA
                            echo $PATH

                            # environment variables
                            export ISISROOT=${env.ISISROOT}
                            export ISIS3TESTDATA="/isisData/testData"
                            export ISIS3DATA='/isisData/data'
                            export PATH=`pwd`/../install/bin:/home/jenkins/.conda/envs/isis/bin:$PATH

                            catlab -HELP
                            tabledump -HELP

                            ctest -R _module_ -j4 -VV
                            source deactivate

                        """
                    }
                }
                catch(e) {
                    build_ok = false
                    errors.add(env.STAGE_STATUS)
                    println e.toString()
                }

                try{
                    stage("GTests") {
                        env.STAGE_STATUS = "Running gtests on ${env.OS}"
                        sh """
                            source activate isis
                            echo $ISIS3TESTDATA
                            echo $ISIS3DATA
                            echo $PATH

                            # environment variables
                            export ISISROOT=${env.ISISROOT}
                            export ISIS3TESTDATA="/isisData/testData"
                            export ISIS3DATA='/isisData/data'
                            export PATH=`pwd`/../install/bin:/home/jenkins/.conda/envs/isis/bin:$PATH

                            ctest -R "." -E "(_app_|_unit_|_module_)" -j4 -VV
                            source deactivate

                        """
                    }
                }
                catch(e) {
                    build_ok = false
                    errors.add(env.STAGE_STATUS)
                    println e.toString()
                }
            }
        }

        if(build_ok) {
            currentBuild.result = "SUCCESS"
        }
        else {
            currentBuild.result = "FAILURE"
            def comment = "Failed during:\n"
            errors.each {
                comment += "- ${it}\n"
            }
            setGitHubBuildStatus(comment)
        }
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ int main(int argc, char *argv[]) {
  QString mocbc(dir + "moc.bc");
  QString mocbsp(dir + "moc.bsp");
  QString de(dir + "de405.bsp");
  QString pck("/usgs/cpkgs/isis3/data/base/kernels/pck/pck00009.tpc");
  QString pck(dir + "../../kernels/pck/pck00009.tpc");
  QString cgFK(dir + "ROS_V29.TF");
  QString cgCK(dir + "CATT_DV_145_02_______00216.BC");
  //QString mocadd(dir+"mocAddendum.ti");