1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-03-03 15:02:35 +02:00

Update gCTS steps (#3673)

* gCTS Scenario and two images

* Updated gCTS Scenario

* updated gCTS_Scenario.md and images

* added checkstyle stage

* upated the gCTSExecuteABAPQualityChecks.yaml file with severity information

* updates to gCTSExecuteABAPQualityChecks and gCTSExecuteABAPUnitTests steps

* updated gCTS_Scenario.md and relevant images

* Add more explanation for workspace parameter, change atc variant default value to DEFAULT

* Fix a type in description of workspace parameter

* changes to gctsExecuteABApUnitTests.md gctsExecuteABAPQualityChecks.yaml and gctsExecuteABApUnitTests.yaml

* final updates to gCTS steps and scenario

* added env. to GIT_COMMIT in gCTSExecuteABAPQualityChecks.md and gCTSExecuteABAPUnitTests.md

* remove the gScenario description from the branch

* Correct column typo in yaml file and generate files

* Add a new line in docu for gCTSExecuteABAPUnitTests

* Remove blank line from docu in gctsExecuteABAPUnitTests

Co-authored-by: Rinita Asani <rinita.asani@sap.com>
Co-authored-by: Sarat Krishnan <78093145+sarat-krk@users.noreply.github.com>
This commit is contained in:
Anke Ravalitera 2022-03-29 21:24:10 +02:00 committed by GitHub
parent 188e743f7b
commit b6a5ceaa03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 94 additions and 85 deletions

View File

@ -49,9 +49,9 @@ func GctsExecuteABAPQualityChecksCommand() *cobra.Command {
Depending on your use case, you can specify a scope of objects for which you want to execute the checks. In addition, you can choose whether you want to execute only ABAP units tests, or only ATC checks, or both.
By default, both checks are executed.
The results of the checks are stored in a [Checkstyle](https://checkstyle.sourceforge.io/) format. With the help of the Jenkins [Warnings-Next-Generation](https://plugins.jenkins.io/warnings-ng/) Plugin), you can view the issues found, and navigate to the exact line of the source code where the issue occurred.
To make the findings visible in Jenkins interface, you will need to use step recordIssues. An example will be shown in the Example section.
To make the findings visible in the Jenkins plug-in, you need to use the 'recordIssues' step, as displayed in the 'Example' section below.
<br />
You can use this step as of SAP S/4HANA 2020.`,
You can use this step as of SAP S/4HANA 2020 with SAP Note [3159798](https://launchpad.support.sap.com/#/notes/3159798) implemented.`,
PreRunE: func(cmd *cobra.Command, _ []string) error {
startTime = time.Now()
log.SetStepName(STEP_NAME)
@ -128,19 +128,19 @@ You can use this step as of SAP S/4HANA 2020.`,
}
func addGctsExecuteABAPQualityChecksFlags(cmd *cobra.Command, stepConfig *gctsExecuteABAPQualityChecksOptions) {
cmd.Flags().StringVar(&stepConfig.Username, "username", os.Getenv("PIPER_username"), "User that authenticates to the ABAP system. Note Don´t provide this parameter directly. Either set it in the environment, or in the Jenkins credentials store, and provide the ID as value of the abapCredentialsId parameter.")
cmd.Flags().StringVar(&stepConfig.Password, "password", os.Getenv("PIPER_password"), "Password of the ABAP user that authenticates to the ABAP system. Note – Don´t provide this parameter directly. Either set it in the environment, or in the Jenkins credentials store, and provide the ID as value of the abapCredentialsId parameter.")
cmd.Flags().StringVar(&stepConfig.Host, "host", os.Getenv("PIPER_host"), "Protocol and host of the ABAP system, including the port. Please provide in the format <protocol>://<host>:<port>. Supported protocols are http and https.")
cmd.Flags().StringVar(&stepConfig.Username, "username", os.Getenv("PIPER_username"), "User that authenticates to the ABAP system. Note - Don´t provide this parameter directly. Either set it in the environment, or in the Jenkins credentials store, and provide the ID as value of the 'abapCredentialsId' parameter.")
cmd.Flags().StringVar(&stepConfig.Password, "password", os.Getenv("PIPER_password"), "Password of the ABAP user that authenticates to the ABAP system. Note - Don´t provide this parameter directly. Either set it in the environment, or in the Jenkins credentials store, and provide the ID as value of the 'abapCredentialsId' parameter.")
cmd.Flags().StringVar(&stepConfig.Host, "host", os.Getenv("PIPER_host"), "Protocol and host of the ABAP system, including the port. Please provide it in the format '<protocol>://<host>:<port>'. Supported protocols are 'http' and 'https'.")
cmd.Flags().StringVar(&stepConfig.Repository, "repository", os.Getenv("PIPER_repository"), "Name (ID) of the local repository on the ABAP system")
cmd.Flags().StringVar(&stepConfig.Client, "client", os.Getenv("PIPER_client"), "Client of the ABAP system in which you want to execute the checks")
cmd.Flags().BoolVar(&stepConfig.AUnitTest, "aUnitTest", true, "Indication whether you want to execute the unit test checks.")
cmd.Flags().BoolVar(&stepConfig.AtcCheck, "atcCheck", true, "Indication whether you want to execute the ATC checks.")
cmd.Flags().StringVar(&stepConfig.AtcVariant, "atcVariant", `DEFAULT_REMOTE_REF`, "Variant for ATC checks")
cmd.Flags().StringVar(&stepConfig.Scope, "scope", `repository`, "Scope of objects for which you want to execute the checks:\n\n * localChangedObjects - object delta derived from last activity in the local repository. The checks are executed for the individual objects.\n * remoteChangedObjects - object delta between the commit that triggered the pipeline and the current commit in the remote repository. The checks are executed for the individual objects.\n * localChangedPackages - object delta derived from last activity in the local repository. All objects are resolved into packages. The checks are executed for the packages.\n * remoteChangedPackages - object delta between the commit that triggered the pipeline and the current commit in the remote repository. All objects are resolved into packages. The checks are executed for the packages.\n * repository - all objects that are part of the local repository. The checks are executed for the individual objects. Packages (DEVC) are excluded. This is the default scope.\n * packages - all packages that are part of the local repository . The checks are executed for the packages.\n")
cmd.Flags().StringVar(&stepConfig.Commit, "commit", os.Getenv("PIPER_commit"), "ID of the commit that triggered the pipeline or any other commit to compare objects. For scopes remoteChangedObjects and remoteChangedPackages secifying a commit it's mandatory.")
cmd.Flags().StringVar(&stepConfig.Workspace, "workspace", os.Getenv("PIPER_workspace"), "Absolute path to directory which contains the source code that your CI/CD tool checks out. For example in Jenkins, the workspace parameter is /var/jenkins_home/workspace/<jobName>/")
cmd.Flags().StringVar(&stepConfig.AtcResultsFileName, "atcResultsFileName", `ATCResults.xml`, "Specifies output file name for the results from the ATC checks")
cmd.Flags().StringVar(&stepConfig.AUnitResultsFileName, "aUnitResultsFileName", `AUnitResults.xml`, "Specifies output file name for the results from the AUnit tests")
cmd.Flags().BoolVar(&stepConfig.AUnitTest, "aUnitTest", true, "Indication whether you want to execute the ABAP Unit tests. If the ABAP Unit tests fail, the results are mapped as follows to the statuses available in the Jenkins plugin. (Successful ABAP unit test results are not displayed.)\n * Failed with severity 'fatal' is displayed as Error\n * Failed with severity 'critical' is displayed as Error\n * Failed with severity 'warning' is displayed as Warning\n")
cmd.Flags().BoolVar(&stepConfig.AtcCheck, "atcCheck", true, "Indication whether you want to execute the ATC checks. If the ATC checks result in errors with priorities 1 and 2, they are considered as failed. The results are mapped as follows to the statuses available in the Jenkins plugin. (Successful ATC check results are not displayed.)\n * Priority 1 and 2 are displayed as Error\n * Priority 3 is displayed as Warning\n")
cmd.Flags().StringVar(&stepConfig.AtcVariant, "atcVariant", `DEFAULT`, "Variant for ATC checks")
cmd.Flags().StringVar(&stepConfig.Scope, "scope", `repository`, "Scope of objects for which you want to execute the checks:\n * 'localChangedObjects': The object scope is derived from the last activity in the local repository. The checks are executed for the individual objects.\n * 'remoteChangedObjects': The object scope is the delta between the commit that triggered the pipeline and the current commit in the remote repository. The checks are executed for the individual objects.\n * 'localChangedPackages': The object scope is derived from the last activity in the local repository. All objects are resolved into packages. The checks are executed for the packages.\n * 'remoteChangedPackages': The object scope is the delta between the commit that triggered the pipeline and the current commit in the remote repository. All objects are resolved into packages. The checks are executed for the packages.\n * 'repository': The object scope comprises all objects that are part of the local repository. The checks are executed for the individual objects. Packages (DEVC) are excluded. This is the default scope.\n * 'packages': The object scope comprises all packages that are part of the local repository. The checks are executed for the packages.\n")
cmd.Flags().StringVar(&stepConfig.Commit, "commit", os.Getenv("PIPER_commit"), "ID of the commit that triggered the pipeline or any other commit used to calculate the object scope. Specifying a commit is mandatory for the 'remoteChangedObjects' and 'remoteChangedPackages' scopes.")
cmd.Flags().StringVar(&stepConfig.Workspace, "workspace", os.Getenv("PIPER_workspace"), "Absolute path to the directory that contains the source code that your CI/CD tool checks out. For example, in Jenkins, the workspace parameter is '/var/jenkins_home/workspace/<jobName>/'. As an alternative, you can use Jenkins's predefined environmental variable 'WORKSPACE'.")
cmd.Flags().StringVar(&stepConfig.AtcResultsFileName, "atcResultsFileName", `ATCResults.xml`, "Specifies an output file name for the results of the ATC checks.")
cmd.Flags().StringVar(&stepConfig.AUnitResultsFileName, "aUnitResultsFileName", `AUnitResults.xml`, "Specifies an output file name for the results of the ABAP Unit tests.")
cmd.MarkFlagRequired("username")
cmd.MarkFlagRequired("password")
@ -246,7 +246,7 @@ func gctsExecuteABAPQualityChecksMetadata() config.StepData {
Type: "string",
Mandatory: false,
Aliases: []config.Alias{},
Default: `DEFAULT_REMOTE_REF`,
Default: `DEFAULT`,
},
{
Name: "scope",

View File

@ -45,13 +45,7 @@ func GctsExecuteABAPUnitTestsCommand() *cobra.Command {
var createGctsExecuteABAPUnitTestsCmd = &cobra.Command{
Use: STEP_NAME,
Short: "Runs ABAP unit tests and ATC (ABAP Test Cockpit) checks for a specified object scope.",
Long: `This step executes ABAP unit test and ATC checks for a specified scope of objects that exist in a local Git repository on an ABAP system.
Depending on your use case, you can specify a scope of objects for which you want to execute the checks. In addition, you can choose whether you want to execute only ABAP units tests, or only ATC checks, or both.
By default, both checks are executed.
The results of the checks are stored in a [Checkstyle](https://checkstyle.sourceforge.io/) format. With the help of the Jenkins [Warnings-Next-Generation](https://plugins.jenkins.io/warnings-ng/) Plugin), you can view the issues found, and navigate to the exact line of the source code where the issue occurred.
To make the findings visible in Jenkins interface, you will need to use step recordIssues. An example will be shown in the Example section.
<br />
You can use this step as of SAP S/4HANA 2020.`,
Long: `This step executes ABAP unit test and ATC checks for a specified scope of objects that exist in a local Git repository on an ABAP system.`,
PreRunE: func(cmd *cobra.Command, _ []string) error {
startTime = time.Now()
log.SetStepName(STEP_NAME)
@ -128,19 +122,19 @@ You can use this step as of SAP S/4HANA 2020.`,
}
func addGctsExecuteABAPUnitTestsFlags(cmd *cobra.Command, stepConfig *gctsExecuteABAPUnitTestsOptions) {
cmd.Flags().StringVar(&stepConfig.Username, "username", os.Getenv("PIPER_username"), "User that authenticates to the ABAP system. Note Don´t provide this parameter directly. Either set it in the environment, or in the Jenkins credentials store, and provide the ID as value of the abapCredentialsId parameter.")
cmd.Flags().StringVar(&stepConfig.Password, "password", os.Getenv("PIPER_password"), "Password of the ABAP user that authenticates to the ABAP system. Note – Don´t provide this parameter directly. Either set it in the environment, or in the Jenkins credentials store, and provide the ID as value of the abapCredentialsId parameter.")
cmd.Flags().StringVar(&stepConfig.Host, "host", os.Getenv("PIPER_host"), "Protocol and host of the ABAP system, including the port. Please provide in the format <protocol>://<host>:<port>. Supported protocols are http and https.")
cmd.Flags().StringVar(&stepConfig.Username, "username", os.Getenv("PIPER_username"), "User that authenticates to the ABAP system. Note - Don´t provide this parameter directly. Either set it in the environment, or in the Jenkins credentials store, and provide the ID as value of the `abapCredentialsId` parameter.")
cmd.Flags().StringVar(&stepConfig.Password, "password", os.Getenv("PIPER_password"), "Password of the ABAP user that authenticates to the ABAP system. Note - Don´t provide this parameter directly. Either set it in the environment, or in the Jenkins credentials store, and provide the ID as value of the `abapCredentialsId` parameter.")
cmd.Flags().StringVar(&stepConfig.Host, "host", os.Getenv("PIPER_host"), "Protocol and host of the ABAP system, including the port. Please provide it in the format `<protocol>://<host>:<port>`. Supported protocols are `http` and `https`.")
cmd.Flags().StringVar(&stepConfig.Repository, "repository", os.Getenv("PIPER_repository"), "Name (ID) of the local repository on the ABAP system")
cmd.Flags().StringVar(&stepConfig.Client, "client", os.Getenv("PIPER_client"), "Client of the ABAP system in which you want to execute the checks")
cmd.Flags().BoolVar(&stepConfig.AUnitTest, "aUnitTest", true, "Indication whether you want to execute the unit test checks.")
cmd.Flags().BoolVar(&stepConfig.AtcCheck, "atcCheck", true, "Indication whether you want to execute the ATC checks.")
cmd.Flags().StringVar(&stepConfig.AtcVariant, "atcVariant", `DEFAULT_REMOTE_REF`, "Variant for ATC checks")
cmd.Flags().StringVar(&stepConfig.Scope, "scope", `repository`, "Scope of objects for which you want to execute the checks:\n\n * localChangedObjects - object delta derived from last activity in the local repository. The checks are executed for the individual objects.\n * remoteChangedObjects - object delta between the commit that triggered the pipeline and the current commit in the remote repository. The checks are executed for the individual objects.\n * localChangedPackages - object delta derived from last activity in the local repository. All objects are resolved into packages. The checks are executed for the packages.\n * remoteChangedPackages - object delta between the commit that triggered the pipeline and the current commit in the remote repository. All objects are resolved into packages. The checks are executed for the packages.\n * repository - all objects that are part of the local repository. The checks are executed for the individual objects. Packages (DEVC) are excluded. This is the default scope.\n * packages - all packages that are part of the local repository . The checks are executed for the packages.\n")
cmd.Flags().StringVar(&stepConfig.Commit, "commit", os.Getenv("PIPER_commit"), "ID of the commit that triggered the pipeline or any other commit to compare objects. For scopes remoteChangedObjects and remoteChangedPackages secifying a commit it's mandatory.")
cmd.Flags().StringVar(&stepConfig.Workspace, "workspace", os.Getenv("PIPER_workspace"), "Absolute path to directory which contains the source code that your CI/CD tool checks out. For example in Jenkins, the workspace parameter is /var/jenkins_home/workspace/<jobName>/")
cmd.Flags().StringVar(&stepConfig.AtcResultsFileName, "atcResultsFileName", `ATCResults.xml`, "Specifies output file name for the results from the ATC checks")
cmd.Flags().StringVar(&stepConfig.AUnitResultsFileName, "aUnitResultsFileName", `AUnitResults.xml`, "Specifies output file name for the results from the AUnit tests")
cmd.Flags().BoolVar(&stepConfig.AUnitTest, "aUnitTest", true, "Indication whether you want to execute the ABAP Unit tests. If the ABAP Unit tests fail, the results are mapped as follows to the statuses available in the Jenkins plugin. (Successful ABAP unit test results are not displayed.)\n * Failed with severity 'fatal' is displayed as Error\n * Failed with severity 'critical' is displayed as Error\n * Failed with severity 'warning' is displayed as Warning\n")
cmd.Flags().BoolVar(&stepConfig.AtcCheck, "atcCheck", true, "Indication whether you want to execute the ATC checks. If the ATC checks result in errors with priorities 1 and 2, they are considered as failed. The results are mapped as follows to the statuses available in the Jenkins plugin. (Successful ATC check results are not displayed.)\n * Priority 1 and 2 are displayed as Error\n * Priority 3 is displayed as Warning\n")
cmd.Flags().StringVar(&stepConfig.AtcVariant, "atcVariant", `DEFAULT`, "Variant to be used for the ATC checks.")
cmd.Flags().StringVar(&stepConfig.Scope, "scope", `repository`, "Scope of objects for which you want to execute the checks:\n\n * `localChangedObjects` - Object delta derived from last activity in the local repository. The checks are executed for the individual objects.\n * `remoteChangedObjects` - Object delta between the commit that triggered the pipeline and the current commit in the remote repository. The checks are executed for the individual objects.\n * `localChangedPackages` - Object delta derived from last activity in the local repository. All objects are resolved into packages. The checks are executed for the packages.\n * `remoteChangedPackages` - Object delta between the commit that triggered the pipeline and the current commit in the remote repository. All objects are resolved into packages. The checks are executed for the packages.\n * `repository` - All objects that are part of the local repository. The checks are executed for the individual objects. Packages (DEVC) are excluded. This is the default scope.\n * `packages` - All packages that are part of the local repository. The checks are executed for the packages.\n")
cmd.Flags().StringVar(&stepConfig.Commit, "commit", os.Getenv("PIPER_commit"), "ID of the commit that triggered the pipeline or any other commit to compare objects. For scopes `remoteChangedObjects` and `remoteChangedPackages` specifying a commit is mandatory.")
cmd.Flags().StringVar(&stepConfig.Workspace, "workspace", os.Getenv("PIPER_workspace"), "Absolute path to directory which contains the source code that your CI/CD tool checks out. For example in Jenkins, the workspace parameter is `/var/jenkins_home/workspace/<jobName>/`. As an alternative, you can use Jenkins's predefined environmental variable WORKSPACE.")
cmd.Flags().StringVar(&stepConfig.AtcResultsFileName, "atcResultsFileName", `ATCResults.xml`, "Specifies the output file name for the results of the ATC checks.")
cmd.Flags().StringVar(&stepConfig.AUnitResultsFileName, "aUnitResultsFileName", `AUnitResults.xml`, "Specifies the output file name for the results of the AUnit tests.")
cmd.MarkFlagRequired("username")
cmd.MarkFlagRequired("password")
@ -246,7 +240,7 @@ func gctsExecuteABAPUnitTestsMetadata() config.StepData {
Type: "string",
Mandatory: false,
Aliases: []config.Alias{},
Default: `DEFAULT_REMOTE_REF`,
Default: `DEFAULT`,
},
{
Name: "scope",

View File

@ -4,8 +4,10 @@
## Prerequisites
* [ATC](https://help.sap.com/viewer/c238d694b825421f940829321ffa326a/202110.000/en-US/4ec5711c6e391014adc9fffe4e204223.html) checks are enabled in transaction ATC in the ABAP systems where you want to use the step.
* [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.
* [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.
* [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.
* 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.
* The [Warnings-Next-Generation](https://plugins.jenkins.io/warnings-ng/) Plugin is installed in Jenkins.
## ${docGenParameters}
@ -26,13 +28,13 @@ gctsExecuteABAPQualityChecks(
abapCredentialsId: 'ABAPUserPasswordCredentialsId',
repository: 'myrepo',
scope: 'remoteChangedObjects',
commit: "${GIT_COMMIT}",
commit: "${env.GIT_COMMIT}",
workspace: "${WORKSPACE}"
)
```
Example configuration for the use in a yaml config file (such as `.pipeline/config.yaml`).
Example configuration for the use in a .yaml config file (such as `.pipeline/config.yaml`).
```yaml
steps:
@ -47,7 +49,7 @@ steps:
workspace: '/var/jenkins_home/workspace/myFirstPipeline'
```
Example configuration when you define scope: *repository* or *packages*. For these two cases you do not need to specify a *commit*.
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.
```yaml
steps:
@ -61,7 +63,7 @@ steps:
workspace: '/var/jenkins_home/workspace/myFirstPipeline'
```
Example configuration when you want to execute only ABAP Unit Test.
Example configuration when you want to execute only ABAP Unit tests.
```yaml
steps:
@ -76,7 +78,7 @@ steps:
workspace: '/var/jenkins_home/workspace/myFirstPipeline'
```
Example configuration for the use of *recordIssue* step to make the findings visible in Jenkins interface.
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.
```groovy
stage('ABAP Unit Tests') {
@ -87,7 +89,7 @@ stage('ABAP Unit Tests') {
try{
gctsExecuteABAPQualityChecks(
script: this,
commit: "${GIT_COMMIT}",
commit: "${env.GIT_COMMIT}",
workspace: "${WORKSPACE}")
}
catch (Exception ex) {
@ -112,7 +114,7 @@ stage('Results in Checkstyle') {
}
```
**Note:** If you have disabled *atcCheck* or *aUnitTest*, than you also need to remove the corresponding *ATCResults.xml* or *AUnitResults.xml* from *recordIssues* step. In the example below the *atcCheck* was disabled, so *ATCResults.xml* was removed.
**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.
```groovy
recordIssues(

View File

@ -2,10 +2,16 @@
## ${docGenDescription}
!!! caution "This step has been deprecated."
Please use the [gctsExecuteABAPQualityChecks](https://www.project-piper.io/steps/gctsExecuteABAPQualityChecks/) instead.
Don´t worry, if you´re already using the step. You can continue to use it. It will call the functions of the [gctsExecuteABAPQualityChecks](https://www.project-piper.io/steps/gctsExecuteABAPQualityChecks/) step.
## Prerequisites
* [ATC](https://help.sap.com/viewer/c238d694b825421f940829321ffa326a/202110.000/en-US/4ec5711c6e391014adc9fffe4e204223.html) checks are enabled in transaction ATC in the ABAP systems where you want to use the step.
* [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.
* [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.
* 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.
* The [Warnings-Next-Generation](https://plugins.jenkins.io/warnings-ng/) Plugin is installed in Jenkins.
## ${docGenParameters}
@ -26,7 +32,7 @@ gctsExecuteABAPUnitTests(
abapCredentialsId: 'ABAPUserPasswordCredentialsId',
repository: 'myrepo',
scope: 'remoteChangedObjects',
commit: "${GIT_COMMIT}",
commit: "${env.GIT_COMMIT}",
workspace: "${WORKSPACE}"
)
@ -87,7 +93,7 @@ stage('ABAP Unit Tests') {
try{
gctsExecuteABAPUnitTests(
script: this,
commit: "${GIT_COMMIT}",
commit: "${env.GIT_COMMIT}",
workspace: "${WORKSPACE}")
}
catch (Exception ex) {

View File

@ -6,9 +6,9 @@ metadata:
Depending on your use case, you can specify a scope of objects for which you want to execute the checks. In addition, you can choose whether you want to execute only ABAP units tests, or only ATC checks, or both.
By default, both checks are executed.
The results of the checks are stored in a [Checkstyle](https://checkstyle.sourceforge.io/) format. With the help of the Jenkins [Warnings-Next-Generation](https://plugins.jenkins.io/warnings-ng/) Plugin), you can view the issues found, and navigate to the exact line of the source code where the issue occurred.
To make the findings visible in Jenkins interface, you will need to use step recordIssues. An example will be shown in the Example section.
To make the findings visible in the Jenkins plug-in, you need to use the 'recordIssues' step, as displayed in the 'Example' section below.
<br />
You can use this step as of SAP S/4HANA 2020.
You can use this step as of SAP S/4HANA 2020 with SAP Note [3159798](https://launchpad.support.sap.com/#/notes/3159798) implemented.
spec:
inputs:
@ -19,7 +19,7 @@ spec:
params:
- name: username
type: string
description: User that authenticates to the ABAP system. Note Don´t provide this parameter directly. Either set it in the environment, or in the Jenkins credentials store, and provide the ID as value of the abapCredentialsId parameter.
description: User that authenticates to the ABAP system. Note - Don´t provide this parameter directly. Either set it in the environment, or in the Jenkins credentials store, and provide the ID as value of the 'abapCredentialsId' parameter.
scope:
- PARAMETERS
- STAGES
@ -32,7 +32,7 @@ spec:
param: username
- name: password
type: string
description: Password of the ABAP user that authenticates to the ABAP system. Note – Don´t provide this parameter directly. Either set it in the environment, or in the Jenkins credentials store, and provide the ID as value of the abapCredentialsId parameter.
description: Password of the ABAP user that authenticates to the ABAP system. Note - Don´t provide this parameter directly. Either set it in the environment, or in the Jenkins credentials store, and provide the ID as value of the 'abapCredentialsId' parameter.
scope:
- PARAMETERS
- STAGES
@ -45,7 +45,7 @@ spec:
param: password
- name: host
type: string
description: Protocol and host of the ABAP system, including the port. Please provide in the format <protocol>://<host>:<port>. Supported protocols are http and https.
description: Protocol and host of the ABAP system, including the port. Please provide it in the format '<protocol>://<host>:<port>'. Supported protocols are 'http' and 'https'.
scope:
- PARAMETERS
- STAGES
@ -70,7 +70,11 @@ spec:
- name: aUnitTest
type: bool
default: true
description: Indication whether you want to execute the unit test checks.
description: |
Indication whether you want to execute the ABAP Unit tests. If the ABAP Unit tests fail, the results are mapped as follows to the statuses available in the Jenkins plugin. (Successful ABAP unit test results are not displayed.)
* Failed with severity 'fatal' is displayed as Error
* Failed with severity 'critical' is displayed as Error
* Failed with severity 'warning' is displayed as Warning
scope:
- PARAMETERS
- STAGES
@ -78,14 +82,17 @@ spec:
- name: atcCheck
type: bool
default: true
description: Indication whether you want to execute the ATC checks.
description: |
Indication whether you want to execute the ATC checks. If the ATC checks result in errors with priorities 1 and 2, they are considered as failed. The results are mapped as follows to the statuses available in the Jenkins plugin. (Successful ATC check results are not displayed.)
* Priority 1 and 2 are displayed as Error
* Priority 3 is displayed as Warning
scope:
- PARAMETERS
- STAGES
- STEPS
- name: atcVariant
type: string
default: "DEFAULT_REMOTE_REF"
default: "DEFAULT"
description: Variant for ATC checks
scope:
- PARAMETERS
@ -103,20 +110,19 @@ spec:
- packages
description: |
Scope of objects for which you want to execute the checks:
* localChangedObjects - object delta derived from last activity in the local repository. The checks are executed for the individual objects.
* remoteChangedObjects - object delta between the commit that triggered the pipeline and the current commit in the remote repository. The checks are executed for the individual objects.
* localChangedPackages - object delta derived from last activity in the local repository. All objects are resolved into packages. The checks are executed for the packages.
* remoteChangedPackages - object delta between the commit that triggered the pipeline and the current commit in the remote repository. All objects are resolved into packages. The checks are executed for the packages.
* repository - all objects that are part of the local repository. The checks are executed for the individual objects. Packages (DEVC) are excluded. This is the default scope.
* packages - all packages that are part of the local repository . The checks are executed for the packages.
* 'localChangedObjects': The object scope is derived from the last activity in the local repository. The checks are executed for the individual objects.
* 'remoteChangedObjects': The object scope is the delta between the commit that triggered the pipeline and the current commit in the remote repository. The checks are executed for the individual objects.
* 'localChangedPackages': The object scope is derived from the last activity in the local repository. All objects are resolved into packages. The checks are executed for the packages.
* 'remoteChangedPackages': The object scope is the delta between the commit that triggered the pipeline and the current commit in the remote repository. All objects are resolved into packages. The checks are executed for the packages.
* 'repository': The object scope comprises all objects that are part of the local repository. The checks are executed for the individual objects. Packages (DEVC) are excluded. This is the default scope.
* 'packages': The object scope comprises all packages that are part of the local repository. The checks are executed for the packages.
scope:
- PARAMETERS
- STAGES
- STEPS
- name: commit
type: string
description: ID of the commit that triggered the pipeline or any other commit to compare objects. For scopes remoteChangedObjects and remoteChangedPackages secifying a commit it's mandatory.
description: ID of the commit that triggered the pipeline or any other commit used to calculate the object scope. Specifying a commit is mandatory for the 'remoteChangedObjects' and 'remoteChangedPackages' scopes.
scope:
- PARAMETERS
- STAGES
@ -124,7 +130,7 @@ spec:
mandatory: false
- name: workspace
type: string
description: Absolute path to directory which contains the source code that your CI/CD tool checks out. For example in Jenkins, the workspace parameter is /var/jenkins_home/workspace/<jobName>/
description: Absolute path to the directory that contains the source code that your CI/CD tool checks out. For example, in Jenkins, the workspace parameter is '/var/jenkins_home/workspace/<jobName>/'. As an alternative, you can use Jenkins's predefined environmental variable 'WORKSPACE'.
scope:
- PARAMETERS
- STAGES
@ -132,7 +138,7 @@ spec:
mandatory: true
- name: atcResultsFileName
type: string
description: Specifies output file name for the results from the ATC checks
description: Specifies an output file name for the results of the ATC checks.
scope:
- PARAMETERS
- STAGES
@ -141,7 +147,7 @@ spec:
default: "ATCResults.xml"
- name: aUnitResultsFileName
type: string
description: Specifies output file name for the results from the AUnit tests
description: Specifies an output file name for the results of the ABAP Unit tests.
scope:
- PARAMETERS
- STAGES

View File

@ -3,12 +3,6 @@ metadata:
description: Runs ABAP unit tests and ATC (ABAP Test Cockpit) checks for a specified object scope.
longDescription: |
This step executes ABAP unit test and ATC checks for a specified scope of objects that exist in a local Git repository on an ABAP system.
Depending on your use case, you can specify a scope of objects for which you want to execute the checks. In addition, you can choose whether you want to execute only ABAP units tests, or only ATC checks, or both.
By default, both checks are executed.
The results of the checks are stored in a [Checkstyle](https://checkstyle.sourceforge.io/) format. With the help of the Jenkins [Warnings-Next-Generation](https://plugins.jenkins.io/warnings-ng/) Plugin), you can view the issues found, and navigate to the exact line of the source code where the issue occurred.
To make the findings visible in Jenkins interface, you will need to use step recordIssues. An example will be shown in the Example section.
<br />
You can use this step as of SAP S/4HANA 2020.
spec:
inputs:
@ -19,7 +13,7 @@ spec:
params:
- name: username
type: string
description: User that authenticates to the ABAP system. Note Don´t provide this parameter directly. Either set it in the environment, or in the Jenkins credentials store, and provide the ID as value of the abapCredentialsId parameter.
description: User that authenticates to the ABAP system. Note - Don´t provide this parameter directly. Either set it in the environment, or in the Jenkins credentials store, and provide the ID as value of the `abapCredentialsId` parameter.
scope:
- PARAMETERS
- STAGES
@ -32,7 +26,7 @@ spec:
param: username
- name: password
type: string
description: Password of the ABAP user that authenticates to the ABAP system. Note – Don´t provide this parameter directly. Either set it in the environment, or in the Jenkins credentials store, and provide the ID as value of the abapCredentialsId parameter.
description: Password of the ABAP user that authenticates to the ABAP system. Note - Don´t provide this parameter directly. Either set it in the environment, or in the Jenkins credentials store, and provide the ID as value of the `abapCredentialsId` parameter.
scope:
- PARAMETERS
- STAGES
@ -45,7 +39,7 @@ spec:
param: password
- name: host
type: string
description: Protocol and host of the ABAP system, including the port. Please provide in the format <protocol>://<host>:<port>. Supported protocols are http and https.
description: Protocol and host of the ABAP system, including the port. Please provide it in the format `<protocol>://<host>:<port>`. Supported protocols are `http` and `https`.
scope:
- PARAMETERS
- STAGES
@ -70,7 +64,11 @@ spec:
- name: aUnitTest
type: bool
default: true
description: Indication whether you want to execute the unit test checks.
description: |
Indication whether you want to execute the ABAP Unit tests. If the ABAP Unit tests fail, the results are mapped as follows to the statuses available in the Jenkins plugin. (Successful ABAP unit test results are not displayed.)
* Failed with severity 'fatal' is displayed as Error
* Failed with severity 'critical' is displayed as Error
* Failed with severity 'warning' is displayed as Warning
scope:
- PARAMETERS
- STAGES
@ -78,15 +76,18 @@ spec:
- name: atcCheck
type: bool
default: true
description: Indication whether you want to execute the ATC checks.
description: |
Indication whether you want to execute the ATC checks. If the ATC checks result in errors with priorities 1 and 2, they are considered as failed. The results are mapped as follows to the statuses available in the Jenkins plugin. (Successful ATC check results are not displayed.)
* Priority 1 and 2 are displayed as Error
* Priority 3 is displayed as Warning
scope:
- PARAMETERS
- STAGES
- STEPS
- name: atcVariant
type: string
default: "DEFAULT_REMOTE_REF"
description: Variant for ATC checks
default: "DEFAULT"
description: Variant to be used for the ATC checks.
scope:
- PARAMETERS
- STAGES
@ -104,19 +105,19 @@ spec:
description: |
Scope of objects for which you want to execute the checks:
* localChangedObjects - object delta derived from last activity in the local repository. The checks are executed for the individual objects.
* remoteChangedObjects - object delta between the commit that triggered the pipeline and the current commit in the remote repository. The checks are executed for the individual objects.
* localChangedPackages - object delta derived from last activity in the local repository. All objects are resolved into packages. The checks are executed for the packages.
* remoteChangedPackages - object delta between the commit that triggered the pipeline and the current commit in the remote repository. All objects are resolved into packages. The checks are executed for the packages.
* repository - all objects that are part of the local repository. The checks are executed for the individual objects. Packages (DEVC) are excluded. This is the default scope.
* packages - all packages that are part of the local repository . The checks are executed for the packages.
* `localChangedObjects` - Object delta derived from last activity in the local repository. The checks are executed for the individual objects.
* `remoteChangedObjects` - Object delta between the commit that triggered the pipeline and the current commit in the remote repository. The checks are executed for the individual objects.
* `localChangedPackages` - Object delta derived from last activity in the local repository. All objects are resolved into packages. The checks are executed for the packages.
* `remoteChangedPackages` - Object delta between the commit that triggered the pipeline and the current commit in the remote repository. All objects are resolved into packages. The checks are executed for the packages.
* `repository` - All objects that are part of the local repository. The checks are executed for the individual objects. Packages (DEVC) are excluded. This is the default scope.
* `packages` - All packages that are part of the local repository. The checks are executed for the packages.
scope:
- PARAMETERS
- STAGES
- STEPS
- name: commit
type: string
description: ID of the commit that triggered the pipeline or any other commit to compare objects. For scopes remoteChangedObjects and remoteChangedPackages secifying a commit it's mandatory.
description: ID of the commit that triggered the pipeline or any other commit to compare objects. For scopes `remoteChangedObjects` and `remoteChangedPackages` specifying a commit is mandatory.
scope:
- PARAMETERS
- STAGES
@ -124,7 +125,7 @@ spec:
mandatory: false
- name: workspace
type: string
description: Absolute path to directory which contains the source code that your CI/CD tool checks out. For example in Jenkins, the workspace parameter is /var/jenkins_home/workspace/<jobName>/
description: Absolute path to directory which contains the source code that your CI/CD tool checks out. For example in Jenkins, the workspace parameter is `/var/jenkins_home/workspace/<jobName>/`. As an alternative, you can use Jenkins's predefined environmental variable WORKSPACE.
scope:
- PARAMETERS
- STAGES
@ -132,7 +133,7 @@ spec:
mandatory: true
- name: atcResultsFileName
type: string
description: Specifies output file name for the results from the ATC checks
description: Specifies the output file name for the results of the ATC checks.
scope:
- PARAMETERS
- STAGES
@ -141,7 +142,7 @@ spec:
default: "ATCResults.xml"
- name: aUnitResultsFileName
type: string
description: Specifies output file name for the results from the AUnit tests
description: Specifies the output file name for the results of the AUnit tests.
scope:
- PARAMETERS
- STAGES