github.com/xgoffin/jenkins-library@v1.154.0/documentation/docs/steps/abapEnvironmentPushATCSystemConfig.md (about)

     1  # ${docGenStepName}
     2  
     3  ## ${docGenDescription}
     4  
     5  ## Prerequisites
     6  
     7  * A SAP BTP, ABAP environment system is available. On this system, a [Communication User](https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/0377adea0401467f939827242c1f4014.html), a [Communication System](https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/1bfe32ae08074b7186e375ab425fb114.html) and a [Communication Arrangement](https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/a0771f6765f54e1c8193ad8582a32edb.html) is setup for the Communication Scenario “ABAP Test Cockpit Configuration Integration (SAP_COM_0763)“. This can be done manually through the respective applications on the SAP BTP, ABAP environment system or through creating a service key for the system on Cloud Foundry with the parameters {“scenario_id”: “SAP_COM_0763", “type”: “basic”}. In a pipeline, you can do this with the step [cloudFoundryCreateServiceKey](https://sap.github.io/jenkins-library/steps/cloudFoundryCreateServiceKey/).
     8  * You can either provide the ABAP endpoint configuration to directly trigger an ATC run on the ABAP system or optionally provide the Cloud Foundry parameters with your credentials to read a Service Key of a SAP BTP, ABAP environment system in Cloud Foundry that contains all the details of the ABAP endpoint to trigger an ATC run.
     9  * Regardless if you chose an ABAP endpoint directly or reading a Cloud Foundry Service Key, you have to provide the configuration of the packages and software components you want to be checked in an ATC run in a .yml or .yaml file. This file must be stored in the same folder as the Jenkinsfile defining the pipeline.
    10  * The software components and/or packages you want to be checked must be present in the configured system in order to run the check. Please make sure that you have created or pulled the respective software components and/or Packages in the SAP BTP, ABAP environment system.
    11  
    12  Examples will be listed below.
    13  
    14  ## ${docGenParameters}
    15  
    16  ## ${docGenConfiguration}
    17  
    18  ## ${docJenkinsPluginDependencies}
    19  
    20  ## Examples
    21  
    22  ### Configuration in the config.yml
    23  
    24  The recommended way to configure your pipeline is via the config.yml file. In this case, calling the step in the Jenkinsfile is reduced to one line:
    25  
    26  ```groovy
    27  abapEnvironmentPushATCSystemConfig script: this
    28  ```
    29  
    30  If you want to provide the host and credentials of the Communication Arrangement directly, the configuration could look as follows:
    31  
    32  ```yaml
    33  steps:
    34    abapEnvironmentPushATCSystemConfig:
    35      abapCredentialsId: 'abapCredentialsId',
    36      host: 'https://myABAPendpoint.com',
    37      atcSystemConfigFilePath: 'atcSystemConfig.json',
    38  ```
    39  
    40  To trigger a create/update ATC System Configuration step an ATC System configuration file `atcSystemConfig.json` will be needed. Check section 'ATC System Configuration file example' for more information.
    41  
    42  ### Create/Update an ATC System Configuration via Cloud Foundry Service Key example in Jenkinsfile
    43  
    44  The following example triggers a Create/Update operation on an ATC System Configuration via reading the Service Key of an ABAP instance in Cloud Foundry.
    45  
    46  You can store the credentials in Jenkins and use the cfCredentialsId parameter to authenticate to Cloud Foundry.
    47  The username and password to authenticate to ABAP system will then be read from the Cloud Foundry service key that is bound to the ABAP instance.
    48  
    49  This can be done accordingly:
    50  
    51  ```groovy
    52  abapEnvironmentPushATCSystemConfig(
    53      cfApiEndpoint : 'https://test.server.com',
    54      cfOrg : 'cfOrg',
    55      cfSpace: 'cfSpace',
    56      cfServiceInstance: 'myServiceInstance',
    57      cfServiceKeyName: 'myServiceKey',
    58      abapCredentialsId: 'cfCredentialsId',
    59      atcSystemConfigFilePath: 'atcSystemConfig.json',
    60      script: this,
    61  )
    62  ```
    63  
    64  ### Create/Update an ATC System Configuration via direct ABAP endpoint configuration in Jenkinsfile
    65  
    66  This example triggers a create/update operation on an ATC System Configuration run directly on the ABAP endpoint.
    67  
    68  In order to trigger the create/update operation on an ATC System Configuration you have to pass the username and password for authentication to the ABAP endpoint via parameters as well as the ABAP endpoint/host. You can store the credentials in Jenkins and use the abapCredentialsId parameter to authenticate to the ABAP endpoint/host.
    69  
    70  This must be configured as following:
    71  
    72  ```groovy
    73  abapEnvironmentPushATCSystemConfig(
    74      abapCredentialsId: 'abapCredentialsId',
    75      host: 'https://myABAPendpoint.com',
    76      atcSystemConfigFilePath: 'atcSystemConfig.json',
    77      script: this,
    78  )
    79  ```
    80  
    81  To create/update an ATC System Configuration a file `atcSystemConfig.json` will be needed. Check section 'ATC System configuration file example' for more information.
    82  
    83  ### ATC System configuration file example
    84  
    85  The step always performs a check first, if an ATC System Configuration with the same name provided in the file `atcSystemConfig.json` with the attribute conf_name.
    86  This file contains an JSON Representation of an ATC System Configuration. Some json file examples can be found below.
    87  
    88  In case an ATC System Configuration with this name already exists, by default, the step would perform an update of this ATC System Configuration with the ATC System Configuration information provided in file `atcSystemConfig.json`.
    89  If this is not desired, an update could be supressed by using the parameter patchIfExisting in the configuration yaml the follwoing way:
    90  
    91  ```yaml
    92  steps:
    93    abapEnvironmentPushATCSystemConfig:
    94      atcSystemConfigFilePath: atcSystemConfig.json,
    95      patchIfExisting: false,
    96  ```
    97  
    98  In this case the step skips further processing after existence check and returns with a Warning.
    99  
   100  Providing a specifc System configuration file `atcSystemConfig.json` is mandatory.
   101  
   102  The following section contains an example of an `atcSystemConfig.json` file.
   103  
   104  This file must be stored in the same Git folder where the `Jenkinsfile` is stored to run the pipeline. This folder must be taken as a SCM in the Jenkins pipeline to run the pipeline.
   105  
   106  See below an example for an `atcSystemConfig.json` file for creating/updating an ATC System Configuration with the name myATCSystemConfigurationName including a change of one priority and providing information about last_changed date (not mandatory).
   107  
   108  ```json
   109  {
   110    "last_changed_at": "2022-01-27T22:46:02.132169Z",
   111    "conf_name": "myATCSystemConfigurationName",
   112    "checkvariant": "SAP_CLOUD_PLATFORM_ATC_DEFAULT",
   113    "block_findings": "0",
   114    "inform_findings": "1",
   115    "is_default": false,
   116    "is_proxy_variant": false,
   117    "_priorities": [
   118      {
   119        "test": "CL_CI_TEST_AMDP_HDB_MIGRATION",
   120        "message_id": "FAIL_ABAP",
   121        "priority": 2
   122      }
   123    ]
   124  }
   125  ```
   126  
   127  See below an example for an `atcSystemConfig.json` file for creating/updating an ATC System Configuration with the name myATCSystemConfigurationName.
   128  
   129  ```json
   130  {
   131    "conf_name": "myATCSystemConfigurationName",
   132    "checkvariant": "SAP_CLOUD_PLATFORM_ATC_DEFAULT",
   133    "block_findings": "0",
   134    "inform_findings": "1",
   135    "is_default": false,
   136    "is_proxy_variant": false
   137  }
   138  ```
   139  
   140  In case of creating an ATC System Configuration the default priorities will be created as well. In case the field/attribute last_changed_at is provided in the file and filled with a valid date and the configuration already exists with the given name in the respective ABAP system and should be patched (configuration parameter patchIfExisting set to true), the step will only attempt an update, in case the date from the file is younger than the date from the system!