1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-01-04 04:07:16 +02:00
sap-jenkins-library/documentation/docs/steps/mtaBuild.md

62 lines
4.0 KiB
Markdown
Raw Normal View History

2017-07-11 15:12:03 +02:00
# mtaBuild
## Description
2018-03-23 15:18:48 +02:00
Executes the SAP Multitarget Application Archive Builder to create an mtar archive of the application.
Before doing this, validates that SAP Multitarget Application Archive Builder exists 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.
2017-07-11 15:12:03 +02:00
## Parameters
2018-02-27 11:07:43 +02:00
| parameter | mandatory | default | possible values |
| -----------------|-----------|--------------------------------------------------------|--------------------|
| `script` | yes | | |
| `dockerImage` | no | `ppiper/mta-archive-builder` | |
2018-09-04 11:32:54 +02:00
| `dockerOptions` | no | '' | |
| `buildTarget` | yes | `'NEO'` | 'CF', 'NEO', 'XSA' |
| `extension` | no | | |
| `mtaJarLocation` | no | `'/opt/sap/mta/lib/mta.jar'` | |
| `applicationName`| no | | |
2017-07-11 15:12:03 +02:00
* `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.
2018-09-04 11:32:54 +02:00
* `dockerImage` - The Docker image to execute the MTA build.
Note that you can provide your own image if required, but for most cases, the default should be fine.
2018-09-04 11:32:54 +02:00
* `dockerOptions` Docker options to be set when starting the container. It can be a list or a string.
* `buildTarget` - The target platform to which the mtar can be deployed.
2018-04-17 17:35:10 +02:00
* `extension` - The path to the extension descriptor file.
* `mtaJarLocation` - The location of the SAP Multitarget Application Archive Builder jar file, including file name and extension. First, the location is retrieved from the environment variables using the environment variable `MTA_JAR_LOCATION`. If no environment variable is provided, the location is retrieved from the parameters, or the step configuration using the key `mtaJarLocation`. If SAP Multitarget Application Archive Builder is not found on one of the previous locations an AbortException is thrown.
Note that the environment variable `MTA_JAR_LOCATION` has priority. In case that the script runs on multiple nodes, SAP Multitarget Application Archive Builder must be located on all the nodes, therefore the environment variable must be also configured on all the nodes.
* `applicationName` - The name of the application which is being built. If the parameter has been provided and no `mta.yaml` exists, the `mta.yaml` will be automatically generated using this parameter and the information (`name` and `version`) from `package.json` before the actual build starts.
2017-07-11 15:12:03 +02:00
2018-03-06 14:43:53 +02:00
## Step configuration
2018-03-06 14:43:53 +02:00
The following parameters can also be specified as step parameters using the global configuration file:
2018-09-04 11:32:54 +02:00
* `dockerImage`
2018-03-06 14:43:53 +02:00
* `buildTarget`
2018-04-17 17:35:10 +02:00
* `extension`
2018-03-06 14:43:53 +02:00
* `mtaJarLocation`
* `applicationName`
2018-03-06 14:43:53 +02:00
2017-07-11 15:12:03 +02:00
## Side effects
2017-07-11 15:12:03 +02:00
1. The file name of the resulting archive is written to the `commonPipelineEnvironment` with variable name `mtarFileName`.
## Exceptions
* `AbortException`:
* If SAP Multitarget Application Archive Builder is not found.
* If there is an invalid `buildTarget`.
* If there is no key `ID` inside the `mta.yaml` file.
2017-07-11 15:12:03 +02:00
## Example
2017-07-11 15:12:03 +02:00
```groovy
def mtarFileName
dir('/path/to/FioriApp'){
mtarFileName = mtaBuild script:this, buildTarget: 'NEO'
}
```