加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

pipeline+sonar

发布时间:2020-12-14 05:03:40 所属栏目:百科 来源:网络整理
导读:前提需要在项目根目录下新建sonar-project.properties文件,内容如下: # must be unique in a given SonarQube instancesonar.projectKey =cynomys: 0.0 . 1 # this is the name and version displayed in the SonarQube UI. Was mandatory prior to SonarQ

前提需要在项目根目录下新建sonar-project.properties文件,内容如下:

# must be unique in a given SonarQube instance
sonar.projectKey=cynomys:0.0.1
# this is the name and version displayed in the SonarQube UI. Was mandatory prior to SonarQube 6.1.
sonar.projectName=cynomys
sonar.projectVersion=0.0.1

# Path is relative to the sonar-project.properties file. Replace "" by "/" on Windows.
# This property is optional if sonar.modules is set.
sonar.sources=.
sonar.exclusions=**/test/**,**/target/**

sonar.java.source=1.8
sonar.java.target=1.8

# Encoding of the source code. Default is default system encoding
sonar.sourceEncoding=UTF-8
# 项目的class文件地址 sonar.java.binaries=/root/.jenkins/workspace/e-content/e-content-controller/target/classes

?

?

pipeline脚本

node {
    maven_home=/usr/local/apache-maven-3.5.4

    stage(Pull Code){
        
        git branch: master,credentialsId: gitlab_account,url: http://10.1.193.100:8090/YTO-eCommerce/ec-commerce/e-sass/e-content.git
        
    }
    
   stage(Code Check) {
            echo "代码检查!"
         }
         
     stage(SonarQube analysis) { 
        // SonarQubeServer为系统配置的SonarQube servers的名称
        withSonarQubeEnv(SonarQubeServer) { 
          sh /usr/local/sonar-scanner-3.2.0.1227-linux/bin/sonar-scanner
          
        }
    }

   stage(Unit Test) {
         echo "单元测试 !"
      }
     

   stage(Compile) {
        echo 编译开始
        // 暂时打包报错
        sh "‘$maven_home‘/bin/mvn install"
   }

   stage(Build Images) {
        echo 敬请期待!
      
    }

    stage(Backup){
        echo 旧版本软件包已经备份
    }
    
    stage(Delete Old war){
        echo "删除老的包"
    }
    

    stage(Deploy){
       echo 部署!
       sh echo hello
    //   sh ‘scp /root/.jenkins/workspace/e-trade/e-trade-mapper/target/e-trade-mapper-1.0-SNAPSHOT.jar  [email?protected]:/home/guchen_test‘
     
    }

    stage(Integration Testing) {
          echo "敬请期待!"
       }

    stage(UI Automated Testing) {
          echo "敬请期待!"
       }

    stage(Send Testing Report) {
          echo "敬请期待!"
       }

}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读