...
Once KLA is installed at the Jenkins node, in order to execute Kiuwan as a stage in Jenkins Pipeline you can use next Groovy script as a basis:
- Please note that you must first generate credentials (through Jenkins' Credentials Plugin, https://plugins.jenkins.io/credentials )
...
- You can find detailed info on available Command Line Interface options of KLA at Kiuwan Local Analyzer CLI - Command Line Interface
Code Block | ||||
---|---|---|---|---|
| ||||
stage('invoke analyzer') { withCredentials([usernamePassword(credentialsId: '7e163ee4-fb62-432f-8a5e-9b04350277cf', passwordVariable: 'PASSWORD', usernameVariable: 'USERNAME')]) { def returnCode = bat(script: "${AGENT_HOME}/bin/agent.cmd -s \"${WORKSPACE}\" -n \"appPipeline\" -cr \"CR001\" -l ${BUILD_NUMBER} -wr --user \"$USERNAME\" --pass \"$PASSWORD\"", returnStatus: true) switch(returnCode){ case 0: break case 14: currentBuild.result = 'UNSTABLE' break case 1: case 10: currentBuild.result = 'FAILURE' break case 11: case 12: currentBuild.result = 'NOT_BUILT' break case 13: currentBuild.result = 'ABORTED' break default: currentBuild.result = 'NOT_BUILT' } } } |
...