Skip to content

mtaBuild

Description

Executes the SAP Multitarget Application Archive Builder to create an mtar archive of the application.

Prerequisites

While using a custom docker file, ensure that the following tools are installed:

  • SAP MTA Archive Builder 1.0.6 or compatible version - can be downloaded from SAP Development Tools.
  • Java 8 or compatible version - necessary to run the MTA Archive Builder itself and to build Java modules.
  • NodeJS installed - the MTA Builder uses npm to download node module dependencies such as grunt.

Parameters

name mandatory default possible values
applicationName No
buildTarget No NEO CF, NEO, XSA
defaultNpmRegistry No
dockerEnvVars No mtaBuildTool=cloudMbt: []
mtaBuildTool=classic: []
dockerImage No mtaBuildTool=cloudMbt: devxci/mbtci:1.0.14.1
mtaBuildTool=classic: ppiper/mta-archive-builder:v1
dockerOptions No mtaBuildTool=cloudMbt: []
mtaBuildTool=classic: []
dockerPullImage No true
dockerWorkspace No mtaBuildTool=cloudMbt: \
mtaBuildTool=classic: \
extensions No
globalSettingsFile No
installArtifacts No false true, false
m2Path No
mtaBuildTool No cloudMbt cloudMbt, classic
mtaJarLocation No /opt/sap/mta/lib/mta.jar
mtarName No
platform No CF CF, NEO, XSA
projectSettingsFile No
sapNpmRegistry No https://npm.sap.com
script Yes
verbose No false true, false
  • 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.
  • buildTarget: mtaBuildTool 'classic' only: The target platform to which the mtar can be deployed. Valid values: 'CF', 'NEO', 'XSA'.
  • defaultNpmRegistry: Url to the npm registry that should be used for installing npm dependencies.
  • dockerEnvVars: Environment variables to set in the container, e.g. [http_proxy: "proxy:8080"].
  • dockerImage: 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.
  • dockerOptions: Docker options to be set when starting the container.
  • dockerPullImage: Set this to 'false' to bypass a docker image pull. Usefull during development process. Allows testing of images which are available in the local registry only.
  • dockerWorkspace: Kubernetes only: Specifies a dedicated user home directory for the container which will be passed as value for environment variable HOME.
  • extensions: The path to the extension descriptor file.
  • globalSettingsFile: Path or url to the mvn settings file that should be used as global settings file
  • installArtifacts: If enabled, for npm packages this step will install all depedencies including dev dependencies. For maven it will install all artifacts to the local maven repository.
  • m2Path: Path to the location of the local repository that should be used.
  • mtaBuildTool: Tool to use when building the MTA. Valid values: 'classic', 'cloudMbt'.
  • mtaJarLocation: mtaBuildTool 'classic' only: The location of the SAP Multitarget Application Archive Builder jar file, including file name and extension. If you run on Docker, this must match the location of the jar file in the container as well.
  • mtarName: The name of the generated mtar file including its extension.
  • platform: mtaBuildTool 'cloudMbt' only: The target platform to which the mtar can be deployed.
  • projectSettingsFile: Path or url to the mvn settings file that should be used as project settings file.
  • sapNpmRegistry: Url to the sap npm registry that should be used for installing npm dependencies prefixed with @sap.
  • 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 for retrieving, e.g. configuration parameters.
  • verbose: verbose output

Step Configuration

We recommend to define values of step parameters via config.yml file.

In following sections of the config.yml the configuration is possible:

parameter general step/stage
applicationName X
buildTarget X
defaultNpmRegistry X
dockerEnvVars X
dockerImage X
dockerOptions X
dockerPullImage X
dockerWorkspace X
extensions X
globalSettingsFile X
installArtifacts X X
m2Path X X
mtaBuildTool X
mtaJarLocation X
mtarName X
platform X
projectSettingsFile X
sapNpmRegistry X
verbose X

Side effects

  1. The file name of the resulting archive is written to the commonPipelineEnvironment with variable name mtarFileName.

Exceptions

  • AbortException:
  • If there is an invalid buildTarget.
  • If there is no key ID inside the mta.yaml file.

Example

dir('/path/to/FioriApp'){
  mtaBuild script:this, buildTarget: 'NEO'
}
def mtarFilePath = commonPipelineEnvironment.getMtarFilePath()