Skip to content

cloudFoundryDeleteService

Description

Delete CloudFoundryService

Prerequisites

This step is for deleting an existing service on Cloud Foundry. You need to provide the Cloud Foundry API Endpoint, the Organisation as well as the Space and the respective Service Instance Name you want to delete. Furthermore you will need to provide the Cloud Foundry Login Credentials, which must be stored in the Jenkins Configuration. Additionally you can set the cfDeleteServiceKeys flag for deleting all Service Keys that belong to the respective Service.

Parameters

name mandatory default possible values
cfApiEndpoint Yes
cfCredentialsId Yes
cfDeleteServiceKeys No false true, false
cfOrg Yes
cfServiceInstance Yes
cfSpace Yes
dockerEnvVars No []
dockerImage No ppiper/cf-cli
dockerName No cf
dockerOptions No []
dockerPullImage No false
dockerWorkspace No /home/piper
password Yes
script Yes
username Yes
verbose No false true, false
  • cfApiEndpoint: Cloud Foundry API endpoint
  • cfCredentialsId: Jenkins credentials ID containing user and password to authenticate to the Cloud Foundry API
  • cfDeleteServiceKeys: Parameter to force deletion of Cloud Foundry Service Keys
  • cfOrg: CF org
  • cfServiceInstance: Parameter of ServiceInstance Name to delete CloudFoundry Service
  • cfSpace: CF 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.
  • password: User Password for CF User
  • 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 or E-Mail for CF
  • 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
cfDeleteServiceKeys X
cfOrg X X
cfServiceInstance X X
cfSpace X X
dockerEnvVars X
dockerImage X
dockerName X
dockerOptions X
dockerPullImage X
dockerWorkspace X
password X
username X
verbose X

Example

In this example, the Cloud Foundry Configuration is directly provided with the respective Credentials for the used User/Account.

cloudFoundryDeleteService(
    cfApiEndpoint : 'https://test.server.com',
    cfOrg : 'cforg',
    cfspace: 'cfspace',
    cfserviceInstance: 'cfserviceInstance',
    cfCredentialsId: 'cfcredentialsId',
    cfDeleteServiceKeys: true,
)