mirror of
https://github.com/SAP/jenkins-library.git
synced 2024-12-14 11:03:09 +02:00
Merge pull request #132 from alejandraferreirovidal/addExtensionToMtaBuild
add extension to mtaBuild
This commit is contained in:
commit
48b816e028
@ -17,11 +17,13 @@ Note that a version is formed by `major.minor.patch`, and a version is compatibl
|
||||
| -----------------|-----------|--------------------------------------------------------|--------------------|
|
||||
| `script` | yes | | |
|
||||
| `buildTarget` | yes | `'NEO'` | 'CF', 'NEO', 'XSA' |
|
||||
| `extension` | no | | |
|
||||
| `mtaJarLocation` | no | | |
|
||||
| `applicationName`| 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.
|
||||
* `extension` - The path to the extension descriptor file.
|
||||
* `mtaJarLocation` - The path of the `mta.jar` file. If no parameter is provided, the path is retrieved from the environment variables using the environment variable`MTA_JAR_LOCATION`. If no parameter and no environment variable is provided, the path is retrieved from the step configuration using the step configuration key `mtaJarLocation`. If the previous configurations are not provided, `mta.jar` is expected on the current working directory, and if it is not located on the current working directory an AbortException is thrown.
|
||||
* `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.
|
||||
|
||||
@ -29,6 +31,7 @@ Note that a version is formed by `major.minor.patch`, and a version is compatibl
|
||||
The following parameters can also be specified as step parameters using the global configuration file:
|
||||
|
||||
* `buildTarget`
|
||||
* `extension`
|
||||
* `mtaJarLocation`
|
||||
* `applicationName`
|
||||
|
||||
|
@ -237,6 +237,26 @@ public class MtaBuildTest extends BasePipelineTest {
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
void extensionFromParametersTest() {
|
||||
|
||||
jsr.step.call(buildTarget: 'NEO', extension: 'param_extension')
|
||||
|
||||
assert jscr.shell.find { c -> c.contains('java -jar mta.jar --mtar com.mycompany.northwind.mtar --build-target=NEO --extension=param_extension build')}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
void extensionFromCustomStepConfigurationTest() {
|
||||
|
||||
jer.env.configuration = [steps:[mtaBuild:[buildTarget: 'NEO', extension: 'config_extension']]]
|
||||
|
||||
jsr.step.call(script: [commonPipelineEnvironment: jer.env])
|
||||
|
||||
assert jscr.shell.find(){ c -> c.contains('java -jar mta.jar --mtar com.mycompany.northwind.mtar --build-target=NEO --extension=config_extension build')}
|
||||
}
|
||||
|
||||
|
||||
private static defaultMtaYaml() {
|
||||
return '''
|
||||
_schema-version: "2.0.0"
|
||||
|
@ -11,12 +11,14 @@ def call(Map parameters = [:]) {
|
||||
Set parameterKeys = [
|
||||
'applicationName',
|
||||
'buildTarget',
|
||||
'extension',
|
||||
'mtaJarLocation'
|
||||
]
|
||||
|
||||
Set stepConfigurationKeys = [
|
||||
'applicationName',
|
||||
'buildTarget',
|
||||
'extension',
|
||||
'mtaJarLocation'
|
||||
]
|
||||
|
||||
@ -63,9 +65,14 @@ def call(Map parameters = [:]) {
|
||||
def mtaJar = mta.getToolExecutable(this, configuration)
|
||||
def buildTarget = configuration.buildTarget
|
||||
|
||||
def mtaCall = "${mtaJar} --mtar ${mtarFileName} --build-target=${buildTarget}"
|
||||
|
||||
if (configuration.extension) mtaCall += " --extension=$configuration.extension"
|
||||
mtaCall += ' build'
|
||||
|
||||
sh """#!/bin/bash
|
||||
export PATH=./node_modules/.bin:${PATH}
|
||||
${mtaJar} --mtar ${mtarFileName} --build-target=${buildTarget} build
|
||||
$mtaCall
|
||||
"""
|
||||
|
||||
def mtarFilePath = "${pwd()}/${mtarFileName}"
|
||||
|
Loading…
Reference in New Issue
Block a user