mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-01-30 05:59:39 +02:00
Merge pull request #17 from o-liver/documentation
Documentation overhaul
This commit is contained in:
commit
14e43d9e0e
@ -6,6 +6,7 @@ Provides file system related utility functions.
|
||||
## Constructor
|
||||
Since there are only static utility methods there is no need for instantiating objects.
|
||||
|
||||
|
||||
## Method Details
|
||||
|
||||
### validateDirectory(dir)
|
||||
@ -14,8 +15,7 @@ Since there are only static utility methods there is no need for instantiating o
|
||||
Checks whether a file exists and is a directory.
|
||||
|
||||
#### Parameters
|
||||
|
||||
* `dir` - directory to be checked. In case it is relative path it is checked against the
|
||||
* `dir` - The directory to be checked. In case it is relative path it is checked against the
|
||||
current working directory. In case of doubt use the absolute path (prefix the directory with `pwd`).
|
||||
|
||||
#### Return value
|
||||
@ -25,23 +25,24 @@ none
|
||||
none
|
||||
|
||||
#### Exceptions
|
||||
* `IllegalArgumentException`: If the parameter `dir` is null or empty.
|
||||
* `AbortException`: If the directory does not exist or is not a directory.
|
||||
* `IllegalArgumentException`:
|
||||
* If the parameter `dir` is null or empty.
|
||||
* `AbortException`:
|
||||
* If the directory does not exist or is not a directory.
|
||||
|
||||
#### Example
|
||||
|
||||
```groovy
|
||||
FileUtils.validateDirectory('/path/to/dir')
|
||||
```
|
||||
|
||||
|
||||
### validateDirectoryIsNotEmpty(dir)
|
||||
|
||||
#### Description
|
||||
Check whether a directory is not empty. Before the directory is checked, `validateDirectory(dir)` is executed.
|
||||
|
||||
#### Parameters
|
||||
|
||||
* `dir` - directory to be checked. In case it is relative path it is checked against the
|
||||
* `dir` - The directory to be checked. In case it is relative path it is checked against the
|
||||
current working directory. In case of doubt use the absolute path (prefix the directory with `pwd`).
|
||||
|
||||
#### Return value
|
||||
@ -51,11 +52,12 @@ none
|
||||
none
|
||||
|
||||
#### Exceptions
|
||||
* `IllegalArgumentException`: If the parameter `dir` is null or empty.
|
||||
* `AbortException`: If the directory does not exist or is not a directory or the directory is empty.
|
||||
* `IllegalArgumentException`:
|
||||
* If the parameter `dir` is null or empty.
|
||||
* `AbortException`:
|
||||
* If the directory does not exist or is not a directory or the directory is empty.
|
||||
|
||||
#### Example
|
||||
|
||||
```groovy
|
||||
FileUtils.validateDirectoryIsNotEmpty('/path/to/dir')
|
||||
```
|
||||
|
@ -6,25 +6,22 @@ Provides utility functions.
|
||||
## Constructors
|
||||
|
||||
### Utils()
|
||||
|
||||
Default no-argument constructor. Instances of the Utils class does not hold any instance specific state.
|
||||
|
||||
#### Example
|
||||
|
||||
```groovy
|
||||
new Utils()
|
||||
```
|
||||
|
||||
|
||||
## Method Details
|
||||
|
||||
### getMandatoryParameter(Map map, paramName, defaultValue)
|
||||
### getMandatoryParameter(map, paramName, defaultValue)
|
||||
|
||||
#### Description
|
||||
|
||||
Retrieves the parameter value for parameter `paramName` from parameter map `map`. In case there is no parameter with the given key contained in parameter map `map` `defaultValue` is returned. In case there no such parameter contained in `map` and `defaultValue` is `null` an exception is thrown.
|
||||
|
||||
#### Parameters
|
||||
|
||||
* `map` - A map containing configuration parameters.
|
||||
* `paramName` - The key of the parameter which should be looked up.
|
||||
* `defaultValue` - The value which is returned in case there is no parameter with key `paramName` contained in `map`.
|
||||
@ -33,14 +30,13 @@ Retrieves the parameter value for parameter `paramName` from parameter map `map`
|
||||
The value to the parameter to be retrieved, or the default value if the former is `null`, either since there is no such key or the key is associated with value `null`. In case the parameter is not defined or the value for that parameter is `null`and there is no default value an exception is thrown.
|
||||
|
||||
#### Side effects
|
||||
|
||||
none
|
||||
|
||||
#### Exceptions
|
||||
* `Exception`: If the value to be retrieved and the default value are both `null`.
|
||||
* `Exception`:
|
||||
* If the value to be retrieved and the default value are both `null`.
|
||||
|
||||
#### Example
|
||||
|
||||
```groovy
|
||||
def utils = new Utils()
|
||||
def parameters = [DEPLOY_ACCOUNT: 'deploy-account']
|
||||
@ -53,21 +49,17 @@ assert utils.getMandatoryParameter(parameters, 'DEPLOY_USER', 'john_doe') == 'jo
|
||||
#### Description
|
||||
Retrieves the git-remote-url and git-branch. The parameters 'GIT_URL' and 'GIT_BRANCH' are retrieved from Jenkins job configuration. If these are not set, the git-url and git-branch are retrieved from the same repository where the Jenkinsfile resides.
|
||||
|
||||
|
||||
#### Parameters
|
||||
|
||||
* `script` The script calling the method. Basically the `Jenkinsfile`. It is assumed that the script provides access to the parameters defined when launching the build, especially `GIT_URL`and `GIT_BRANCH`.
|
||||
* `script` - The script calling the method. Basically the `Jenkinsfile`. It is assumed that the script provides access to the parameters defined when launching the build, especially `GIT_URL` and `GIT_BRANCH`.
|
||||
|
||||
#### Return value
|
||||
|
||||
A map containing git-url and git-branch: `[url: gitUrl, branch: gitBranch]`
|
||||
|
||||
## Exceptions
|
||||
|
||||
* `AbortException`: if only one of `GIT_URL`, `GIT_BRANCH` is set in the Jenkins job configuration.
|
||||
* `AbortException`:
|
||||
* If only one of `GIT_URL`, `GIT_BRANCH` is set in the Jenkins job configuration.
|
||||
|
||||
#### Example
|
||||
|
||||
```groovy
|
||||
def gitCoordinates = new Utils().retrieveGitCoordinates(this)
|
||||
def gitUrl = gitCoordinates.url
|
||||
|
@ -3,159 +3,145 @@
|
||||
## Description
|
||||
Handles version numbers.
|
||||
|
||||
|
||||
## Constructors
|
||||
|
||||
### Version(major, minor, patch)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| parameter | mandatory | default | possible values |
|
||||
| ----------|-----------|---------|-----------------|
|
||||
| major | yes | | |
|
||||
| minor | yes | | |
|
||||
| patch | no | `-1` | |
|
||||
|
||||
* `major` - the major version number.
|
||||
* `minor` - the minor version number.
|
||||
* `patch` - the patch version number.
|
||||
* `major` - The major version number.
|
||||
* `minor` - The minor version number.
|
||||
* `patch` - The patch version number.
|
||||
|
||||
#### Exceptions
|
||||
|
||||
* `IllegalArgumentException`: If the `major` or `minor` version number is less than `0`.
|
||||
* `IllegalArgumentException`:
|
||||
* If the `major` or `minor` version number is less than `0`.
|
||||
|
||||
#### Example
|
||||
|
||||
```groovy
|
||||
def toolVersion = new Version(1, 2, 3)
|
||||
```
|
||||
|
||||
|
||||
### Version(text)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| parameter | mandatory | default | possible values |
|
||||
| ----------|-----------|---------|-----------------|
|
||||
| text | yes | | |
|
||||
|
||||
* `text` - as an alternative to calling the constructor with `major`, `minor`, and `patch` version numbers, you can pass this as a String of format 'major.minor.patch'.
|
||||
* `text` - As an alternative to calling the constructor with `major`, `minor`, and `patch` version numbers, you can pass this as a String of format 'major.minor.patch'.
|
||||
|
||||
#### Exceptions
|
||||
|
||||
* `IllegalArgumentException`: If the `text` parameter is `null` or empty.
|
||||
* `AbortException`: If the version `text` has an unexpected format.
|
||||
* `IllegalArgumentException`:
|
||||
* If the `text` parameter is `null` or empty.
|
||||
* `AbortException`:
|
||||
* If the version `text` has an unexpected format.
|
||||
|
||||
#### Example
|
||||
|
||||
```groovy
|
||||
def toolVersion = new Version('1.2.3')
|
||||
```
|
||||
|
||||
|
||||
## Method Details
|
||||
|
||||
### equals
|
||||
### equals(version)
|
||||
|
||||
#### Description
|
||||
Indicates whether some other version instance is equal to this one. The two versions are considered equal when they have the same `major`, `minor` and `patch` version number.
|
||||
|
||||
#### Parameters
|
||||
|
||||
* `version` - the Version instance to compare to this Version instance.
|
||||
* `version` - The Version instance to compare to this Version instance.
|
||||
|
||||
#### Return value
|
||||
|
||||
`true` if `major`, `minor` and `patch` version numbers are equal to each other. Otherwise `false`.
|
||||
|
||||
#### Side effects
|
||||
|
||||
none
|
||||
|
||||
#### Exceptions
|
||||
|
||||
* `AbortException`: If the parameter `version` is `null`.
|
||||
* `AbortException`:
|
||||
* If the parameter `version` is `null`.
|
||||
|
||||
#### Example
|
||||
|
||||
```groovy
|
||||
assert new Version('1.2.3').equals(new Version('1.2.3'))
|
||||
```
|
||||
|
||||
### isCompatibleVersion
|
||||
|
||||
### isCompatibleVersion(version)
|
||||
|
||||
#### Description
|
||||
Checks whether a version is compatible. Two versions are compatible if the major version number is the same, while the minor and patch version number are the same or higher.
|
||||
|
||||
#### Parameters
|
||||
|
||||
* `version` - the Version instance to compare to this Version instance.
|
||||
* `version` - The Version instance to compare to this Version instance.
|
||||
|
||||
#### Return value
|
||||
|
||||
`true` if this Version instance is compatible to the other Version instance. Otherwise `false`.
|
||||
|
||||
#### Side effects
|
||||
|
||||
none
|
||||
|
||||
#### Exceptions
|
||||
|
||||
* `AbortException`: If the parameter `version` is `null`.
|
||||
* `AbortException`:
|
||||
* If the parameter `version` is `null`.
|
||||
|
||||
#### Example
|
||||
|
||||
```groovy
|
||||
assert new Version('1.2.3').isCompatibleVersion(new Version('1.3.1'))
|
||||
```
|
||||
|
||||
### isHigher
|
||||
|
||||
### isHigher(version)
|
||||
|
||||
#### Description
|
||||
Checks whether this Version instance is higher than the other Version instance.
|
||||
|
||||
#### Parameters
|
||||
|
||||
* `version` - the Version instance to compare to this Version instance.
|
||||
* `version` - The Version instance to compare to this Version instance.
|
||||
|
||||
#### Return value
|
||||
|
||||
`true` if this Version instance is higher than the other Version instance. Otherwise `false`.
|
||||
|
||||
#### Side effects
|
||||
|
||||
none
|
||||
|
||||
#### Exceptions
|
||||
|
||||
* `AbortException`: If the parameter `version` is `null`.
|
||||
* `AbortException`:
|
||||
* If the parameter `version` is `null`.
|
||||
|
||||
#### Example
|
||||
|
||||
```groovy
|
||||
assert new Version('1.2.3').isHigher(new Version('1.1.6'))
|
||||
```
|
||||
|
||||
### toString
|
||||
|
||||
### toString()
|
||||
|
||||
#### Description
|
||||
Print the version number in format '<major>.<minor>.<patch>'. If no patch version number exists the format is '<major>.<minor>'.
|
||||
|
||||
#### Parameters
|
||||
|
||||
none
|
||||
|
||||
#### Return value
|
||||
|
||||
A String consisting of `major`, `minor` and if available `patch`, separated by dots.
|
||||
|
||||
#### Side effects
|
||||
|
||||
none
|
||||
|
||||
#### Exceptions
|
||||
|
||||
none
|
||||
|
||||
#### Example
|
||||
|
||||
```groovy
|
||||
assert "${new Version('1.2.3')}" == "1.2.3"
|
||||
```
|
||||
|
@ -6,6 +6,7 @@ Provides project specific settings.
|
||||
## Prerequisites
|
||||
none
|
||||
|
||||
|
||||
## Method details
|
||||
|
||||
### getConfigProperties()
|
||||
@ -27,18 +28,18 @@ none
|
||||
none
|
||||
|
||||
#### Example
|
||||
|
||||
```groovy
|
||||
commonPipelineEnvironment.getConfigProperties()
|
||||
```
|
||||
|
||||
|
||||
### setConfigProperties(configuration)
|
||||
|
||||
#### Description
|
||||
Sets the map of configuration properties. An existing map is overwritten.
|
||||
Sets the map of configuration properties. Any existing map is overwritten.
|
||||
|
||||
#### Parameters
|
||||
* configuration - A map containing the new configuration
|
||||
* `configuration` - A map containing the new configuration
|
||||
|
||||
#### Return value
|
||||
none
|
||||
@ -54,16 +55,17 @@ none
|
||||
commonPipelineEnvironment.setConfigProperties([DEPLOY_HOST: 'deploy-host.com', DEPLOY_ACCOUNT: 'deploy-account'])
|
||||
```
|
||||
|
||||
### getConfigProperty(key)
|
||||
|
||||
### getConfigProperty(property)
|
||||
|
||||
#### Description
|
||||
Gets a specific value from the configuration property.
|
||||
|
||||
#### Parameters
|
||||
* key - The key of the property.
|
||||
* `property` - The key of the property.
|
||||
|
||||
#### Return value
|
||||
* The value associated with key `key`. `null` is returned in case the property does not exist.
|
||||
* The value associated with key `property`. `null` is returned in case the property does not exist.
|
||||
|
||||
#### Side effects
|
||||
none
|
||||
@ -76,14 +78,15 @@ none
|
||||
commonPipelineEnvironment.getConfigProperty('DEPLOY_HOST')
|
||||
```
|
||||
|
||||
### setConfigProperty(key, value)
|
||||
|
||||
### setConfigProperty(property, value)
|
||||
|
||||
#### Description
|
||||
Sets property `key` with value `value`. Any existing property with key `key`is overwritten.
|
||||
Sets property `property` with value `value`. Any existing property with key `property` is overwritten.
|
||||
|
||||
#### Parameters
|
||||
* `key` The key
|
||||
* `value` The value
|
||||
* `property` - The key of the property.
|
||||
* `value` - The value of the property.
|
||||
|
||||
#### Return value
|
||||
none
|
||||
@ -95,19 +98,22 @@ none
|
||||
none
|
||||
|
||||
#### Example
|
||||
|
||||
```groovy
|
||||
commonPipelineEnvironment.setConfigProperty('DEPLOY_HOST', 'my-deploy-host.com')
|
||||
```
|
||||
|
||||
|
||||
### getMtarFileName()
|
||||
|
||||
#### Description
|
||||
Returns the name of the mtar file.
|
||||
Returns the path of the mtar archive file.
|
||||
|
||||
#### Parameters
|
||||
none
|
||||
|
||||
#### Return value
|
||||
The path of the mtar archive file.
|
||||
|
||||
#### Side effects
|
||||
none
|
||||
|
||||
@ -115,7 +121,6 @@ none
|
||||
none
|
||||
|
||||
#### Example
|
||||
|
||||
```groovy
|
||||
commonPipelineEnvironment.getMtarFileName()
|
||||
```
|
||||
@ -123,10 +128,10 @@ commonPipelineEnvironment.getMtarFileName()
|
||||
### setMtarFileName(name)
|
||||
|
||||
#### Description
|
||||
Sets the name of the mtar file. Any old value is discarded.
|
||||
Sets the path of the mtar archive file. Any old value is discarded.
|
||||
|
||||
#### Parameters
|
||||
The name of the mtar file name.
|
||||
* `mtarFilePath` - The path of the mtar archive file name.
|
||||
|
||||
#### Side effects
|
||||
none
|
||||
@ -135,7 +140,6 @@ none
|
||||
none
|
||||
|
||||
#### Example
|
||||
|
||||
```groovy
|
||||
commonPipelineEnvironment.setMtarFileName('foo')
|
||||
commonPipelineEnvironment.setMtarFileName('path/to/foo.mtar')
|
||||
```
|
||||
|
@ -1,26 +0,0 @@
|
||||
# getConfigProperties
|
||||
|
||||
## Description
|
||||
Gets a `map` of configuration properties stored in the `commonPipelineEnvironment` object.
|
||||
|
||||
## Parameters
|
||||
|
||||
none
|
||||
|
||||
## Return values
|
||||
|
||||
A `map` of the current configuration properties setup in the `commonPipelineEnvironment` object.
|
||||
|
||||
## Side effects
|
||||
|
||||
none
|
||||
|
||||
## Exceptions
|
||||
|
||||
none
|
||||
|
||||
## Example
|
||||
|
||||
```groovy
|
||||
def propertiesMap = commonPipelineEnvironment.getConfigProperties()
|
||||
```
|
@ -1,30 +0,0 @@
|
||||
# getConfigProperty
|
||||
|
||||
## Description
|
||||
Gets a specific value from the configuration properties stored in the `commonPipelineEnvironment` object.
|
||||
|
||||
## Parameters
|
||||
|
||||
| parameter | mandatory | default | possible values |
|
||||
| -----------|-----------|---------|-----------------|
|
||||
| `property` | yes | | |
|
||||
|
||||
* `property` - the specific property to be retrieved from the configuration properties stored in the `commonPipelineEnvironment` object.
|
||||
|
||||
## Return values
|
||||
|
||||
The value of the property in the configuration properties stored in the `commonPipelineEnvironment` object.
|
||||
|
||||
## Side effects
|
||||
|
||||
none
|
||||
|
||||
## Exceptions
|
||||
|
||||
none
|
||||
|
||||
## Example
|
||||
|
||||
```groovy
|
||||
def deployHost = commonPipelineEnvironment.getConfigProperty('DEPLOY_HOST')
|
||||
```
|
@ -1,26 +0,0 @@
|
||||
# getMtarFileName
|
||||
|
||||
## Description
|
||||
Gets the file name of the mtar archive. The mtar archive is created in the [mtaBuild](../../steps/mtaBuild) step.
|
||||
|
||||
## Parameters
|
||||
|
||||
none
|
||||
|
||||
## Return values
|
||||
|
||||
The mtar archive file name stored in the `commonPipelineEnvironment` object.
|
||||
|
||||
## Side effects
|
||||
|
||||
none
|
||||
|
||||
## Exceptions
|
||||
|
||||
none
|
||||
|
||||
## Example
|
||||
|
||||
```groovy
|
||||
def mtarFileName = commonPipelineEnvironment.getMtarFileName()
|
||||
```
|
@ -1,33 +0,0 @@
|
||||
# setConfigProperties
|
||||
|
||||
## Description
|
||||
Sets the map of configuration properties stored in the `commonPipelineEnvironment` object.
|
||||
Any existing `configProperties` map is overwritten.
|
||||
|
||||
## Parameters
|
||||
|
||||
| parameter | mandatory | default | possible values |
|
||||
| ----------|-----------|---------|-----------------|
|
||||
| `map` | yes | | |
|
||||
|
||||
* `map` - the map of configuration properties to set in the `commonPipelineEnvironment` object.
|
||||
|
||||
## Return values
|
||||
|
||||
none
|
||||
|
||||
## Side effects
|
||||
|
||||
none
|
||||
|
||||
## Exceptions
|
||||
|
||||
none
|
||||
|
||||
## Example
|
||||
|
||||
```groovy
|
||||
def map = [DEPLOY_HOST: 'deploy-host.com', DEPLOY_ACCOUNT: 'deploy-account']
|
||||
commonPipelineEnvironment.setConfigProperties(map)
|
||||
```
|
||||
|
@ -1,34 +0,0 @@
|
||||
# setConfigProperty
|
||||
|
||||
## Description
|
||||
Sets a specific property of the configuration stored in the `commonPipelineEnvironment` object.
|
||||
Any existing property is overwritten.
|
||||
|
||||
## Parameters
|
||||
|
||||
| parameter | mandatory | default | possible values |
|
||||
| -----------|-----------|---------|-----------------|
|
||||
| `property` | yes | | |
|
||||
| `value` | yes | | |
|
||||
|
||||
* `property` - property key to set in the `commonPipelineEnvironment` object.
|
||||
* `value`- the value to set the property to.
|
||||
|
||||
## Return values
|
||||
|
||||
none
|
||||
|
||||
## Side effects
|
||||
|
||||
none
|
||||
|
||||
## Exceptions
|
||||
|
||||
none
|
||||
|
||||
## Example
|
||||
|
||||
```groovy
|
||||
commonPipelineEnvironment.setConfigProperty('DEPLOY_HOST', 'my-deploy-host.com')
|
||||
```
|
||||
|
@ -1,31 +0,0 @@
|
||||
# setMtarFileName
|
||||
|
||||
## Description
|
||||
Sets the file name of the mtar archive. The mtar archive is created in the [mtaBuild](../../steps/mtaBuild) step.
|
||||
This does not change the file name of the actual mtar archive file.
|
||||
|
||||
## Parameters
|
||||
|
||||
| parameter | mandatory | default | possible values |
|
||||
| ---------------|-----------|---------|-----------------|
|
||||
| `mtarFileName` | yes | | |
|
||||
|
||||
* `mtarFileName` - the String to be set as value for `mtarFileName` in `commonPipelineEnvironment`.
|
||||
|
||||
## Return values
|
||||
|
||||
none
|
||||
|
||||
## Side effects
|
||||
|
||||
none
|
||||
|
||||
## Exceptions
|
||||
|
||||
none
|
||||
|
||||
## Example
|
||||
|
||||
```groovy
|
||||
commonPipelineEnvironment.setMtarFileName('my.file.name.mtar')
|
||||
```
|
@ -7,7 +7,6 @@ Used by other steps to make error analysis easier. Lists parameters and other da
|
||||
none
|
||||
|
||||
## Parameters
|
||||
|
||||
| parameter | mandatory | default | possible values |
|
||||
| -----------------|-----------|---------|-----------------|
|
||||
| `stepParameters` | yes | | |
|
||||
@ -16,7 +15,7 @@ none
|
||||
|
||||
* `stepParameters` - The parameters from the step to be executed. The list of parameters is then shown in the console output.
|
||||
* `stepName` - The name of the step executed to be shown in the console output.
|
||||
* `echoDetails` - if set to true will output the following as console output:
|
||||
* `echoDetails` - If set to true the following will be output to the console:
|
||||
1. Step beginning: `--- BEGIN LIBRARY STEP: ${stepName}.groovy ---`
|
||||
2. Step end: `--- END LIBRARY STEP: ${stepName}.groovy ---`
|
||||
3. Step errors:
|
||||
@ -40,19 +39,15 @@ none
|
||||
```
|
||||
|
||||
## Return value
|
||||
|
||||
none
|
||||
|
||||
## Side effects
|
||||
|
||||
none
|
||||
|
||||
## Exceptions
|
||||
|
||||
none
|
||||
|
||||
## Example
|
||||
|
||||
```groovy
|
||||
handlePipelineStepErrors (stepName: 'executeHealthCheck', stepParameters: parameters) {
|
||||
def url = new Utils().getMandatoryParameter(parameters, 'url', null)
|
||||
|
@ -4,35 +4,29 @@
|
||||
Executes the SAP MTA Archive Builder to create an mtar archive of the application.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
* **SAP MTA Archive Builder** - available for download on the SAP Marketplace.
|
||||
* **Java 8 or higher** - necessary to run the `mta.jar` file.
|
||||
* **NodeJS installed** - the MTA Builder uses `npm` to download node module dependencies such as `grunt`.
|
||||
|
||||
## Parameters
|
||||
|
||||
| parameter | mandatory | default | possible values |
|
||||
| -----------------|-----------|-----------------------------------|--------------------|
|
||||
| `script` | yes | | |
|
||||
| `buildTarget` | yes | | 'CF', 'NEO', 'XSA' |
|
||||
| `mtaJarLocation` | no | | |
|
||||
|
||||
* `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`](commonPipelineEnvironment.md) for retrieving, for example, configuration parameters.
|
||||
* `buildTarget` The target platform to which the mtar can be deployed.
|
||||
* `mtaJarLocation` The path of the `mta.jar` file. If no parameter is provided, the path is retrieved from the Jenkins environment variables using `env.MTA_JAR_LOCATION`. If the Jenkins environment variable is not set it is assumed that `mta.jar` is located in the current working directory.
|
||||
* `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`](commonPipelineEnvironment.md) for retrieving, for example, configuration parameters.
|
||||
* `buildTarget` - The target platform to which the mtar can be deployed.
|
||||
* `mtaJarLocation` - The path of the `mta.jar` file. If no parameter is provided, the path is retrieved from the Jenkins environment variables using `env.MTA_JAR_LOCATION`. If the Jenkins environment variable is not set it is assumed that `mta.jar` is located in the current working directory.
|
||||
|
||||
## Return value
|
||||
|
||||
The file name of the resulting archive is returned with this step. The file name is extracted from the key `ID` defined in `mta.yaml`.
|
||||
|
||||
## Side effects
|
||||
|
||||
1. The file name of the resulting archive is written to the `commonPipelineEnvironment` with variable name `mtarFileName`.
|
||||
2. As version number the timestamp is written into the `mta.yaml` file, that is packaged into the built archive.
|
||||
|
||||
## Exceptions
|
||||
|
||||
* `AbortException`
|
||||
* `AbortException`:
|
||||
* If there is an invalid `buildTarget`.
|
||||
* If there is no key `ID` inside the `mta.yaml` file.
|
||||
|
||||
|
@ -4,7 +4,6 @@
|
||||
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.
|
||||
* **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.
|
||||
@ -18,44 +17,39 @@ needs to be extracted into the folder provided by `neoHome`. In case this parame
|
||||
* **Java 8 or higher** - needed by the *Neo-Java-Web-SDK*
|
||||
|
||||
## Parameters
|
||||
|
||||
| parameter | mandatory | default | possible values |
|
||||
| -------------------|-----------|------------------------------------------------------------------------------------------|-----------------|
|
||||
| -------------------|-----------|----------------------------------------------------------------------------------------------|-----------------|
|
||||
| `script` | yes | | |
|
||||
| `archivePath` | yes | | |
|
||||
| `deployHost` | no | `'DEPLOY_HOST'` from `commonPipelineEnvironment` | |
|
||||
| `deployAccount` | no | `'CI_DEPLOY_ACCOUNT'` from `commonPipelineEnvironment` | |
|
||||
| `neoCredentialsId` | no | `'CI_CREDENTIALS_ID'` | |
|
||||
| `neoHome` | no | Environment is checked for `NEO_HOME`, otherwise the neo toolset is expected in the path | |
|
||||
| `neoHome` | no | Environment is checked for `NEO_HOME`, <br>otherwise the neo toolset is expected in the path | |
|
||||
|
||||
* `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.
|
||||
* `archivePath` The path to the archive for deployment to SAP CP.
|
||||
* `deployHost` The SAP Cloud Platform host to deploy to.
|
||||
* `deployAccount` The SAP Cloud Platform account to deploy to.
|
||||
* `credentialsId` The Jenkins credentials containing user and password used for SAP CP deployment.
|
||||
* `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 Jenkins environment variables using `env.NEO_HOME`. If this Jenkins environment variable is not set it is assumed that the tool is available in the `PATH`.
|
||||
* `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.
|
||||
* `archivePath`- The path to the archive for deployment to SAP CP.
|
||||
* `deployHost` - The SAP Cloud Platform host to deploy to.
|
||||
* `deployAccount` - The SAP Cloud Platform account to deploy to.
|
||||
* `credentialsId` - The Jenkins credentials containing user and password used for SAP CP deployment.
|
||||
* `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 Jenkins environment variables using `env.NEO_HOME`. If this Jenkins environment variable is not set it is assumed that the tool is available in the `PATH`.
|
||||
|
||||
## Return value
|
||||
|
||||
none
|
||||
|
||||
## Side effects
|
||||
|
||||
none
|
||||
|
||||
## Exceptions
|
||||
|
||||
* `Exception`
|
||||
* `Exception`:
|
||||
* If `archivePath` is not provided.
|
||||
* `AbortException`
|
||||
* `AbortException`:
|
||||
* If neo-java-web-sdk is not installed, or `neoHome`is wrong.
|
||||
* If `deployHost` is wrong.
|
||||
* If `deployAccount` is wrong.
|
||||
* `CredentialNotFoundException`
|
||||
* `CredentialNotFoundException`:
|
||||
* If the credentials cannot be resolved.
|
||||
|
||||
## Example
|
||||
|
||||
```groovy
|
||||
neoDeploy script: this, archivePath: 'path/to/archiveFile.mtar', credentialsId: 'my-credentials-id'
|
||||
```
|
||||
|
@ -8,7 +8,6 @@ Initializes the [`commonPipelineEnvironment`](commonPipelineEnvironment.md), whi
|
||||
Then subsequent pipeline steps consume the information from `commonPipelineEnvironment`; it does not need to be passed to pipeline steps explicitly.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
* A **configuration file** with properties (default location: `.pipeline/config.properties`). The property values are used as default values in many pipeline steps.
|
||||
|
||||
## Parameters
|
||||
@ -22,19 +21,15 @@ Initializes the [`commonPipelineEnvironment`](commonPipelineEnvironment.md), whi
|
||||
* `configFile` - Property file defining project specific settings.
|
||||
|
||||
## Return value
|
||||
|
||||
none
|
||||
|
||||
## Side effects
|
||||
|
||||
none
|
||||
|
||||
## Exceptions
|
||||
|
||||
none
|
||||
|
||||
## Example
|
||||
|
||||
```groovy
|
||||
setupCommonPipelineEnvironment script: this
|
||||
```
|
||||
|
@ -1,12 +1,13 @@
|
||||
# toolValidate
|
||||
|
||||
## Description
|
||||
|
||||
Checks the existence and compatibility of a tool, necessary for a successful pipeline execution.
|
||||
In case a violation is found, an exception is raised.
|
||||
|
||||
## Parameters
|
||||
## Prerequisites
|
||||
none
|
||||
|
||||
## Parameters
|
||||
| parameter | mandatory | default | possible values |
|
||||
| -----------------|-----------|-----------------------------------|----------------------------|
|
||||
| `tool` | yes | | 'java', 'mta', 'neo' |
|
||||
@ -15,15 +16,19 @@ In case a violation is found, an exception is raised.
|
||||
* `tool` The tool that is checked for existence and compatible version.
|
||||
* `home` The location in the file system where Jenkins can access the tool.
|
||||
|
||||
## Exceptions
|
||||
## Return value
|
||||
none
|
||||
|
||||
* `IllegalArgumentException`
|
||||
## Side effects
|
||||
none
|
||||
|
||||
## Exceptions
|
||||
* `IllegalArgumentException`:
|
||||
* If at least one of the parameters `tool`, `home` is not provided.
|
||||
* `AbortException`
|
||||
* `AbortException`:
|
||||
* If `tool` is not supported.
|
||||
|
||||
## Example
|
||||
|
||||
```groovy
|
||||
toolValidate tool: 'neo', home:'/path/to/neo-java-web-sdk'
|
||||
```
|
||||
|
50
template/script.md
Normal file
50
template/script.md
Normal file
@ -0,0 +1,50 @@
|
||||
# <script name>
|
||||
|
||||
## Description
|
||||
Brief description.
|
||||
|
||||
## Constructors
|
||||
|
||||
### <script name>(<arguments>)
|
||||
|
||||
#### Parameters
|
||||
| parameter | mandatory | default | possible values |
|
||||
| ---------------|-----------|-----------------------------------|--------------------|
|
||||
| | | | |
|
||||
|
||||
* `<parameter>` - Detailed description of each parameter.
|
||||
|
||||
#### Exceptions
|
||||
* `ExceptionType`
|
||||
* List of cases when exception is thrown.
|
||||
|
||||
#### Example
|
||||
```groovy
|
||||
|
||||
```
|
||||
|
||||
|
||||
## Method Details
|
||||
|
||||
### <method>(<arguments>)
|
||||
|
||||
#### Description
|
||||
Brief description.
|
||||
|
||||
#### Parameters
|
||||
* `<parameter>` - Detailed description of each parameter.
|
||||
|
||||
#### Return value
|
||||
none
|
||||
|
||||
#### Side effects
|
||||
none
|
||||
|
||||
#### Exceptions
|
||||
* `ExceptionType`
|
||||
* List of cases when exception is thrown.
|
||||
|
||||
#### Example
|
||||
```groovy
|
||||
|
||||
```
|
@ -1,31 +1,27 @@
|
||||
# <step name>
|
||||
|
||||
## Description
|
||||
|
||||
Brief description.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
* **<prerequisite>** - further description.
|
||||
|
||||
## Parameters
|
||||
|
||||
| parameter | mandatory | default | possible values |
|
||||
| ---------------|-----------|-----------------------------------|--------------------|
|
||||
| | | | |
|
||||
|
||||
* detailed description of each parameter.
|
||||
* `<parameter>` - Detailed description of each parameter.
|
||||
|
||||
## Return value
|
||||
|
||||
none
|
||||
|
||||
## Side effects
|
||||
|
||||
none
|
||||
|
||||
## Exceptions
|
||||
|
||||
none
|
||||
* `ExceptionType`
|
||||
* List of cases when exception is thrown.
|
||||
|
||||
## Example
|
||||
```groovy
|
||||
|
@ -9,21 +9,26 @@ class commonPipelineEnvironment implements Serializable {
|
||||
def setConfigProperties(map) {
|
||||
configProperties = map
|
||||
}
|
||||
|
||||
def getConfigProperties() {
|
||||
return configProperties
|
||||
}
|
||||
|
||||
def setConfigProperty(property, value) {
|
||||
configProperties[property] = value
|
||||
}
|
||||
|
||||
def getConfigProperty(property) {
|
||||
if (configProperties[property] != null)
|
||||
return configProperties[property].trim()
|
||||
else
|
||||
return configProperties[property]
|
||||
}
|
||||
|
||||
def getMtarFilePath() {
|
||||
return mtarFilePath
|
||||
}
|
||||
|
||||
void setMtarFilePath(mtarFilePath) {
|
||||
this.mtarFilePath = mtarFilePath
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
def call(Map parameters = [:], body) {
|
||||
|
||||
def stepParameters = parameters.stepParameters //mandatory
|
||||
|
@ -1,11 +1,6 @@
|
||||
import com.sap.piper.Utils
|
||||
|
||||
/**
|
||||
* mtaBuild
|
||||
* Builds Fiori app with Multitarget Archiver
|
||||
* Prerequisite: InitializeNpm needs to be called beforehand
|
||||
*
|
||||
*/
|
||||
|
||||
def call(Map parameters = [:]) {
|
||||
|
||||
handlePipelineStepErrors (stepName: 'mtaBuild', stepParameters: parameters) {
|
||||
|
@ -1,13 +1,6 @@
|
||||
/**
|
||||
* neoDeployment
|
||||
* Deploys file to Neo
|
||||
* Prerequisite: Location of file to be deployed as 'archivePath' parameter
|
||||
* Needs to be surrounded by withCredentials closure to provide username and password
|
||||
*
|
||||
* @param archivePath Path of the archive to be deployed.
|
||||
*/
|
||||
import com.sap.piper.Utils
|
||||
|
||||
|
||||
def call(parameters = [:]) {
|
||||
|
||||
handlePipelineStepErrors (stepName: 'neoDeploy', stepParameters: parameters) {
|
||||
|
@ -2,14 +2,7 @@ import com.sap.piper.FileUtils
|
||||
import com.sap.piper.Version
|
||||
import hudson.AbortException
|
||||
|
||||
/**
|
||||
* toolValidate: validates if a tool is installed with the expected version.
|
||||
*
|
||||
* @param tool
|
||||
* the tool to validate: java, mta, neo or cm.
|
||||
* @param home
|
||||
* the directory containing the tool.
|
||||
*/
|
||||
|
||||
def call(Map parameters = [:]) {
|
||||
|
||||
handlePipelineStepErrors (stepName: 'toolValidate', stepParameters: parameters) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user