github.com/jaylevin/jenkins-library@v1.230.4/documentation/docs/steps/abapEnvironmentCheckoutBranch.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 abapEnvironmentCheckoutBranch 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 28 steps: 29 abapEnvironmentCheckoutBranch: 30 repositoryName: '/DMO/GIT_REPOSITORY' 31 branchName: 'my-demo-branch' 32 abapCredentialsId: 'abapCredentialsId' 33 host: '1234-abcd-5678-efgh-ijk.abap.eu10.hana.ondemand.com' 34 ``` 35 36 Please note that the branchName parameter specifies the target branch you want to switch on. Also keep in mind that the repositoryName parameter must define a single repository. 37 38 Also you can specify a dedicated file, e.g. `repositories.yml` containing a list of repositories and the respective branches you want to switch on: 39 40 ```yaml 41 steps: 42 abapEnvironmentCheckoutBranch: 43 repositories: 'repositories.yml' 44 abapCredentialsId: 'abapCredentialsId' 45 host: '1234-abcd-5678-efgh-ijk.abap.eu10.hana.ondemand.com' 46 ``` 47 48 The associated config file, e.g. `repositories.yml` could look as follows: 49 50 ```yaml 51 repositories: 52 - name: '/DMO/GIT_REPOSITORY' 53 branch: 'master' 54 - name: '/DMO/GIT_REPO' 55 branch: 'master' 56 ``` 57 58 Please note that you need to use the YAML data structure as in the example above when using the `repositories.yml` config file. 59 For this step it is mandatory to fill the branch values. You can also use this file for the abapEnvironmentPullGitRepo step. Using this configuration file is the recommended approach. 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 abapEnvironmentCheckoutBranch: 66 repositoryName: '/DMO/GIT_REPOSITORY' 67 branchName: 'my-demo-branch' 68 cfCredentialsId: 'cfCredentialsId' 69 cfApiEndpoint: 'https://test.server.com' 70 cfOrg: 'cfOrg' 71 cfSpace: 'cfSpace' 72 cfServiceInstance: 'cfServiceInstance' 73 cfServiceKeyName: 'cfServiceKeyName' 74 ``` 75 76 ## Example: Configuration in the Jenkinsfile 77 78 It is also possible to call the steps - including all parameters - directly in the Jenkinsfile. 79 In the first example, the host and the credentialsId of the Communication Arrangement are directly provided. 80 81 ```groovy 82 abapEnvironmentCheckoutBranach ( 83 script: this, 84 repositoryName: '/DMO/GIT_REPOSITORY', 85 branchName: 'my-demo-branch', 86 abapCredentialsId: 'abapCredentialsId', 87 host: '1234-abcd-5678-efgh-ijk.abap.eu10.hana.ondemand.com' 88 ) 89 ``` 90 91 In the second example, the host and credentialsId will be read from the provided cloud foundry service key of the specified service instance. 92 93 ```groovy 94 abapEnvironmentCheckoutBranch ( 95 script: this, 96 repositoryName: '/DMO/GIT_REPOSITORY', 97 branchName: 'my-demo-branch' 98 abapCredentialsId: 'cfCredentialsId', 99 cfApiEndpoint: 'https://test.server.com', 100 cfOrg: 'cfOrg', 101 cfSpace: 'cfSpace', 102 cfServiceInstance: 'cfServiceInstance', 103 cfServiceKeyName: 'cfServiceKeyName' 104 ) 105 ```