Rate This Document
Findability
Accuracy
Completeness
Readability

Jenkins Pipeline Sample Code

The sample code is as follows:

stage('code-inspector') {
    steps {
        echo '====== Specification check ======'
        sh '''
            export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-11.0.19.7-0.oe2203sp2.aarch64
            /home/c_demo/code-inspector-1.0.0/bin/code-inspector /home/test/ -o output.json
        '''
    }
    post {
      failure {
        archiveArtifacts 'output.json'
      }
      success {
        archiveArtifacts 'output.json'
      }
    }
}
  • You are advised to perform code specification checks before the build process.
  • /usr/lib/jvm/java-11-openjdk-11.0.19.7-0.oe2203sp2.aarch64 specifies the JDK installation path. Replace it with the actual path.
  • /home/c_demo/code-inspector-1.0.0/bin/code-inspector specifies the full path to the Code Inspector. Replace it with the actual path.
  • /home/test/ specifies the path for code specification scanning. Replace it with the actual path.