#!groovy
pipeline {
agent { label 'Ebosstest01' }
stages {
stage('Build') {
steps {
sh '''
export ANT_HOME=/home/apache-ant-1.7.0
export PATH=$PATH:$ANT_HOME/bin
export JAVA_HOME=/usr/java/jdk1.7.0_79
export CLASSPATH=.:$JAVA_HOME/lib.tools.jar
export PATH=$JAVA_HOME/bin:$PATH
mkdir -p ${WORKSPACE}/web/lib/payment-center
cp ${WORKSPACE}/web/payment-center/WebRoot/WEB-INF/lib/* ${WORKSPACE}/web/lib/payment-center
cp /home/Build/payment_web/build.xml ${WORKSPACE}/web/build.xml
cd ${WORKSPACE}/web/payment-center
rm -rf payment-center.war
cd ..
ant -DBRANCH=next Init -buildfile build.xml
ant -DBRANCH=next -Dibm.stream.nio=true -buildfile build.xml Compile
ant -DBRANCH=next Makewar -buildfile build.xml
'''
}
}
stage('Upload') {
steps {
sh '''
export EBOSS_Product=/home/eboss/EBOSS_Product
mkdir -p ${WORKSPACE}/${JOB_NAME}/${BUILD_NUMBER}/ && find ${WORKSPACE}/web/payment-center/ -name "*.war"|xargs -i cp {} ${WORKSPACE}/${JOB_NAME}/${BUILD_NUMBER}/
scp -r ${WORKSPACE}/${JOB_NAME}/${BUILD_NUMBER}/ jenkins@172.31.39.99:${EBOSS_Product}/bj_web/
'''
}
}
stage('Jacoco') {
steps {
echo "jacoco"
jacoco execPattern: '**/jacoco.exec'
}
}
stage('Sonarqube') {
steps {
sh'''
export ANT_HOME=/home/apache-ant-1.7.0
export PATH=$PATH:$ANT_HOME/bin
export JAVA_HOME=/usr/java/jdk1.8.0_201
export CLASSPATH=.:$JAVA_HOME/lib.tools.jar
export PATH=$JAVA_HOME/bin:$PATH
cp /home/Build/payment_web/sonar_build_eboss_payment_web.xml ${WORKSPACE}/web/sonar_build_eboss_payment_web.xml
cp /home/Build/jar/*.jar ${WORKSPACE}/web/lib/payment-center
cd ${WORKSPACE}/web
ant -d -buildfile sonar_build_eboss_payment_web.xml
'''
}
}
stage('99to87') {
steps {
sh '''
ssh -tt jenkins@172.31.39.99 -p 22 << remotessh
scp -P 2212 -r /home/eboss/EBOSS_Product/bj_web/${BUILD_NUMBER}/ autoapp@172.31.39.99:/ebosshome/eboss/ansible_zhipinku/payment/backs
exit
remotessh
'''
}
}
stage('87to85') {
steps {
sh '''
ssh -tt autoapp@172.31.39.99 -p 2212 << remotessh
cd /ebosshome/eboss/ansible_zhipinku/payment/backs/${BUILD_NUMBER}/
unzip -oq payment-center.war -d payment-center
ansible test -m synchronize -a "src=/ebosshome/eboss/ansible_zhipinku/payment/backs/${BUILD_NUMBER}/payment-center/ dest=/data01/ebosshome/eboss/payment-new/tongweb5.0/deployment/modules/test/"
ansible test -m shell -a "bash /data01/ebosshome/eboss/payment-new/tongweb5.0/bin/check.sh"
exit
remotessh
'''
}
}
}
}