1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-14 11:03:09 +02:00
sap-jenkins-library/documentation/docs/steps/abapEnvironmentCloneGitRepo.md
Laura Veinberga e83a380c09
SAP CP to SAP BTP Rebranding (#2703)
* Update configuration.md

* Update build.md

* Update cloneRepositories.md

* Update integrationTest.md

* Update post.md

* Update prepareSystem.md

* Update publish.md

* Update configuration.md

* Update configuration.md

* Update introduction.md

* Update build.md

* Update CAP_Scenario.md

* Update CAP_Scenario.md

* Update abapEnvironmentAddons.md

* Update abapEnvironmentAddons.md

* Update abapEnvironmentTest.md

* Update changeManagement.md

* Update Readme.md

* Update Readme.md

* Update introduction.md

* Update abapEnvironmentAssembleConfirm.md

* Update abapEnvironmentAssemblePackages.md

* Update abapEnvironmentCheckoutBranch.md

* Update abapEnvironmentCloneGitRepo.md

* Update abapEnvironmentCreateSystem.md

* Update abapEnvironmentPullGitRepo.md

* Update abapEnvironmentRunATCCheck.md

* Update cloudFoundryCreateService.md

* Update cloudFoundryCreateSpace.md

* Update cloudFoundryDeleteSpace.md

* Update mtaBuild.md

* Update neoDeploy.md

* Update protecodeExecuteScan.md

* Update uiVeri5ExecuteTests.md

* Update guidedtour.md

* Update index.md

* Update configuration.md

* Update guidedtour.md

* Update configuration.md

* Update build.md

* Update CAP_Scenario.md

* Update TMS_Extension.md

* Update TMS_Extension.md

* Update abapEnvironmentAddons.md

* Update abapEnvironmentTest.md

* Update Readme.md

* Update Readme.md

* Update cloudFoundryDeploy.md

* Update influxWriteData.md

* Update neoDeploy.md

* Update CAP_Scenario.md

* Update TMS_Extension.md

* Update Readme.md

* Update Readme.md

* Update guidedtour.md

* Update guidedtour.md

* Update guidedtour.md

* Update configuration.md

Co-authored-by: Thorsten Duda <thorsten.duda@sap.com>
2021-03-19 10:51:24 +01:00

4.2 KiB

${docGenStepName}

${docGenDescription}

Prerequisites

A SAP BTP, ABAP environment system is available. On this system, a Communication User, a Communication System and a Communication Arrangement 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. In addition, the software component should be cloned into the system instance. You can do this with the step abapEnvironmentPullGitRepo.

${docGenParameters}

${docGenConfiguration}

${docJenkinsPluginDependencies}

Example: Configuration in the config.yml

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:

abapEnvironmentCheckoutBranch script: this

If you want to provide the host and credentials of the Communication Arrangement directly, the configuration could look as follows:

steps:
  abapEnvironmentCloneGitRepo:
    repositoryName: '/DMO/GIT_REPOSITORY'
    branchName: 'my-demo-branch'
    abapCredentialsId: 'abapCredentialsId'
    host: '1234-abcd-5678-efgh-ijk.abap.eu10.hana.ondemand.com'

Please note that the branchName parameter specifies the target branch you want to clone. Also keep in mind that the repositoryName parameter must define a single repository.

Another option is to read the host and credentials from the cloud foundry service key of the respective instance. Furthermore, if you want to clone multiple repositories, they can be specified in a configuration file.

With this approach the config.yml would look like this:

steps:
  abapEnvironmentCloneGitRepo:
    repositories: 'repositories.yml'
    cfCredentialsId: 'cfCredentialsId'
    cfApiEndpoint: 'https://test.server.com'
    cfOrg: 'cfOrg'
    cfSpace: 'cfSpace'
    cfServiceInstance: 'cfServiceInstance'
    cfServiceKeyName: 'cfServiceKeyName'

and the configuration file repositories.yml would look like this:

repositories:
  - name: '/DMO/GIT_REPOSITORY'
    branch: 'master'
  - name: '/DMO/SOFTWARE_COMPONENT'
    branch: 'feature'
    commitID: 'cd87a3cac2bc946b7629580e58598c3db56a26f8'

Using such a configuration file is the recommended approach. Please note that you need to use the YAML data structure as in the example above when using the repositories.yml config file. If you want to pull a specific commit, the commitID can be specified optionally for a repository.

Example: Configuration in the Jenkinsfile

It is also possible to call the steps - including all parameters - directly in the Jenkinsfile. In the first example, the host and the credentialsId of the Communication Arrangement are directly provided.

abapEnvironmentCloneGitRepo (
  script: this,
  repositoryName: '/DMO/GIT_REPOSITORY',
  branchName: 'my-demo-branch',
  abapCredentialsId: 'abapCredentialsId',
  host: '1234-abcd-5678-efgh-ijk.abap.eu10.hana.ondemand.com'
)

In the second example, the host and credentialsId will be read from the provided cloud foundry service key of the specified service instance.

abapEnvironmentCloneGitRepo (
  script: this,
  repositoryName: '/DMO/GIT_REPOSITORY',
  branchName: 'my-demo-branch'
  abapCredentialsId: 'cfCredentialsId',
  cfApiEndpoint: 'https://test.server.com',
  cfOrg: 'cfOrg',
  cfSpace: 'cfSpace',
  cfServiceInstance: 'cfServiceInstance',
  cfServiceKeyName: 'cfServiceKeyName'
)