1. #!groovy
    2. pipeline {
    3. agent { label 'Ebosstest01' }
    4. stages {
    5. stage('Build') {
    6. steps {
    7. sh '''
    8. export ANT_HOME=/home/apache-ant-1.7.0
    9. export PATH=$PATH:$ANT_HOME/bin
    10. export JAVA_HOME=/usr/java/jdk1.7.0_79
    11. export CLASSPATH=.:$JAVA_HOME/lib.tools.jar
    12. export PATH=$JAVA_HOME/bin:$PATH
    13. mkdir -p ${WORKSPACE}/web/lib/payment-center
    14. cp ${WORKSPACE}/web/payment-center/WebRoot/WEB-INF/lib/* ${WORKSPACE}/web/lib/payment-center
    15. cp /home/Build/payment_web/build.xml ${WORKSPACE}/web/build.xml
    16. cd ${WORKSPACE}/web/payment-center
    17. rm -rf payment-center.war
    18. cd ..
    19. ant -DBRANCH=next Init -buildfile build.xml
    20. ant -DBRANCH=next -Dibm.stream.nio=true -buildfile build.xml Compile
    21. ant -DBRANCH=next Makewar -buildfile build.xml
    22. '''
    23. }
    24. }
    25. stage('Upload') {
    26. steps {
    27. sh '''
    28. export EBOSS_Product=/home/eboss/EBOSS_Product
    29. mkdir -p ${WORKSPACE}/${JOB_NAME}/${BUILD_NUMBER}/ && find ${WORKSPACE}/web/payment-center/ -name "*.war"|xargs -i cp {} ${WORKSPACE}/${JOB_NAME}/${BUILD_NUMBER}/
    30. scp -r ${WORKSPACE}/${JOB_NAME}/${BUILD_NUMBER}/ jenkins@172.31.39.99:${EBOSS_Product}/bj_web/
    31. '''
    32. }
    33. }
    34. stage('Jacoco') {
    35. steps {
    36. echo "jacoco"
    37. jacoco execPattern: '**/jacoco.exec'
    38. }
    39. }
    40. stage('Sonarqube') {
    41. steps {
    42. sh'''
    43. export ANT_HOME=/home/apache-ant-1.7.0
    44. export PATH=$PATH:$ANT_HOME/bin
    45. export JAVA_HOME=/usr/java/jdk1.8.0_201
    46. export CLASSPATH=.:$JAVA_HOME/lib.tools.jar
    47. export PATH=$JAVA_HOME/bin:$PATH
    48. cp /home/Build/payment_web/sonar_build_eboss_payment_web.xml ${WORKSPACE}/web/sonar_build_eboss_payment_web.xml
    49. cp /home/Build/jar/*.jar ${WORKSPACE}/web/lib/payment-center
    50. cd ${WORKSPACE}/web
    51. ant -d -buildfile sonar_build_eboss_payment_web.xml
    52. '''
    53. }
    54. }
    55. stage('99to87') {
    56. steps {
    57. sh '''
    58. ssh -tt jenkins@172.31.39.99 -p 22 << remotessh
    59. scp -P 2212 -r /home/eboss/EBOSS_Product/bj_web/${BUILD_NUMBER}/ autoapp@172.31.39.99:/ebosshome/eboss/ansible_zhipinku/payment/backs
    60. exit
    61. remotessh
    62. '''
    63. }
    64. }
    65. stage('87to85') {
    66. steps {
    67. sh '''
    68. ssh -tt autoapp@172.31.39.99 -p 2212 << remotessh
    69. cd /ebosshome/eboss/ansible_zhipinku/payment/backs/${BUILD_NUMBER}/
    70. unzip -oq payment-center.war -d payment-center
    71. 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/"
    72. ansible test -m shell -a "bash /data01/ebosshome/eboss/payment-new/tongweb5.0/bin/check.sh"
    73. exit
    74. remotessh
    75. '''
    76. }
    77. }
    78. }
    79. }