github.com/jaylevin/jenkins-library@v1.230.4/documentation/docs/steps/abapEnvironmentPullGitRepo.md (about)

     1  # ${docGenStepName}
     2  
     3  ## ${docGenDescription}
     4  
     5  ## Prerequisites
     6  
     7  A SAP BTP, ABAP environment system is available.
     8  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/). In addition, the software component should be cloned into the system instance. You can do this with the step [abapEnvironmentCloneGitRepo](./abapEnvironmentCloneGitRepo.md).
     9  
    10  ## ${docGenParameters}
    11  
    12  ## ${docGenConfiguration}
    13  
    14  ## ${docJenkinsPluginDependencies}
    15  
    16  ## Example: Configuration in the config.yml
    17  
    18  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:
    19  
    20  ```groovy
    21  abapEnvironmentPullGitRepo script: this
    22  ```
    23  
    24  If you want to provide the host and credentials of the Communication Arrangement directly, the configuration could look as follows:
    25  
    26  ```yaml
    27  steps:
    28    abapEnvironmentPullGitRepo:
    29      repositoryNames: ['/DMO/GIT_REPOSITORY']
    30      abapCredentialsId: 'abapCredentialsId'
    31      host: '1234-abcd-5678-efgh-ijk.abap.eu10.hana.ondemand.com'
    32  ```
    33  
    34  However, we recommend to use a dedicated file, e.g. `repositories.yml` to specify the repositories to be pulled:
    35  
    36  ```yaml
    37  steps:
    38    abapEnvironmentPullGitRepo:
    39      repositories: 'repositories.yml'
    40      abapCredentialsId: 'abapCredentialsId'
    41      host: '1234-abcd-5678-efgh-ijk.abap.eu10.hana.ondemand.com'
    42  ```
    43  
    44  The associated config file, e.g. `repositories.yml` could look as follows:
    45  
    46  ```yaml
    47  repositories:
    48  - name: '/DMO/GIT_REPOSITORY'
    49    branch: 'main'
    50  - name: '/DMO/GIT_REPO_COMMIT'
    51    branch: 'feature'
    52    commitID: 'cd87a3cac2bc946b7629580e58598c3db56a26f8'
    53  - name: '/DMO/GIT_REPO_TAG'
    54    branch: 'realease'
    55    tag: 'myTag'
    56  ```
    57  
    58  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.
    59  If you want to pull a specific commit, either a `commitID` or a `tag` can be specified. If both are specified, the `tag` will be ignored.
    60  
    61  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:
    62  
    63  ```yaml
    64  steps:
    65    abapEnvironmentPullGitRepo:
    66      repositoryNames: ['/DMO/GIT_REPOSITORY']
    67      cfCredentialsId: 'cfCredentialsId'
    68      cfApiEndpoint: 'https://test.server.com'
    69      cfOrg: 'cfOrg'
    70      cfSpace: 'cfSpace'
    71      cfServiceInstance: 'cfServiceInstance'
    72      cfServiceKeyName: 'cfServiceKeyName'
    73  ```
    74  
    75  ## Example: Configuration in the Jenkinsfile
    76  
    77  It is also possible to call the steps - including all parameters - directly in the Jenkinsfile.
    78  In the first example, the host and the credentialsId of the Communication Arrangement are directly provided.
    79  
    80  ```groovy
    81  abapEnvironmentPullGitRepo (
    82    script: this,
    83    repositoryNames: ['/DMO/GIT_REPOSITORY'],
    84    abapCredentialsId: 'abapCredentialsId',
    85    host: '1234-abcd-5678-efgh-ijk.abap.eu10.hana.ondemand.com'
    86  )
    87  ```
    88  
    89  In the second example, the host and credentialsId will be read from the provided Cloud Foundry service key of the specified service instance.
    90  
    91  ```groovy
    92  abapEnvironmentPullGitRepo (
    93    script: this,
    94    repositoryNames: ['/DMO/GIT_REPOSITORY', '/DMO/GIT_REPO'],
    95    abapCredentialsId: 'cfCredentialsId',
    96    cfApiEndpoint: 'https://test.server.com',
    97    cfOrg: 'cfOrg',
    98    cfSpace: 'cfSpace',
    99    cfServiceInstance: 'cfServiceInstance',
   100    cfServiceKeyName: 'cfServiceKeyName'
   101  )
   102  ```