mtaBuild¶
Performs an mta build
Description¶
Executes the SAP Multitarget Application Archive Builder to create an mtar archive of the application.
build with depedencies from a private repository¶
- For maven related settings refer maven build dependencies
- For NPM related settings refer NPM build dependencies
Usage¶
We recommend to define values of step parameters via .pipeline/config.yml file.
In this case, calling the step is essentially reduced to defining the step name.
Calling the step can be done either in an orchestrator specific way (e.g. via a Jenkins library step) or on the command line.
library('piper-lib-os')
mtaBuild script: this
piper mtaBuild
Outputs¶
Output type | Details |
---|---|
commonPipelineEnvironment |
|
Prerequisites¶
While using a custom docker file, ensure that the following tools are installed:
- multitarget application archive builder 1.0.6 or compatible version - can be downloaded from SAP Development Tools.
- Java 8 or compatible version - necessary to run the multitarget application archive builder itself and to build Java modules.
- NodeJS installed - the multitarget application archive builder uses
npm
to download node module dependencies such asgrunt
.
Parameters¶
Overview - Step¶
Name | Mandatory | Additional information |
---|---|---|
script | (yes) | reference to Jenkins main pipeline script |
applicationName | no | |
buildSettingsInfo | no | |
createBOM | no | |
createBuildArtifactsMetadata | no | |
defaultNpmRegistry | no | |
enableSetTimestamp | no | |
extensions | no | |
globalSettingsFile | no | |
installArtifacts | no | |
jobs | no | |
m2Path | no | |
mtaDeploymentRepositoryPassword | no | pass via ENV, Vault or Jenkins credentials (mtaDeploymentRepositoryPasswordId ) |
mtaDeploymentRepositoryUrl | no | |
mtaDeploymentRepositoryUser | no | |
mtarGroup | no | |
mtarName | no | |
platform | no | |
profiles | no | |
projectSettingsFile | no | |
publish | no | |
source | no | |
target | no | |
verbose | no | activates debug output |
version | no |
Overview - Execution Environment¶
Orchestrator-specific only
These parameters are relevant for orchestrator usage and not considered when using the command line option.
Name | Mandatory | Additional information |
---|---|---|
containerCommand | no | |
containerShell | no | |
dockerEnvVars | no | |
dockerImage | no | |
dockerName | no | |
dockerOptions | no | |
dockerPullImage | no | |
dockerVolumeBind | no | |
dockerWorkspace | no |
Details¶
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.
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | no |
Default | $PIPER_applicationName (if set) |
Secret | no |
Configuration scope |
|
Resource references | none |
buildSettingsInfo¶
build settings info is typically filled by the step automatically to create information about the build settings that were used during the mta build . This information is typically used for compliance related processes.
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | no |
Default | $PIPER_buildSettingsInfo (if set) |
Secret | no |
Configuration scope |
|
Resource references | commonPipelineEnvironment: reference to: custom/buildSettingsInfo |
containerCommand¶
Jenkins-specific: Used for proper environment setup.
Kubernetes only: Allows to specify start command for container created with dockerImage parameter to overwrite Piper default (/usr/bin/tail -f /dev/null).
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | no |
Default | |
Secret | no |
Configuration scope |
|
Resource references | none |
containerShell¶
Jenkins-specific: Used for proper environment setup.
Allows to specify the shell to be executed for container with containerName.
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | no |
Default | |
Secret | no |
Configuration scope |
|
Resource references | none |
createBOM¶
Creates the bill of materials (BOM) using CycloneDX plugin.
Scope | Details |
---|---|
Aliases | - |
Type | bool |
Mandatory | no |
Default | false |
Possible values | - true - false |
Secret | no |
Configuration scope |
|
Resource references | none |
createBuildArtifactsMetadata¶
metadata about the artifacts that are build and published, this metadata is generally used by steps downstream in the pipeline
Scope | Details |
---|---|
Aliases | - |
Type | bool |
Mandatory | no |
Default | false |
Possible values | - true - false |
Secret | no |
Configuration scope |
|
Resource references | none |
defaultNpmRegistry¶
Url to the npm registry that should be used for installing npm dependencies.
Scope | Details |
---|---|
Aliases | npm/defaultNpmRegistry |
Type | string |
Mandatory | no |
Default | $PIPER_defaultNpmRegistry (if set) |
Secret | no |
Configuration scope |
|
Resource references | none |
dockerEnvVars¶
Jenkins-specific: Used for proper environment setup.
Environment variables to set in the container, e.g. [http_proxy: "proxy:8080"].
Scope | Details |
---|---|
Aliases | - |
Type | map[string]string |
Mandatory | no |
Default | |
Secret | no |
Configuration scope |
|
Resource references | none |
dockerImage¶
Jenkins-specific: Used for proper environment setup.
Name of the docker image that should be used. If empty, Docker is not used and the command is executed directly on the Jenkins system.
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | no |
Default | devxci/mbtci-java11-node14 |
Secret | no |
Configuration scope |
|
Resource references | none |
dockerName¶
Jenkins-specific: Used for proper environment setup.
Kubernetes only: Name of the container launching dockerImage. SideCar only: Name of the container in local network.
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | no |
Default | |
Secret | no |
Configuration scope |
|
Resource references | none |
dockerOptions¶
Jenkins-specific: Used for proper environment setup.
Docker options to be set when starting the container.
Scope | Details |
---|---|
Aliases | - |
Type | []string |
Mandatory | no |
Default | |
Secret | no |
Configuration scope |
|
Resource references | none |
dockerPullImage¶
Jenkins-specific: Used for proper environment setup.
Set this to 'false' to bypass a docker image pull. Useful during development process. Allows testing of images which are available in the local registry only.
Scope | Details |
---|---|
Aliases | - |
Type | bool |
Mandatory | no |
Default | true |
Possible values | - true - false |
Secret | no |
Configuration scope |
|
Resource references | none |
dockerVolumeBind¶
Jenkins-specific: Used for proper environment setup.
Volumes that should be mounted into the docker container.
Scope | Details |
---|---|
Aliases | - |
Type | map[string]string |
Mandatory | no |
Default | |
Secret | no |
Configuration scope |
|
Resource references | none |
dockerWorkspace¶
Jenkins-specific: Used for proper environment setup.
Kubernetes only: Specifies a dedicated user home directory for the container which will be passed as value for environment variable HOME
.
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | no |
Default | |
Secret | no |
Configuration scope |
|
Resource references | none |
enableSetTimestamp¶
Enables setting the timestamp in the mta.yaml
when it contains ${timestamp}
. Disable this when you want the MTA Deploy Service to do this instead.
Scope | Details |
---|---|
Aliases | - |
Type | bool |
Mandatory | no |
Default | true |
Possible values | - true - false |
Secret | no |
Configuration scope |
|
Resource references | none |
extensions¶
The path to the extension descriptor file.
Scope | Details |
---|---|
Aliases | extension |
Type | string |
Mandatory | no |
Default | $PIPER_extensions (if set) |
Secret | no |
Configuration scope |
|
Resource references | none |
globalSettingsFile¶
Path or url to the mvn settings file that should be used as global settings file
Scope | Details |
---|---|
Aliases | maven/globalSettingsFile |
Type | string |
Mandatory | no |
Default | $PIPER_globalSettingsFile (if set) |
Secret | no |
Configuration scope |
|
Resource references | none |
installArtifacts¶
If enabled, for npm packages this step will install all dependencies including dev dependencies. For maven it will install all artifacts to the local maven repository. Note: This happens after mta build was done. The default mta build tool does not install dev-dependencies as part of the process. If you require dev-dependencies for building the mta, you will need to use a custom builder
Scope | Details |
---|---|
Aliases | - |
Type | bool |
Mandatory | no |
Default | false |
Possible values | - true - false |
Secret | no |
Configuration scope |
|
Resource references | none |
jobs¶
Configures the number of Make jobs that can run simultaneously. Maximum value allowed is 8
Scope | Details |
---|---|
Aliases | jobs |
Type | int |
Mandatory | no |
Default | 0 |
Secret | no |
Configuration scope |
|
Resource references | none |
m2Path¶
Path to the location of the local repository that should be used.
Scope | Details |
---|---|
Aliases | maven/m2Path |
Type | string |
Mandatory | no |
Default | $PIPER_m2Path (if set) |
Secret | no |
Configuration scope |
|
Resource references | none |
mtaDeploymentRepositoryPassword¶
Password for the alternative deployment repository to which mtar artifacts will be publised
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | no |
Default | $PIPER_mtaDeploymentRepositoryPassword (if set) |
Secret | yes |
Configuration scope |
|
Resource references | commonPipelineEnvironment: reference to: custom/mavenRepositoryPassword commonPipelineEnvironment: reference to: custom/repositoryPassword Jenkins credential id: id: mtaDeploymentRepositoryPasswordId Vault resource: name: mtaDeploymentRepositoryPasswordFileVaultSecretName default value: mta-deployment-repository-passowrd Vault paths:
|
mtaDeploymentRepositoryUrl¶
Url for the alternative deployment repository to which mtar artifacts will be publised
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | no |
Default | $PIPER_mtaDeploymentRepositoryUrl (if set) |
Secret | no |
Configuration scope |
|
Resource references | commonPipelineEnvironment: reference to: custom/mavenRepositoryURL commonPipelineEnvironment: reference to: custom/repositoryUrl |
mtaDeploymentRepositoryUser¶
User for the alternative deployment repository to which which mtar artifacts will be publised
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | no |
Default | $PIPER_mtaDeploymentRepositoryUser (if set) |
Secret | no |
Configuration scope |
|
Resource references | commonPipelineEnvironment: reference to: custom/mavenRepositoryUsername commonPipelineEnvironment: reference to: custom/repositoryUsername |
mtarGroup¶
The group to which the mtar artifact will be uploaded. Required when publish is True.
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | no |
Default | $PIPER_mtarGroup (if set) |
Secret | no |
Configuration scope |
|
Resource references | none |
mtarName¶
The name of the generated mtar file including its extension.
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | no |
Default | $PIPER_mtarName (if set) |
Secret | no |
Configuration scope |
|
Resource references | none |
platform¶
The target platform to which the mtar can be deployed.
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | no |
Default | CF |
Possible values | - CF - NEO - XSA |
Secret | no |
Configuration scope |
|
Resource references | none |
profiles¶
Defines list of maven build profiles to be used. profiles will overwrite existing values in the global settings xml at $M2_HOME/conf/settings.xml
Scope | Details |
---|---|
Aliases | - |
Type | []string |
Mandatory | no |
Default | $PIPER_profiles (if set) |
Secret | no |
Configuration scope |
|
Resource references | none |
projectSettingsFile¶
Path or url to the mvn settings file that should be used as project settings file.
Scope | Details |
---|---|
Aliases | maven/projectSettingsFile |
Type | string |
Mandatory | no |
Default | $PIPER_projectSettingsFile (if set) |
Secret | no |
Configuration scope |
|
Resource references | none |
publish¶
pushed mtar artifact to altDeploymentRepositoryUrl/altDeploymentRepositoryID when set to true
Scope | Details |
---|---|
Aliases | mta/publish |
Type | bool |
Mandatory | no |
Default | false |
Possible values | - true - false |
Secret | no |
Configuration scope |
|
Resource references | none |
script¶
Jenkins-specific: Used for proper environment setup.
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.
Scope | Details |
---|---|
Aliases | - |
Type | Jenkins Script |
Mandatory | yes |
Default | |
Secret | no |
Configuration scope |
|
Resource references | none |
source¶
The path to the MTA project.
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | no |
Default | ./ |
Secret | no |
Configuration scope |
|
Resource references | none |
target¶
The folder for the generated MTAR
file. If the parameter has been provided, the MTAR
file is saved in the root of the folder provided by the argument.
Scope | Details |
---|---|
Aliases | - |
Type | string |
Mandatory | no |
Default | ./ |
Secret | no |
Configuration scope |
|
Resource references | none |
verbose¶
verbose output
Scope | Details |
---|---|
Aliases | - |
Type | bool |
Mandatory | no |
Default | false |
Possible values | - true - false |
Secret | no |
Configuration scope |
|
Resource references | none |
version¶
Version of the mtar artifact
Scope | Details |
---|---|
Aliases | artifactVersion |
Type | string |
Mandatory | no |
Default | $PIPER_version (if set) |
Secret | no |
Configuration scope |
|
Resource references | commonPipelineEnvironment: reference to: artifactVersion |
Side effects¶
- The file name of the resulting archive is written to the
commonPipelineEnvironment
with variable namemtarFileName
.
Exceptions¶
AbortException
:- If there is an invalid
buildTarget
. - If there is no key
ID
inside themta.yaml
file.
Example¶
dir('/path/to/FioriApp'){
mtaBuild script:this, buildTarget: 'NEO'
}
def mtarFilePath = commonPipelineEnvironment.getMtarFilePath()