mirror of
https://github.com/SAP/jenkins-library.git
synced 2026-06-19 22:58:55 +02:00
Merge pull request #625 from alejandraferreirovidal/neoDeploy
neoDeploy: generate docu
This commit is contained in:
@@ -1,12 +1,6 @@
|
||||
# neoDeploy
|
||||
# ${docGenStepName}
|
||||
|
||||
## Description
|
||||
|
||||
Deploys an Application to SAP Cloud Platform (SAP CP) using the SAP Cloud Platform Console Client (Neo Java Web SDK).
|
||||
|
||||
Before doing this, validates that SAP Cloud Platform Console Client is installed and the version is compatible.
|
||||
|
||||
Note that a version is formed by `major.minor.patch`, and a version is compatible to another version if the minor and patch versions are higher, but the major version is not, e.g. if 3.39.10 is the expected version, 3.39.11 and 3.40.1 would be compatible versions, but 4.0.1 would not be a compatible version.
|
||||
## ${docGenDescription}
|
||||
|
||||
## Prerequisites
|
||||
|
||||
@@ -20,97 +14,9 @@ Note that a version is formed by `major.minor.patch`, and a version is compatibl
|
||||
|
||||
* **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 when using MTA deployment method (default - MTA)
|
||||
## ${docGenParameters}
|
||||
|
||||
| parameter | mandatory | default | possible values |
|
||||
| -------------------|-----------|-------------------------------|-------------------------------------------------|
|
||||
| `script` | yes | | |
|
||||
| `neo` | no | | |
|
||||
| `deployMode` | yes | `'mta'` | `'mta'`, `'warParams'`, `'warPropertiesFile'` |
|
||||
| `neoHome` | no | | |
|
||||
| `source` | no | | |
|
||||
|
||||
The parameter `neo` is a map which contains the following parameters:
|
||||
|
||||
| parameter | mandatory | default | possible values |
|
||||
| -------------------|-----------|-------------------------------|-------------------------------------------------|
|
||||
| `account` | no | | |
|
||||
| `credentialsId` | no | `'CI_CREDENTIALS_ID'` | |
|
||||
| `host` | no | | |
|
||||
|
||||
## Parameters when using WAR file deployment method with .properties file (WAR_PROPERTIESFILE)
|
||||
|
||||
| parameter | mandatory | default | possible values |
|
||||
| -------------------|-----------|-------------------------------|-------------------------------------------------|
|
||||
| `script` | yes | | |
|
||||
| `neo` | no | | |
|
||||
| `deployMode` | yes | `'mta'` | `'mta'`, `'warParams'`, `'warPropertiesFile'` |
|
||||
| `neoHome` | no | | |
|
||||
| `source` | no | | |
|
||||
| `warAction` | yes | `'deploy'` | `'deploy'`, `'rolling-update'` |
|
||||
|
||||
The parameter `neo` is a map which contains the following parameters:
|
||||
|
||||
| parameter | mandatory | default | possible values |
|
||||
| -------------------|-----------|-------------------------------|-------------------------------------------------|
|
||||
| `credentialsId` | no | `'CI_CREDENTIALS_ID'` | |
|
||||
| `propertiesFile` | yes | | |
|
||||
|
||||
## Parameters when using WAR file deployment method without .properties file - with parameters (WAR_PARAMS)
|
||||
|
||||
| parameter | mandatory | default | possible values |
|
||||
| -------------------|-----------|-------------------------------|-------------------------------------------------|
|
||||
| `script` | yes | | |
|
||||
| `neo` | no | | |
|
||||
| `deployMode` | yes | `'mta'` | `'mta'`, `'warParams'`, `'warPropertiesFile'` |
|
||||
| `neoHome` | no | | |
|
||||
| `source` | no | | |
|
||||
| `warAction` | yes | `'deploy'` | `'deploy'`, `'rolling-update'` |
|
||||
|
||||
The parameter `neo` is a map which contains the following parameters:
|
||||
|
||||
| parameter | mandatory | default | possible values |
|
||||
| -------------------|-----------|-------------------------------|-------------------------------------------------|
|
||||
| `account` | yes | | |
|
||||
| `application` | yes | | |
|
||||
| `credentialsId` | no | `'CI_CREDENTIALS_ID'` | |
|
||||
| `environment` | | | |
|
||||
| `host` | yes | | |
|
||||
| `runtime` | yes | | |
|
||||
| `runtimeVersion` | yes | | |
|
||||
| `size` | no | `'lite'` | `'lite'`, `'pro'`, `'prem'`, `'prem-plus'` |
|
||||
| `vmArguments` | | | |
|
||||
|
||||
* `script` - The common script environment of the Jenkinsfile run. Typically `this` is passed to this parameter. This allows the function to access the [`commonPipelineEnvironment`](commonPipelineEnvironment.md) for retrieving e.g. configuration parameters.
|
||||
* `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) and `'warPropertiesFile'` (deploying WAR file and putting all the deployment parameters in a .properties file)
|
||||
* `neoHome` - The path to the `neo-java-web-sdk` tool used for SAP CP deployment. If no parameter is provided, the path is retrieved from the environment variables using the environment variable `NEO_HOME`. If no parameter and no environment variable is provided, the path is retrieved from the step configuration using the step configuration key `neoHome`. If the previous configurations are not provided, the tool is expected on the `PATH`, and if it is not available on the `PATH` an AbortException is thrown.
|
||||
* `source`- The path to the archive for deployment to SAP CP. If not provided `mtarFilePath` from commom pipeline environment is used instead.
|
||||
* `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.
|
||||
|
||||
The parameters for `neo`:
|
||||
|
||||
* `account` - The SAP Cloud Platform account to deploy to.
|
||||
* `application` - Name of the application you want to manage, configure, or deploy
|
||||
* `credentialsId` - The Jenkins credentials containing user and password used for SAP CP deployment.
|
||||
* `environment` - Map of environment variables in the form of KEY: VALUE
|
||||
* `host` - The SAP Cloud Platform host to deploy to.
|
||||
* `propertiesFile` - The path to the .properties file in which all necessary deployment properties for the application are defined.
|
||||
* `runtime` - Name of SAP Cloud Platform application runtime
|
||||
* `runtimeVersion` - Version of SAP Cloud Platform application runtime
|
||||
* `size` - Compute unit (VM) size. Acceptable values: lite, pro, prem, prem-plus.
|
||||
* `vmArguments` - String of VM arguments passed to the JVM
|
||||
|
||||
The step is prepared for being executed in docker. The corresponding parameters can be applied. See step `dockerExecute` for details.
|
||||
|
||||
## Step configuration
|
||||
|
||||
The parameter `neo` including all options can also be specified as a global parameter using the global configuration file.
|
||||
|
||||
The following parameters can also be specified as step parameters using the global configuration file:
|
||||
|
||||
* `dockerImage`
|
||||
* `neoHome`
|
||||
* `source`
|
||||
## ${docGenConfiguration}
|
||||
|
||||
## Side effects
|
||||
|
||||
|
||||
+87
-2
@@ -1,3 +1,4 @@
|
||||
import com.sap.piper.GenerateDocumentation
|
||||
import com.sap.piper.ConfigurationHelper
|
||||
import com.sap.piper.Utils
|
||||
import com.sap.piper.StepAssertions
|
||||
@@ -9,22 +10,106 @@ import groovy.transform.Field
|
||||
import static com.sap.piper.Prerequisites.checkScript
|
||||
|
||||
@Field String STEP_NAME = getClass().getName()
|
||||
|
||||
@Field Set GENERAL_CONFIG_KEYS = [
|
||||
'neo'
|
||||
'neo',
|
||||
/**
|
||||
* The SAP Cloud Platform account to deploy to.
|
||||
* @parentConfigKey neo
|
||||
* @mandatory for deployMode=warParams
|
||||
*/
|
||||
'account',
|
||||
/**
|
||||
* Name of the application you want to manage, configure, or deploy.
|
||||
* @parentConfigKey neo
|
||||
* @mandatory for deployMode=warParams
|
||||
*/
|
||||
'application',
|
||||
/**
|
||||
* The Jenkins credentials containing user and password used for SAP CP deployment.
|
||||
* @parentConfigKey neo
|
||||
*/
|
||||
'credentialsId',
|
||||
/**
|
||||
* Map of environment variables in the form of KEY: VALUE.
|
||||
* @parentConfigKey neo
|
||||
*/
|
||||
'environment',
|
||||
/**
|
||||
* The SAP Cloud Platform host to deploy to.
|
||||
* @parentConfigKey neo
|
||||
* @mandatory for deployMode=warParams
|
||||
*/
|
||||
'host',
|
||||
/**
|
||||
* The path to the .properties file in which all necessary deployment properties for the application are defined.
|
||||
* @parentConfigKey neo
|
||||
* @mandatory for deployMode=warPropertiesFile
|
||||
*/
|
||||
'propertiesFile',
|
||||
/**
|
||||
* Name of SAP Cloud Platform application runtime.
|
||||
* @parentConfigKey neo
|
||||
* @mandatory for deployMode=warParams
|
||||
*/
|
||||
'runtime',
|
||||
/**
|
||||
* Version of SAP Cloud Platform application runtime.
|
||||
* @parentConfigKey neo
|
||||
* @mandatory for deployMode=warParams
|
||||
*/
|
||||
'runtimeVersion',
|
||||
/**
|
||||
* Compute unit (VM) size. Acceptable values: lite, pro, prem, prem-plus.
|
||||
* @parentConfigKey neo
|
||||
*/
|
||||
'size',
|
||||
/**
|
||||
* String of VM arguments passed to the JVM.
|
||||
* @parentConfigKey neo
|
||||
*/
|
||||
'vmArguments'
|
||||
]
|
||||
|
||||
@Field Set STEP_CONFIG_KEYS = GENERAL_CONFIG_KEYS.plus([
|
||||
/**
|
||||
* @see dockerExecute
|
||||
*/
|
||||
'dockerEnvVars',
|
||||
/**
|
||||
* @see dockerExecute
|
||||
*/
|
||||
'dockerImage',
|
||||
/**
|
||||
* @see dockerExecute
|
||||
*/
|
||||
'dockerOptions',
|
||||
'neoHome',
|
||||
/**
|
||||
* The path to the archive for deployment to SAP CP. If not provided `mtarFilePath` from commom pipeline environment is used instead.
|
||||
*/
|
||||
'source'
|
||||
])
|
||||
|
||||
@Field Set PARAMETER_KEYS = STEP_CONFIG_KEYS.plus([
|
||||
/**
|
||||
* 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.
|
||||
* @possibleValues 'mta', 'warParams', 'warPropertiesFile'
|
||||
*/
|
||||
'deployMode',
|
||||
/**
|
||||
* 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.
|
||||
* @possibleValues 'deploy', 'rolling-update'
|
||||
*/
|
||||
'warAction'
|
||||
])
|
||||
|
||||
/**
|
||||
* Deploys an Application to SAP Cloud Platform (SAP CP) using the SAP Cloud Platform Console Client (Neo Java Web SDK).
|
||||
*/
|
||||
@GenerateDocumentation
|
||||
void call(parameters = [:]) {
|
||||
handlePipelineStepErrors(stepName: STEP_NAME, stepParameters: parameters) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user