Skip to content

abapEnvironmentPullGitRepo

Description

Pulls a git repository (Software Component) to a SAP Cloud Platform ABAP Environment system. Please provide either of the following options:

  • The host and credentials the Cloud Platform ABAP Environment system itself. The credentials must be configured for the Communication Scenario SAP_COM_0510.
  • The Cloud Foundry parameters (API endpoint, organization, space), credentials, the service instance for the ABAP service and the service key for the Communication Scenario SAP_COM_0510.
  • Only provide one of those options with the respective credentials. If all values are provided, the direct communication (via host) has priority.

Prerequisites

A SAP Cloud Platform 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 Cloud Platform ABAP Environment - Software Component Test Integration (SAP_COM_0510)". This can be done manually through the respective applications on the SAP Cloud Platform 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.

Parameters

name mandatory default possible values
abapCredentialsId Yes
cfApiEndpoint No
cfOrg No
cfServiceInstance No
cfServiceKeyName No
cfSpace No
dockerEnvVars No []
dockerImage No ppiper/cf-cli
dockerName No cf
dockerOptions No []
dockerPullImage No false
dockerWorkspace No \<empty>
host No
password Yes
repositoryNames Yes
script Yes
username Yes
verbose No false true, false
  • abapCredentialsId: Jenkins credentials ID containing user and password to authenticate to the Cloud Platform ABAP Environment system or the Cloud Foundry API
  • cfApiEndpoint: Cloud Foundry API Enpoint
  • cfOrg: Cloud Foundry target organization
  • cfServiceInstance: Cloud Foundry Service Instance
  • cfServiceKeyName: Cloud Foundry Service Key
  • cfSpace: Cloud Foundry target space
  • dockerEnvVars: Environment variables to set in the container, e.g. [http_proxy: "proxy:8080"].
  • dockerImage: Name of the docker image that should be used. If empty, Docker is not used and the command is executed directly on the Jenkins system.
  • dockerName: Kubernetes only: Name of the container launching dockerImage. SideCar only: Name of the container in local network.
  • dockerOptions: Docker options to be set when starting the container.
  • dockerPullImage: Set this to 'false' to bypass a docker image pull. Usefull during development process. Allows testing of images which are available in the local registry only.
  • dockerWorkspace: Kubernetes only: Specifies a dedicated user home directory for the container which will be passed as value for environment variable HOME.
  • host: Specifies the host address of the SAP Cloud Platform ABAP Environment system
  • password: Password for either the Cloud Foundry API or the Communication Arrangement for SAP_COM_0510
  • repositoryNames: Specifies a list of Repositories (Software Components) on the SAP Cloud Platform ABAP Environment system
  • script: The common script environment of the Jenkinsfile running. Typically the reference to the script calling the pipeline step is provided with the this parameter, as in script: this. This allows the function to access the commonPipelineEnvironment for retrieving, e.g. configuration parameters.
  • username: User for either the Cloud Foundry API or the Communication Arrangement for SAP_COM_0510
  • verbose: verbose output

Step Configuration

We recommend to define values of step parameters via config.yml file.

In following sections of the config.yml the configuration is possible:

parameter general step/stage
cfApiEndpoint X X
cfOrg X X
cfServiceInstance X X
cfServiceKeyName X X
cfSpace X X
dockerEnvVars X
dockerImage X
dockerName X
dockerOptions X
dockerPullImage X
dockerWorkspace X
host X
password X
repositoryNames X
username X
verbose X

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:

abapEnvironmentPullGitRepo script: this

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

steps:
  abapEnvironmentPullGitRepo:
    repositoryNames: ['/DMO/GIT_REPOSITORY']
    abapCredentialsId: 'abapCredentialsId'
    host: '1234-abcd-5678-efgh-ijk.abap.eu10.hana.ondemand.com'

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:

steps:
  abapEnvironmentPullGitRepo:
    repositoryNames: ['/DMO/GIT_REPOSITORY']
    cfCredentialsId: 'cfCredentialsId'
    cfApiEndpoint: 'https://test.server.com'
    cfOrg: 'cfOrg'
    cfSpace: 'cfSpace'
    cfServiceInstance: 'cfServiceInstance'
    cfServiceKeyName: 'cfServiceKeyName'

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.

abapEnvironmentPullGitRepo (
  script: this,
  repositoryNames: ['/DMO/GIT_REPOSITORY'],
  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.

abapEnvironmentPullGitRepo (
  script: this,
  repositoryNames: ['/DMO/GIT_REPOSITORY', '/DMO/GIT_REPO'],
  abapCredentialsId: 'cfCredentialsId',
  cfApiEndpoint: 'https://test.server.com',
  cfOrg: 'cfOrg',
  cfSpace: 'cfSpace',
  cfServiceInstance: 'cfServiceInstance',
  cfServiceKeyName: 'cfServiceKeyName'
)