abapEnvironmentPullGitRepo¶
Pulls a git repository to a SAP BTP ABAP Environment system
Description¶
Pulls a git repository (Software Component) to a SAP BTP ABAP Environment system. Please provide either of the following options:
- The host and credentials the BTP ABAP Environment system itself. The credentials must be configured for the Communication Scenario SAP_COM_0948.
- 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_0948.
- Only provide one of those options with the respective credentials. If all values are provided, the direct communication (via host) has priority.
Usage¶
We recommend to define values of step parameters via .pipeline/config.yml file.
In this case, calling the step is essentially reduced to defining the step name.
Calling the step can be done either in an orchestrator specific way (e.g. via a Jenkins library step) or on the command line.
library('piper-lib-os')
abapEnvironmentPullGitRepo script: this
piper abapEnvironmentPullGitRepo
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 "Software Component Management Integration (SAP_COM_0948)". 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_0948", "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 abapEnvironmentCloneGitRepo.
Parameters¶
Overview - Step¶
Name | Mandatory | Additional information |
---|---|---|
password | (yes) | pass via ENV or Jenkins credentials (abapCredentialsId ) |
script | (yes) | reference to Jenkins main pipeline script |
username | (yes) | pass via ENV or Jenkins credentials (abapCredentialsId ) |
certificateNames | no | |
cfApiEndpoint | no | |
cfOrg | no | |
cfServiceInstance | no | |
cfServiceKeyName | no | |
cfSpace | no | |
commitID | no | |
host | no | |
ignoreCommit | no | |
repositories | no | |
repositoryName | no | |
repositoryNames | no | |
verbose | no | activates debug output |
Overview - Execution Environment¶
Orchestrator-specific only
These parameters are relevant for orchestrator usage and not considered when using the command line option.
Name | Mandatory | Additional information |
---|---|---|
containerCommand | no | |
containerShell | no | |
dockerEnvVars | no | |
dockerImage | no | |
dockerName | no | |
dockerOptions | no | |
dockerPullImage | no | |
dockerVolumeBind | no | |
dockerWorkspace | no |
Details¶
certificateNames¶
file names of trusted (self-signed) server certificates - need to be stored in .pipeline/trustStore
Scope | Details |
---|---|
Aliases | - |
Type | []string |
Mandatory | no |
Default | $PIPER_certificateNames (if set) |
Secret | no |
Configuration scope |
|
Resource references | none |
cfApiEndpoint¶
Cloud Foundry API Enpoint
Scope | Details |
---|---|
Aliases | cloudFoundry/apiEndpoint |
Type | string |
Mandatory | no |
Default | $PIPER_cfApiEndpoint (if set) |
Secret | no |
Configuration scope |
|
Resource references | none |
cfOrg¶
Cloud Foundry target organization
Scope | Details |
---|---|
Aliases | cloudFoundry/org |
Type | string |
Mandatory | no |
Default | $PIPER_cfOrg (if set) |
Secret | no |
Configuration scope |
|
Resource references | none |
cfServiceInstance¶
Cloud Foundry Service Instance
Scope | Details |
---|---|
Aliases | cloudFoundry/serviceInstance |
Type | string |
Mandatory | no |
Default | $PIPER_cfServiceInstance (if set) |
Secret | no |
Configuration scope |
|
Resource references | none |
cfServiceKeyName¶
Cloud Foundry Service Key
Scope | Details |
---|---|
Aliases | - cloudFoundry/serviceKey - cloudFoundry/serviceKeyName - cfServiceKey |
Type | string |
Mandatory | no |
Default | $PIPER_cfServiceKeyName (if set) |
Secret | no |
Configuration scope |
|
Resource references | none |
cfSpace¶
Cloud Foundry target space
Scope | Details |
---|---|
Aliases | cloudFoundry/space |
Type | string |
Mandatory | no |
Default | $PIPER_cfSpace (if set) |
Secret | no |
Configuration scope |
|
Resource references | none |
commitID¶
Specifies a commitID of the repository, configured via "repositoryName" on the SAP BTP ABAP Environment system
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | no |
Default | $PIPER_commitID (if set) |
Secret | no |
Configuration scope |
|
Resource references | none |
containerCommand¶
Jenkins-specific: Used for proper environment setup.
Kubernetes only: Allows to specify start command for container created with dockerImage parameter to overwrite Piper default (/usr/bin/tail -f /dev/null).
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | no |
Default | |
Secret | no |
Configuration scope |
|
Resource references | none |
containerShell¶
Jenkins-specific: Used for proper environment setup.
Allows to specify the shell to be executed for container with containerName.
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | no |
Default | |
Secret | no |
Configuration scope |
|
Resource references | none |
dockerEnvVars¶
Jenkins-specific: Used for proper environment setup.
Environment variables to set in the container, e.g. [http_proxy: "proxy:8080"].
Scope | Details |
---|---|
Aliases | - |
Type | map[string]string |
Mandatory | no |
Default | |
Secret | no |
Configuration scope |
|
Resource references | none |
dockerImage¶
Jenkins-specific: Used for proper environment setup.
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.
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | no |
Default | ppiper/cf-cli:v12 |
Secret | no |
Configuration scope |
|
Resource references | none |
dockerName¶
Jenkins-specific: Used for proper environment setup.
Kubernetes only: Name of the container launching dockerImage. SideCar only: Name of the container in local network.
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | no |
Default | cf |
Secret | no |
Configuration scope |
|
Resource references | none |
dockerOptions¶
Jenkins-specific: Used for proper environment setup.
Docker options to be set when starting the container.
Scope | Details |
---|---|
Aliases | - |
Type | []string |
Mandatory | no |
Default | |
Secret | no |
Configuration scope |
|
Resource references | none |
dockerPullImage¶
Jenkins-specific: Used for proper environment setup.
Set this to 'false' to bypass a docker image pull. Useful during development process. Allows testing of images which are available in the local registry only.
Scope | Details |
---|---|
Aliases | - |
Type | bool |
Mandatory | no |
Default | true |
Possible values | - true - false |
Secret | no |
Configuration scope |
|
Resource references | none |
dockerVolumeBind¶
Jenkins-specific: Used for proper environment setup.
Volumes that should be mounted into the docker container.
Scope | Details |
---|---|
Aliases | - |
Type | map[string]string |
Mandatory | no |
Default | |
Secret | no |
Configuration scope |
|
Resource references | none |
dockerWorkspace¶
Jenkins-specific: Used for proper environment setup.
Kubernetes only: Specifies a dedicated user home directory for the container which will be passed as value for environment variable HOME
.
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | no |
Default | |
Secret | no |
Configuration scope |
|
Resource references | none |
host¶
Specifies the host address of the SAP BTP ABAP Environment system
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | no |
Default | $PIPER_host (if set) |
Secret | no |
Configuration scope |
|
Resource references | none |
ignoreCommit¶
ingores a commit provided via the repositories file
Scope | Details |
---|---|
Aliases | - |
Type | bool |
Mandatory | no |
Default | false |
Possible values | - true - false |
Secret | no |
Configuration scope |
|
Resource references | none |
password¶
Password for either the Cloud Foundry API or the Communication Arrangement for SAP_COM_0948
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | yes |
Default | $PIPER_password (if set) |
Secret | yes |
Configuration scope |
|
Resource references | Jenkins credential id: id: abapCredentialsId reference to: password |
repositories¶
Specifies a YAML file containing the repositories configuration
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | no |
Default | $PIPER_repositories (if set) |
Secret | no |
Configuration scope |
|
Resource references | none |
repositoryName¶
Specifies a repository (Software Component) on the SAP BTP ABAP Environment system
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | no |
Default | $PIPER_repositoryName (if set) |
Secret | no |
Configuration scope |
|
Resource references | none |
repositoryNames¶
Specifies a list of Repositories (Software Components) on the SAP BTP ABAP Environment system
Scope | Details |
---|---|
Aliases | - |
Type | []string |
Mandatory | no |
Default | $PIPER_repositoryNames (if set) |
Secret | no |
Configuration scope |
|
Resource references | none |
script¶
Jenkins-specific: Used for proper environment setup.
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.
Scope | Details |
---|---|
Aliases | - |
Type | Jenkins Script |
Mandatory | yes |
Default | |
Secret | no |
Configuration scope |
|
Resource references | none |
username¶
User for either the Cloud Foundry API or the Communication Arrangement for SAP_COM_0948
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | yes |
Default | $PIPER_username (if set) |
Secret | yes |
Configuration scope |
|
Resource references | Jenkins credential id: id: abapCredentialsId reference to: username |
verbose¶
verbose output
Scope | Details |
---|---|
Aliases | - |
Type | bool |
Mandatory | no |
Default | false |
Possible values | - true - false |
Secret | no |
Configuration scope |
|
Resource references | none |
abapCredentialsId¶
Jenkins-specific: Used for proper environment setup. See using credentials for details.
Jenkins credentials ID containing user and password to authenticate to the BTP ABAP Environment system or the Cloud Foundry API
Scope | Details |
---|---|
Aliases | - cfCredentialsId - credentialsId |
Type | string |
Configuration scope |
|
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:
repositoryName: '/DMO/GIT_REPOSITORY'
abapCredentialsId: 'abapCredentialsId'
host: '1234-abcd-5678-efgh-ijk.abap.eu10.hana.ondemand.com'
However, we recommend to use a dedicated file, e.g. repositories.yml
to specify the repositories to be pulled:
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:
repositories:
- name: '/DMO/GIT_REPOSITORY'
branch: 'main'
- name: '/DMO/GIT_REPO_COMMIT'
branch: 'feature'
commitID: 'cd87a3cac2bc946b7629580e58598c3db56a26f8'
- name: '/DMO/GIT_REPO_TAG'
branch: 'realease'
tag: 'myTag'
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.
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.
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:
repositoryName: '/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,
repositoryName: '/DMO/GIT_REPOSITORY',
CommitID: 'abcd1234'
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,
repositoryName: '/DMO/GIT_REPOSITORY',
abapCredentialsId: 'cfCredentialsId',
cfApiEndpoint: 'https://test.server.com',
cfOrg: 'cfOrg',
cfSpace: 'cfSpace',
cfServiceInstance: 'cfServiceInstance',
cfServiceKeyName: 'cfServiceKeyName'
)