Blame .cico.pipeline

Pierre-Yves Chibon d637dc
def onmyduffynode(script){
Pierre-Yves Chibon d637dc
    ansiColor('xterm'){
Pierre-Yves Chibon d637dc
        timestamps{
Pierre-Yves Chibon d637dc
            sh 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -l root ${DUFFY_NODE}.ci.centos.org -t "' + script + '"'
Pierre-Yves Chibon d637dc
        }
Pierre-Yves Chibon d637dc
    }
Pierre-Yves Chibon d637dc
}
Pierre-Yves Chibon d637dc
Pierre-Yves Chibon d637dc
def syncfromduffynode(rsyncpath){
Pierre-Yves Chibon d637dc
    sh 'rsync -e "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -l root " -Ha --include=' +  rsyncpath +  " ${DUFFY_NODE}.ci.centos.org:~/ ./"
Pierre-Yves Chibon d637dc
}
Pierre-Yves Chibon d637dc
Pierre-Yves Chibon d637dc
node('pagure') {
Pierre-Yves Chibon d637dc
Pierre-Yves Chibon d637dc
    stage('Allocate Node'){
Pierre-Yves Chibon d637dc
        env.CICO_API_KEY = readFile("${env.HOME}/duffy.key").trim()
Pierre-Yves Chibon d637dc
        duffy_rtn=sh(
Pierre-Yves Chibon d637dc
            script: 'cico --debug node get -f value -c hostname -c comment',
Pierre-Yves Chibon d637dc
            returnStdout: true
Pierre-Yves Chibon d637dc
            ).trim().tokenize(' ')
Pierre-Yves Chibon d637dc
        env.DUFFY_NODE=duffy_rtn[0]
Pierre-Yves Chibon d637dc
        env.SSID=duffy_rtn[1]
Pierre-Yves Chibon d637dc
    }
Pierre-Yves Chibon d637dc
Pierre-Yves Chibon d637dc
    try {
Pierre-Yves Chibon d637dc
        stage('Pre Setup Node'){
Pierre-Yves Chibon d637dc
            // Install EPEL
Pierre-Yves Chibon d637dc
            onmyduffynode 'yum -y install epel-release'
Pierre-Yves Chibon d637dc
        }
Pierre-Yves Chibon d637dc
Pierre-Yves Chibon d637dc
        stage('Clone Test Suite') {
Pierre-Yves Chibon d637dc
            onmyduffynode "git clone -b \"${env.BRANCH_NAME}\" --single-branch --depth 1 https://pagure.io/pagure.git"
Pierre-Yves Chibon d637dc
        }
Pierre-Yves Chibon d637dc
Pierre-Yves Chibon d637dc
        stage('Run Test Suite') {
Pierre-Yves Chibon d637dc
            timeout(6, 'HOURS') {
Pierre-Yves Chibon d637dc
                onmyduffynode 'cd pagure && sh ./run_ci_tests.sh'
Pierre-Yves Chibon d637dc
            }
Pierre-Yves Chibon d637dc
        }
Pierre-Yves Chibon d637dc
Pierre-Yves Chibon d637dc
    } catch (e) {
Pierre-Yves Chibon d637dc
        currentBuild.result = "FAILED"
Pierre-Yves Chibon d637dc
        throw e
Pierre-Yves Chibon d637dc
    } finally {
Pierre-Yves Chibon d637dc
        stage('Deallocate Node'){
Pierre-Yves Chibon d637dc
            sh 'cico node done ${SSID}'
Pierre-Yves Chibon d637dc
        }
Pierre-Yves Chibon d637dc
    }
Pierre-Yves Chibon d637dc
}