Skip to content
Snippets Groups Projects
Unverified Commit 73af92a4 authored by jlaura's avatar jlaura Committed by GitHub
Browse files

Adds: Jenkins file for new CI deploy. (#5037)

parent 854a7961
No related branches found
No related tags found
No related merge requests found
// vim: ft=groovy // vim: ft=groovy
def NUM_CORES = 4 def NUM_CORES = 8
def errors = [] def errors = []
def labels = ['Ubuntu'] // labels for Jenkins node types we will build on
def nodes = [:]
for (lbl in labels) { pipeline {
def label = lbl agent {
def envFile = (label == "CentOS") ? "environment_gcc4.yml" : "environment.yml" docker {
image '950438895271.dkr.ecr.us-west-2.amazonaws.com/asc-jenkins'
nodes[label] = { registryCredentialsId 'ecr:us-west-2:Jenkins-Manager-Role'
stage(label) { registryUrl 'https://950438895271.dkr.ecr.us-west-2.amazonaws.com'
isisNode(label) { args '--entrypoint= -v /astro_efs:/astro_efs'
def isisEnv = [ }
"ISISDATA=/isisData/isis_data", }
"ISISTESTDATA=/isisData/isis_testData", environment {
"ISIS3MGRSCRIPTS=/isisData/data/isis3mgr_scripts", ISISDATA = '/astro_efs/isis_data'
"MALLOC_CHECK_=1" ISISTESTDATA = '/astro_efs/isis_testData'
] MALLOC_CHECK_ = 1
PATH = "${env.WORKSPACE}/install/bin:${env.PATH}"
def cmakeFlags = [ ISISROOT = "${env.WORKSPACE}/build"
"-DJP2KFLAG=ON", KAKADU_HEADERS = '/astro_efs/kakadu_7_9'
"-DKAKADU_INCLUDE_DIR=/isisData/kakadu", }
"-Dpybindings=OFF",
"-DCMAKE_BUILD_TYPE=RELEASE" stages {
] stage('Environment Setup') {
steps {
def stageStatus = "Checking out ISIS on ${label}" sh '''
. /home/conda/mambaforge3/etc/profile.d/conda.sh > /dev/null
// Checkout echo "ISISROOT: ${ISISROOT}"
checkout scm echo "CURRENT PATH: ${PATH}"
condaEnv("isis3") { conda create -y -n isis
// Environment conda activate isis > /dev/null
loginShell """
conda config --env --set channel_alias https://conda.prod-asc.chs.usgs.gov
conda config --env --set remote_read_timeout_secs 3600
conda install -c conda-forge python=3 findutils conda install -c conda-forge python=3 findutils
conda env update -f ${envFile} --prune mamba env update -f environment.yml --prune
mkdir build install conda activate isis
""" mamba install -c conda-forge cxx-compiler git
git submodule update --init --recursive
def osFailed = false conda list
isisEnv.add("ISISROOT=${pwd()}/build") '''
isisEnv.add("PATH=${pwd()}/install/bin:${env.PATH}")
cmakeFlags.add("-DCMAKE_INSTALL_PREFIX=${pwd()}/install")
withEnv(isisEnv) {
dir(env.ISISROOT) {
// Build
stageStatus = "Building ISIS on ${label}"
try {
loginShell """
cmake -GNinja ${cmakeFlags.join(' ')} ../isis
ninja -j${NUM_CORES} install
"""
} catch(e) {
// Die right here
error stageStatus
} }
// Unit tests
stageStatus = "Running unit tests on ${label}"
try {
loginShell "ctest -R _unit_ -j${NUM_CORES} --output-on-failure"
} catch(e) {
errors.add(stageStatus)
osFailed = true
} }
stage('Build') {
// App tests environment {
stageStatus = "Running app tests on ${label}" ISIS_INSTALL_DIR = "${env.WORKSPACE}/install"
try { }
loginShell "ctest -R _app_ -j${NUM_CORES} --output-on-failure --timeout 10000" steps {
} catch(e) { sh '''
errors.add(stageStatus) . /home/conda/mambaforge3/etc/profile.d/conda.sh > /dev/null
osFailed = true conda activate isis > /dev/null
mkdir -p build install
cd build
cmake -GNinja -DJP2KFLAG=ON \
-DKAKADU_INCLUDE_DIR=${KAKADU_HEADERS} \
-Dpybindings=OFF \
-DCMAKE_BUILD_TYPE=RELEASE \
-DCMAKE_INSTALL_PREFIX=${ISIS_INSTALL_DIR} \
../isis
ninja -j 8 install
'''
} }
try {
loginShell "ctest -R _module_ -j${NUM_CORES} --output-on-failure --timeout 10000"
} catch(e) {
errors.add(stageStatus)
osFailed = true
} }
stage('GTests') {
// Gtests environment {
stageStatus = "Running gtests on ${label}" PATH = "${env.WORKSPACE}/install/bin:${env.PATH}"
try {
loginShell "ctest -R '.' -E '(_app_|_unit_|_module_)' -j${NUM_CORES} --output-on-failure --timeout 10000"
} catch(e) {
errors.add(stageStatus)
osFailed = true
}
// pytests
stageStatus = "Running pytests on ${label}"
try {
loginShell "cd $WORKSPACE/isis/pytests && pytest ."
} catch(e) {
errors.add(stageStatus)
osFailed = true
} }
steps {
if (osFailed) { catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
error "Failed on ${label}" sh '''
. /home/conda/mambaforge3/etc/profile.d/conda.sh > /dev/null
conda activate isis > /dev/null
cd build
ctest -R '.' -E '(_app_|_unit_|_module_)' -j 8 --output-on-failure --timeout 10000
'''
} }
} }
} }
stage('Unit Tests') {
environment {
PATH = "${env.WORKSPACE}/install/bin:${env.PATH}"
} }
steps {
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
sh '''
. /home/conda/mambaforge3/etc/profile.d/conda.sh > /dev/null
conda activate isis > /dev/null
cd build
ctest -R _unit_ -j 8 --output-on-failure
'''
} }
} }
} }
stage('App Tests') {
environment {
PATH = "${env.WORKSPACE}/install/bin:${env.PATH}"
}
steps {
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
sh '''
. /home/conda/mambaforge3/etc/profile.d/conda.sh > /dev/null
conda activate isis > /dev/null
cd build
ctest -R _app_ -j 8 --output-on-failure --timeout 10000
'''
}
}
}
stage('Module Tests') {
environment {
PATH = "${env.WORKSPACE}/install/bin:${env.PATH}"
}
steps {
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
sh '''
. /home/conda/mambaforge3/etc/profile.d/conda.sh > /dev/null
conda activate isis > /dev/null
cd build
ctest -R _module_ -j 8 --output-on-failure --timeout 10000
'''
}
} }
// Run the builds in parallel
node {
try {
parallel nodes
} catch(e) {
// Report result to GitHub
currentBuild.result = "FAILURE"
def comment = "Failed during:\n"
errors.each {
comment += "- ${it}\n"
} }
stage('Py Tests') {
environment {
PATH = "${env.WORKSPACE}/install/bin:${env.PATH}"
}
steps {
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
sh '''
. /home/conda/mambaforge3/etc/profile.d/conda.sh > /dev/null
conda activate isis > /dev/null
cd build
cd $WORKSPACE/isis/pytests
pytest .
setGithubStatus(comment) '''
}
}
}
stage('Deploy') {
steps {
sh '''
echo "This is where deploy would happen."
'''
}
}
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment