mta deploy plugin has flag: ` --no-confirm` which is described as _"Do not require confirmation for deleting the previously deployed MTA apps"_ This flag is essentials for performing fully automated blue-green deployments.
5.8 KiB
cloudFoundryDeploy
Description
The application will be deployed to a test or production space within Cloud Foundry. Deployment can be done
- in a standard way
- in a zero downtime manner (using a blue-green deployment approach)
!!! note "Deployment supports multiple deployment tools" Currently the following are supported:
* Standard `cf push` and [Bluemix blue-green plugin](https://github.com/bluemixgaragelondon/cf-blue-green-deploy#how-to-use)
* [MTA CF CLI Plugin](https://github.com/cloudfoundry-incubator/multiapps-cli-plugin)
Prerequisites
-
Cloud Foundry organization, space and deployment user are available
-
Credentials for deployment have been configured in Jenkins with a dedicated Id
Parameters
parameter | mandatory | default | possible values |
---|---|---|---|
script | yes | ||
cloudFoundry | yes | ||
deployTool | no | cf_native | cf_native, mtaDeployPlugin |
deployType | no | standard | standard, blue-green |
keepOldInstance | no | false | true, false |
dockerImage | no | s4sdk/docker-cf-cli | |
dockerWorkspace | no | /home/piper | |
mtaDeployParameters | for deployType:standard -f for deployType:blue-green -f --no-confirm |
||
mtaExtensionDescriptor | no | '' | |
mtaPath | no | '' | |
smokeTestScript | no | blueGreenCheckScript.sh (provided by library). Can be overwritten using config property 'smokeTestScript' |
|
smokeTestStatusCode | no | 200 | |
stashContent | no | [] |
script
defines the global script environment of the Jenkinsfile run. Typicallythis
is passed to this parameter. This allows the function to access thecommonPipelineEnvironment
for retrieving e.g. configuration parameters.cloudFoundry
defines a map containing following properties:-
apiEndpoint
: Cloud Foundry API endpoint (default:https://api.cf.eu10.hana.ondemand.com
) -
appName
: App name of application to be deployed (optional) -
credentialsId
: Credentials to be used for deployment (mandatory) -
manifest
: Manifest to be used for deployment -
org
: Cloud Foundry target organization (mandatory) -
space
: Cloud Foundry target space (mandatory)Example:
cloudFoundry: [apiEndpoint: 'https://test.server.com', appName:'cfAppName', credentialsId: 'cfCredentialsId', manifest: 'cfManifest', org: 'cfOrg', space: 'cfSpace']
-
!!! note
It is also possible to use following configuration parameters instead of cloudFoundry
map:
- cfApiEndpoint
- cfAppName
- cfCredentialsId
- cfManifest
- cfOrg
- cfSpace
!!! note
Due to an incompatible change in the Cloud Foundry CLI, multiple buildpacks are not supported by this step.
If your application
contains a list of buildpacks
instead a single buildpack
, this will be automatically re-written by the step when blue-green deployment is used.
deployTool
defines the tool which should be used for deployment.deployType
defines the type of deployment, eitherstandard
deployment which results in a system downtime or a zero-downtimeblue-green
deployment.keepOldInstance
in case of ablue-green
deployment the old instance will be deleted by default. If this option is set to true the old instance will remain stopped in the Cloud Foundry space.dockerImage
defines the Docker image containing the deployment tools (like cf cli, ...) anddockerWorkspace
defines the home directory of the default user of thedockerImage
smokeTestScript
allows to specify a script which performs a check during blue-green deployment. The script gets the FQDN as parameter and returnsexit code 0
in case check returnedsmokeTestStatusCode
. More details can be found here
Currently this option is only considered for deployToolcf_native
.stashContent
defines the stash names which should be unstashed at the beginning of the step. This makes the files available in case the step is started on an empty node.
Deployment with cf_native
appName
incloudFoundry
map (orcfAppName
) defines the name of the application which will be deployed to the Cloud Foundry space.manifest
incloudFoundry
maps (orcfManifest
) defines the manifest to be used for Cloud Foundry deployment.
!!! note Cloud Foundry supports the deployment of multiple applications using a single manifest file. This option is supported with Piper.
In this case define `appName: ''` since the app name for the individual applications have to be defined via the manifest.
You can find details in the [Cloud Foundry Documentation](https://docs.cloudfoundry.org/devguide/deploy-apps/manifest.html#multi-apps)
Deployment with mtaDeployPlugin
mtaPath
define path to *.mtar for deployment.mtaExtensionDescriptor
defines additional extension descriptor file for deployment.mtaDeployParameters
defines additional parameters passed to mta deployment.
Step configuration
The following parameters can also be specified as step/stage/general parameters using the global configuration:
- cloudFoundry
- deployUser
- deployTool
- deployType
- dockerImage
- dockerWorkspace
- mtaDeployParameters
- mtaExtensionDescriptor
- mtaPath
- smokeTestScript
- smokeTestStatusCode
- stashContent
Example
cloudFoundryDeploy(
script: script,
deployType: 'blue-green',
cloudFoundry: [apiEndpoint: 'https://test.server.com', appName:'cfAppName', credentialsId: 'cfCredentialsId', manifest: 'cfManifest', org: 'cfOrg', space: 'cfSpace'],
deployTool: 'cf_native'
)