Skip to main content
Jump to: navigation, search

TCK:TCK run pipeline

Revision as of 07:13, 21 June 2019 by Jan.supol.oracle.com (Talk | contribs) (TCK run job pipeline)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
#!/usr/bin/env groovy

node {
    // Job that created the API artifact
    def GF_BUILD_JOB = "jenkins://./GF_API_Integration_pipeline"
    def TS_JTE_BUILD_JOB = "jenkins://./TCK_JSONB_ts_jte_pipeline"
    def TCK_BUNDLE_URL = "http://download.eclipse.org/ee4j/jakartaee-tck/8.0.1/promoted/jsonbtck-1.0_latest.zip"
    def API_JAR_NAME="jakarta.json.bind-api.jar"
    
    //TCK properties
    env.deliverabledir="jsonb"
    env.TS_HOME="${env.WORKSPACE}/jsonbtck"
    env.javaee_home="${env.WORKSPACE}/glassfish5"
    
    env.ANT_VERSION='1.9.13'
    env.TOOLS_PREFIX='/opt/tools'
    env.JAVA_PREFIX="${TOOLS_PREFIX}/java/oracle"
    env.MVN_HOME="${TOOLS_PREFIX}/apache-maven/latest"
    env.JAVA_HOME="${JAVA_PREFIX}/jdk-8/latest"
    env.PATH="${MVN_HOME}/bin:${JAVA_HOME}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
    env.ANT_HOME="${TS_HOME}/tools/ant"
    env.PATH="${ANT_HOME}/bin:${PATH}"
    env.ANT_OPTS="-Djavax.xml.accessExternalSchema=all"
    
    stage("Grab GF and ts.jte artifacts") {
        //https://go.cloudbees.com/docs/cloudbees-documentation/cjoc-user-guide/index.html#cluster-copy-artifacts
        dir ("download") {
            copyRemoteArtifacts(from: "${GF_BUILD_JOB}")
            copyRemoteArtifacts(from: "${TS_JTE_BUILD_JOB}")
        }        
    }
    
    stage("Grab TCK bundle") {
        env.TCK_BUNDLE_URL = "${TCK_BUNDLE_URL}"
        sh '''#!/bin/bash -ex
            cd ${WORKSPACE}/download 
            wget -q ${TCK_BUNDLE_URL} -O ${deliverabledir}tck.zip
           '''
    }
    
    stage("Unzip TCK and GF") {
        sh '''#!/bin/bash -ex
            cd ${WORKSPACE}
            unzip -q ${WORKSPACE}/download/glassfish.zip
            unzip -q ${WORKSPACE}/download/${deliverabledir}tck.zip
           '''        
    }
    
    stage ("Grab and unzip ANT") {
        sh '''#!/bin/bash -ex
            cd ${WORKSPACE}/download
            wget -q http://mirror.koddos.net/apache/ant/binaries/apache-ant-${ANT_VERSION}-bin.tar.gz -O ant.tar.gz
            tar xfz ant.tar.gz
            mkdir -p ${ANT_HOME} && cp -a ${WORKSPACE}/download/apache-ant-${ANT_VERSION}/. ${ANT_HOME}
           '''
    }
    
    stage ("Replace ts.jte") {
        sh '''#!/bin/bash -ex
            yes | cp -rfv ${WORKSPACE}/download/ts.jte ${TS_HOME}/bin/ts.jte
           '''
    }
    
    stage("Configure TCK") {
        sh '''#!/bin/bash -ex
            cd ${TS_HOME}/bin
            ant config.vi
           '''
    }
    
    stage ("Deploy TCK tests") {
         sh '''#!/bin/bash -ex
            cd ${TS_HOME}/bin
            ant deploy.all
           '''       
    }
    
    stage ("Run TCK tests") {
         sh '''#!/bin/bash -ex
            cd ${TS_HOME}/bin
            ant run.all | tee run.log
           '''       
    } 
    
    stage ("Create summary.txt, API, and run.log artifacts") {
        sh '''#!/bin/bash -ex
            cd ${TS_HOME}/bin
            cat run.log | sed -e '1,/Completed running/d' > summary.txt
            PASSED_COUNT=`head -1 summary.txt | tail -1 | sed 's/.*=\\s\\(.*\\)/\\1/'`
            FAILED_COUNT=`head -2 summary.txt | tail -1 | sed 's/.*=\\s\\(.*\\)/\\1/'`
            ERROR_COUNT=`head -3 summary.txt | tail -1 | sed 's/.*=\\s\\(.*\\)/\\1/'`
            
            echo ERROR_COUNT=${ERROR_COUNT}
            echo FAILED_COUNT=${FAILED_COUNT}
            echo PASSED_COUNT=${PASSED_COUNT}            
           '''

        archiveArtifacts artifacts: "${env.deliverabledir}tck/bin/summary.txt", fingerprint: true
        archiveArtifacts artifacts: "${env.deliverabledir}tck/bin/run.log", fingerprint: true
        archiveArtifacts artifacts: "glassfish5/glassfish/modules/${API_JAR_NAME}", fingerprint: true
    }
}

Back to the top