github.com/jaylevin/jenkins-library@v1.230.4/documentation/docs/steps/gctsExecuteABAPQualityChecks.md (about) 1 # ${docGenStepName} 2 3 ## ${docGenDescription} 4 5 ## Prerequisites 6 7 * [ATC](https://help.sap.com/viewer/ba879a6e2ea04d9bb94c7ccd7cdac446/latest/en-US/62c41ad841554516bb06fb3620540e47.html) checks are enabled in transaction ATC in the ABAP systems where you want to use the step. 8 * [ABAP Unit tests](https://help.sap.com/viewer/ba879a6e2ea04d9bb94c7ccd7cdac446/latest/en-US/491cfd8926bc14cde10000000a42189b.html) are available for the source code that you want to check. Note: Do not execute unit tests in client 000, and not in your production client. 9 * [gCTS](https://help.sap.com/viewer/4a368c163b08418890a406d413933ba7/latest/en-US/26c9c6c5a89244cb9506c253d36c3fda.html) is available and configured in the ABAP systems where you want to use the step. 10 * If you want to use environmental variables as parameters, for example, `GIT_COMMIT`: The [Git Plugin](https://plugins.jenkins.io/git/) is installed in Jenkins. 11 * The [Warnings-Next-Generation](https://plugins.jenkins.io/warnings-ng/) Plugin is installed in Jenkins. 12 13 ## ${docGenParameters} 14 15 ## ${docGenConfiguration} 16 17 ## ${docJenkinsPluginDependencies} 18 19 ## Example 20 21 Example configuration for the use in a Jenkinsfile. 22 23 ```groovy 24 gctsExecuteABAPQualityChecks( 25 script: this, 26 host: 'https://abap.server.com:port', 27 client: '000', 28 abapCredentialsId: 'ABAPUserPasswordCredentialsId', 29 repository: 'myrepo', 30 scope: 'remoteChangedObjects', 31 commit: "${env.GIT_COMMIT}", 32 workspace: "${WORKSPACE}" 33 34 ) 35 ``` 36 37 Example configuration for the use in a .yaml config file (such as `.pipeline/config.yaml`). 38 39 ```yaml 40 steps: 41 <...> 42 gctsExecuteABAPQualityChecks: 43 host: 'https://abap.server.com:port' 44 client: '000' 45 abapCredentialsId: 'ABAPUserPasswordCredentialsId' 46 repository: 'myrepo' 47 scope: 'remoteChangedObjects' 48 commit: '38abb4814ae46b98e8e6c3e718cf1782afa9ca90' 49 workspace: '/var/jenkins_home/workspace/myFirstPipeline' 50 ``` 51 52 Example configuration with the *repository* scope defined. Here, you donĀ“t need to specify a *commit*. This sample configuration can also be used with the *packages* scope. 53 54 ```yaml 55 steps: 56 <...> 57 gctsExecuteABAPQualityChecks: 58 host: 'https://abap.server.com:port' 59 client: '000' 60 abapCredentialsId: 'ABAPUserPasswordCredentialsId' 61 repository: 'myrepo' 62 scope: 'repository' 63 workspace: '/var/jenkins_home/workspace/myFirstPipeline' 64 ``` 65 66 Example configuration when you want to execute only ABAP Unit tests. 67 68 ```yaml 69 steps: 70 <...> 71 gctsExecuteABAPQualityChecks: 72 host: 'https://abap.server.com:port' 73 client: '000' 74 abapCredentialsId: 'ABAPUserPasswordCredentialsId' 75 repository: 'myrepo' 76 atcCheck: false 77 scope: 'packages' 78 workspace: '/var/jenkins_home/workspace/myFirstPipeline' 79 ``` 80 81 Example configuration for the use of the *recordIssue* step in a Jenkinsfile to make the check results visible in the Warnings-Next-Generation Plugin in Jenkins. 82 83 ```groovy 84 stage('ABAP Unit Tests') { 85 steps{ 86 87 script{ 88 89 try{ 90 gctsExecuteABAPQualityChecks( 91 script: this, 92 commit: "${env.GIT_COMMIT}", 93 workspace: "${WORKSPACE}") 94 } 95 catch (Exception ex) { 96 currentBuild.result = 'FAILURE' 97 unstable(message: "${STAGE_NAME} is unstable") 98 } 99 100 } 101 } 102 } 103 stage('Results in Checkstyle') { 104 steps{ 105 106 recordIssues( 107 enabledForFailure: true, aggregatingResults: true, 108 tools: [checkStyle(pattern: 'ATCResults.xml', reportEncoding: 'UTF8'),checkStyle(pattern: 'AUnitResults.xml', reportEncoding: 'UTF8')] 109 ) 110 111 } 112 } 113 114 } 115 ``` 116 117 **Note:** If you have disabled the *atcCheck* or *aUnitTest* parameters, you must also remove the corresponding *ATCResults.xml* or *AUnitResults.xml* from the *recordIssues* step. In the example below, the *atcCheck* is disabled. Therefore, the *ATCResults.xml* is missing. 118 119 ```groovy 120 recordIssues( 121 enabledForFailure: true, aggregatingResults: true, 122 tools: [checkStyle(pattern: 'AUnitResults.xml', reportEncoding: 'UTF8')] 123 124 ) 125 ```