4.0 KiB
${docGenStepName}
${docGenDescription}
Prerequisites
- ATC checks are enabled in transaction ATC in the ABAP systems where you want to use the step.
- ABAP Unit tests 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.
- gCTS is available and configured in the ABAP systems where you want to use the step.
- If you want to use environmental variables as parameters, for example,
GIT_COMMIT
: The Git Plugin is installed in Jenkins. - The Warnings-Next-Generation Plugin is installed in Jenkins.
${docGenParameters}
${docGenConfiguration}
${docJenkinsPluginDependencies}
Example
Example configuration for the use in a Jenkinsfile.
gctsExecuteABAPQualityChecks(
script: this,
host: 'https://abap.server.com:port',
client: '000',
abapCredentialsId: 'ABAPUserPasswordCredentialsId',
repository: 'myrepo',
scope: 'remoteChangedObjects',
commit: "${env.GIT_COMMIT}",
workspace: "${WORKSPACE}",
queryparameters: [saml2: 'disabled']
)
Example configuration for the use in a .yaml config file (such as .pipeline/config.yaml
).
steps:
<...>
gctsExecuteABAPQualityChecks:
host: 'https://abap.server.com:port'
client: '000'
abapCredentialsId: 'ABAPUserPasswordCredentialsId'
repository: 'myrepo'
scope: 'remoteChangedObjects'
commit: '38abb4814ae46b98e8e6c3e718cf1782afa9ca90'
workspace: '/var/jenkins_home/workspace/myFirstPipeline'
queryparameters:
saml2: "disabled"
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.
steps:
<...>
gctsExecuteABAPQualityChecks:
host: 'https://abap.server.com:port'
client: '000'
abapCredentialsId: 'ABAPUserPasswordCredentialsId'
repository: 'myrepo'
scope: 'repository'
workspace: '/var/jenkins_home/workspace/myFirstPipeline'
Example configuration when you want to execute only ABAP Unit tests.
steps:
<...>
gctsExecuteABAPQualityChecks:
host: 'https://abap.server.com:port'
client: '000'
abapCredentialsId: 'ABAPUserPasswordCredentialsId'
repository: 'myrepo'
atcCheck: false
scope: 'packages'
workspace: '/var/jenkins_home/workspace/myFirstPipeline'
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.
stage('ABAP Unit Tests') {
steps{
script{
try{
gctsExecuteABAPQualityChecks(
script: this,
commit: "${env.GIT_COMMIT}",
workspace: "${WORKSPACE}")
}
catch (Exception ex) {
currentBuild.result = 'FAILURE'
unstable(message: "${STAGE_NAME} is unstable")
}
}
}
}
stage('Results in Checkstyle') {
steps{
recordIssues(
enabledForFailure: true, aggregatingResults: true,
tools: [checkStyle(pattern: 'ATCResults.xml', reportEncoding: 'UTF8'),checkStyle(pattern: 'AUnitResults.xml', reportEncoding: 'UTF8')]
)
}
}
}
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.
recordIssues(
enabledForFailure: true, aggregatingResults: true,
tools: [checkStyle(pattern: 'AUnitResults.xml', reportEncoding: 'UTF8')]
)