Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

TCK:GF API integration pipeline

Revision as of 11:32, 26 June 2019 by Jan.supol.oracle.com (Talk | contribs)

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

node {
    // THE glassfish the new API to be integrated there
    env.GF_URL = "http://central.maven.org/maven2/org/glassfish/main/distributions/glassfish/5.1.0/glassfish-5.1.0.zip"
    // Job that created the API artifact
    def API_BUILD_JOB = "jenkins://./jsonb-ee4j-build"
    
    stage ("Download API artifact from the build job") {
        //https://go.cloudbees.com/docs/cloudbees-documentation/cjoc-user-guide/index.html#cluster-copy-artifacts
        dir ("download") {
            copyRemoteArtifacts(from: "${API_BUILD_JOB}")
            //flatten - could be done by copyRemoteArtifacts but mapper arg expects java class
            sh "find . -mindepth 2 -type f -print -exec mv {} . \\;"
        }
    }
    
    stage("Grab and unzip Glassfish") {
        sh '''#!/bin/bash -ex
        
            cd download
            wget -q ${GF_URL} -O glassfish.zip
            
            #unzip
            unzip -q glassfish.zip -d ${WORKSPACE}
            cd ${WORKSPACE}/glassfish5/glassfish/modules
           '''
    }

    stage ("Replace API in GF") {
        sh '''#!/bin/bash -ex
        
            cd glassfish5/glassfish/modules      
            #strip the api name of RC, SNAPSHOT, and version.
            for jarfile in ${WORKSPACE}/download/*.jar; do 
               echo $(basename $jarfile) | sed -e 's/-RC[0-9][0-9]*//' | sed -e 's/-SNAPSHOT//' | sed -e 's/\\.[0-9][0-9]*//' | sed -e 's/\\.[0-9][0-9]*//' | sed -e 's/-[0-9][0-9]*//' | while IFS= read -r gfnamejar ; do if [ -f $gfnamejar ]; then rm -v $gfnamejar; cp -v $jarfile $gfnamejar; fi; done;
            done 
            '''
    }
    
    stage("Archive the GF") {
          sh '''#!/bin/bash -ex
            cd ${WORKSPACE}
            zip -r glassfish.zip glassfish5            
           '''
           archiveArtifacts 'glassfish.zip'
    }
}

Back to the top