2019-11-07 16:40:45 +02:00
# ${docGenStepName}
## ${docGenDescription}
## Prerequisites
2021-03-19 11:51:24 +02:00
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 "SAP BTP, ABAP Environment - Software Component Test Integration (SAP_COM_0510)". 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_0510", "type": "basic"}. In a pipeline, you can do this with the step [cloudFoundryCreateServiceKey ](https://sap.github.io/jenkins-library/steps/cloudFoundryCreateServiceKey/ ).
2019-11-07 16:40:45 +02:00
## ${docGenParameters}
## ${docGenConfiguration}
## ${docJenkinsPluginDependencies}
2020-05-18 09:44:15 +02:00
## Example: Configuration in the config.yml
2019-11-07 16:40:45 +02:00
2020-05-18 09:44:15 +02:00
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:
```groovy
abapEnvironmentPullGitRepo script: this
```
If you want to provide the host and credentials of the Communication Arrangement directly, the configuration could look as follows:
2020-05-18 12:49:52 +02:00
```yaml
2020-05-18 09:44:15 +02:00
steps:
abapEnvironmentPullGitRepo:
repositoryNames: ['/DMO/GIT_REPOSITORY']
abapCredentialsId: 'abapCredentialsId'
host: '1234-abcd-5678-efgh-ijk.abap.eu10.hana.ondemand.com'
```
2020-11-02 15:17:13 +02:00
However, we recommend to use a dedicated file, e.g. `repositories.yml` to specify the repositories to be pulled:
2020-10-05 14:38:35 +02:00
```yaml
steps:
abapEnvironmentPullGitRepo:
repositories: 'repositories.yml'
abapCredentialsId: 'abapCredentialsId'
host: '1234-abcd-5678-efgh-ijk.abap.eu10.hana.ondemand.com'
```
The associated config file, e.g. `repositories.yml` could look as follows:
```yaml
repositories:
- name: '/DMO/GIT_REPOSITORY'
branch: 'master'
- name: '/DMO/GIT_REPO'
branch: 'master'
2020-12-10 15:28:03 +02:00
commitID: 'cd87a3cac2bc946b7629580e58598c3db56a26f8'
2020-10-05 14:38:35 +02:00
```
2020-11-02 15:17:13 +02:00
It is optional to provide a branch. However, if you also want to use this file for the abapEnvironmentCheckoutBranch step it is recommended to follow the above structure.
2020-12-10 15:28:03 +02:00
If you want to pull a specific commit, the `commitID` can be specified optionally for a repository.
2020-10-05 14:38:35 +02:00
2020-05-18 09:44:15 +02:00
If you want to read the host and credentials from the cloud foundry service key of the respective instance, the configuration could look as follows:
2020-05-18 12:49:52 +02:00
```yaml
2020-05-18 09:44:15 +02:00
steps:
abapEnvironmentPullGitRepo:
repositoryNames: ['/DMO/GIT_REPOSITORY']
2020-05-18 12:49:52 +02:00
cfCredentialsId: 'cfCredentialsId'
2020-05-18 09:44:15 +02:00
cfApiEndpoint: 'https://test.server.com'
cfOrg: 'cfOrg'
cfSpace: 'cfSpace'
cfServiceInstance: 'cfServiceInstance'
2020-06-30 15:46:07 +02:00
cfServiceKeyName: 'cfServiceKeyName'
2020-05-18 09:44:15 +02:00
```
## Example: Configuration in the Jenkinsfile
It is also possible to call the steps - including all parameters - directly in the Jenkinsfile.
2019-12-16 23:02:30 +02:00
In the first example, the host and the credentialsId of the Communication Arrangement are directly provided.
```groovy
abapEnvironmentPullGitRepo (
2020-02-04 12:43:27 +02:00
script: this,
2020-05-07 15:51:11 +02:00
repositoryNames: ['/DMO/GIT_REPOSITORY'],
2020-05-18 09:44:15 +02:00
abapCredentialsId: 'abapCredentialsId',
2020-02-04 12:43:27 +02:00
host: '1234-abcd-5678-efgh-ijk.abap.eu10.hana.ondemand.com'
2019-12-16 23:02:30 +02:00
)
```
2021-03-19 11:51:24 +02:00
In the second example, the host and credentialsId will be read from the provided Cloud Foundry service key of the specified service instance.
2019-12-16 23:02:30 +02:00
2019-11-07 16:40:45 +02:00
```groovy
2019-11-12 18:40:59 +02:00
abapEnvironmentPullGitRepo (
2019-12-16 23:02:30 +02:00
script: this,
2020-05-07 15:51:11 +02:00
repositoryNames: ['/DMO/GIT_REPOSITORY', '/DMO/GIT_REPO'],
2020-05-18 09:44:15 +02:00
abapCredentialsId: 'cfCredentialsId',
2020-05-07 15:51:11 +02:00
cfApiEndpoint: 'https://test.server.com',
cfOrg: 'cfOrg',
cfSpace: 'cfSpace',
cfServiceInstance: 'cfServiceInstance',
2020-06-30 15:46:07 +02:00
cfServiceKeyName: 'cfServiceKeyName'
2019-11-12 18:40:59 +02:00
)
2019-11-07 16:40:45 +02:00
```