本文重点是:实践[持续交付实践] 安全自动化扫描测试平台实现的技术细节
发现里面有一些细节需要注意,特发此帖予以记录

代码安全检查

注意点:



依赖安全检查

注意点:

查出的结果如下:

安全自动化

此部分目前暂时没有实现

附件

node {
    stage('Build') {
        echo 'Building....'
        checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'global_credentials', url: 'http://***/Test-myown.git']]])
        sh "mvn -DskipTests clean install package sonar:sonar"
        def mvnHome = tool 'M3'
        def gitDefault = tool 'gitDefault'
        def jdkver = tool 'jdk8'
        def mysonar = tool 'SonarQube Scanner 6.7'
        echo "---${mvnHome}/bin/mvn---"
        echo "---${gitDefault}---"
        echo "---${jdkver}---"
        echo "---${mysonar}---"
    }
    stage('SonarQube analysis') {
        echo "starting codeAnalyze with SonarQube......"
        withSonarQubeEnv {
          sh 'mvn -DskipTests clean install package org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar'
        }
    }
    stage('Quality Gate') {
        timeout(3) {
          def qg = waitForQualityGate()
            echo "---before qg:${qg.status}---"
            if (qg.status != 'OK') {
              error "未通过Sonarqube的代码质量阈检查,请及时修改!failure: ${qg.status}"
            }
            echo "---after qg:${qg.status}---"
        }
    }
    stage('Dependency Check') {
        dependencyCheckAnalyzer datadir: '', hintsFile: '', includeCsvReports: false, includeHtmlReports: true, includeJsonReports: false, includeVulnReports: true, isAutoupdateDisabled: false, outdir: '', scanpath: '', skipOnScmChange: false, skipOnUpstreamChange: false, suppressionFile: '', zipExtensions: ''
        dependencyCheckPublisher canComputeNew: false, defaultEncoding: '', failedTotalHigh: '0', healthy: '', pattern: '', unHealthy: ''
        dependencyCheckUpdateOnly()
//        dependencyTrackPublisher()--shibai失败,youchucuo有出错tishi
    }
}
node {
  stage('SCM') {
    git credentialsId: 'global_credentials', url: 'http://***/Test-myown.git'
  }
  stage('SonarQube analysis') {
    echo "starting codeAnalyze with SonarQube......"
    withSonarQubeEnv {
      sh 'mvn -DskipTests clean install package org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar'
    }
  }

  stage('Quality Gate') {
    timeout(3) {
      def qg = waitForQualityGate()
        echo "---before qg:${qg.status}---"
        if (qg.status != 'OK') {
          error "未通过Sonarqube的代码质量阈检查,请及时修改!failure: ${qg.status}"
        }
        echo "---after qg:${qg.status}---"
    }
  }


}


↙↙↙阅读原文可查看相关链接,并与作者交流