Skip to content

neoDeploy

Description

Deploys an Application to SAP Cloud Platform (SAP CP) using the SAP Cloud Platform Console Client (Neo Java Web SDK).

Prerequisites

  • SAP CP account - the account to where the application is deployed. To deploy MTA (deployMode: mta) an over existing Java application, free Java Quota of at least 1 is required, which means that this will not work on trial accounts.
  • SAP CP user for deployment - a user with deployment permissions in the given account.
  • Jenkins credentials for deployment - must be configured in Jenkins credentials with a dedicated Id.

Jenkins credentials configuration

  • Neo Java Web SDK 3.39.10 or compatible version - can be downloaded from Maven Central. This step is capable of triggering the neo deploy tool provided inside a docker image. We provide docker image ppiper/neo-cli. neo.sh needs to be contained in path, e.g by adding a symbolic link to /usr/local/bin.

  • Java 8 or compatible version - needed by the Neo-Java-Web-SDK. Java environment needs to be properly configured (JAVA_HOME, java exectutable contained in path).

Parameters

name mandatory default possible values
deployMode no mta 'mta', 'warParams', 'warPropertiesFile'
dockerEnvVars no
dockerImage no ppiper/neo-cli
dockerOptions no
extensions no []
mavenDeploymentModule no .
neo/account for deployMode=warParams
neo/application for deployMode=warParams
neo/credentialsId no CI_CREDENTIALS_ID
neo/environment no
neo/host for deployMode=warParams
neo/propertiesFile for deployMode=warPropertiesFile
neo/runtime for deployMode=warParams
neo/runtimeVersion for deployMode=warParams
neo/size no lite
neo/vmArguments no
script yes
source yes
warAction no deploy 'deploy', 'rolling-update'
  • deployMode - The deployment mode which should be used. Available options are: 'mta' - default, 'warParams' - deploying WAR file and passing all the deployment parameters via the function call, *'warPropertiesFile' - deploying WAR file and putting all the deployment parameters in a .properties file.
  • dockerEnvVars - Environment variables to set in the container, e.g. [http_proxy: 'proxy:8080'].
  • dockerImage - Name of the docker image that should be used. Configure with empty value to execute the command directly on the Jenkins system (not using a container). Omit to use the default image (cf. default_pipeline_environment.yml) Overwrite to use custom Docker image.
  • dockerOptions - Docker only: Docker options to be set when starting the container (List or String).
  • extensions - Extension files. Provided to the neo command via parameter --extensions (-e). Only valid for deploy mode mta.
  • mavenDeploymentModule - Path to the maven module which contains the deployment artifact.
  • neo/account - The SAP Cloud Platform account to deploy to.
  • neo/application - Name of the application you want to manage, configure, or deploy.
  • neo/credentialsId - The Jenkins credentials containing user and password used for SAP CP deployment.
  • neo/environment - Map of environment variables in the form of KEY: VALUE.
  • neo/host - The SAP Cloud Platform host to deploy to.
  • neo/propertiesFile - The path to the .properties file in which all necessary deployment properties for the application are defined.
  • neo/runtime - Name of SAP Cloud Platform application runtime.
  • neo/runtimeVersion - Version of SAP Cloud Platform application runtime.
  • neo/size - Compute unit (VM) size. Acceptable values: lite, pro, prem, prem-plus.
  • neo/vmArguments - String of VM arguments passed to the JVM.
  • 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.
  • source - The path to the archive for deployment to SAP CP. If not provided the following defaults are used based on the deployMode: 'mta' - The mtarFilePath from common pipeline environment is used instead. 'warParams' and 'warPropertiesFile' - The following template will be used "/target/."
  • warAction - Action mode when using WAR file mode. Available options are deploy (default) and rolling-update which performs update of an application without downtime in one go.

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
deployMode X
dockerEnvVars X
dockerImage X
dockerOptions X
extensions X
mavenDeploymentModule X
neo/account X X
neo/application X X
neo/credentialsId X X
neo/environment X X
neo/host X X
neo/propertiesFile X X
neo/runtime X X
neo/runtimeVersion X X
neo/size X X
neo/vmArguments X X
script
source X
warAction

Dependencies

The step depends on the following Jenkins plugins

The kubernetes plugin is only used if running in a kubernetes environment. Transitive dependencies are omitted.

The list might be incomplete.

Consider using the ppiper/jenkins-master docker image. This images comes with preinstalled plugins.

Side effects

none

Exceptions

  • Exception:
    • If source is not provided.
    • If propertiesFile is not provided (when using 'WAR_PROPERTIESFILE' deployment mode).
    • If application is not provided (when using 'WAR_PARAMS' deployment mode).
    • If runtime is not provided (when using 'WAR_PARAMS' deployment mode).
    • If runtimeVersion is not provided (when using 'WAR_PARAMS' deployment mode).
  • AbortException:
    • If neo-java-web-sdk is not properly installed.
  • CredentialNotFoundException:
    • If the credentials cannot be resolved.

Example

neoDeploy script: this, source: 'path/to/archiveFile.mtar', neo: [credentialsId: 'my-credentials-id', host: hana.example.org]

Example configuration:

steps:
  <...>
  neoDeploy:
    deployMode: mta
    neo:
      account: <myDeployAccount>
      host: hana.example.org