Skip to content

nexusUpload

Description

Upload build artifacts to a Nexus Repository Manager.

Supports MTA, npm and (multi-module) Maven projects. MTA files will be uploaded to a Maven repository.

The uploaded file-type depends on your project structure and step configuration. To upload Maven projects, you need a pom.xml in the project root and set the mavenRepository option. To upload MTA projects, you need a mta.yaml in the project root and set the mavenRepository option. To upload npm projects, you need a package.json in the project root and set the npmRepository option.

npm: Publishing npm projects makes use of npm's "publish" command. It requires a "package.json" file in the project's root directory which has "version" set and is not delared as "private". To find out what will be published, run "npm publish --dry-run" in the project's root folder. It will use your gitignore file to exclude the mached files from publishing. Note: npm's gitignore parser might yield different results from your git client, to ignore a "foo" directory globally use the glob pattern "**/foo".

If an image for mavenExecute is configured, and npm packages are to be published, the image must have npm installed.

Parameters

name mandatory default possible values
artifactId No
dockerEnvVars No []
dockerImage No devxci/mbtci:1.0.4
dockerName No mvn-npm
dockerOptions No []
dockerPullImage No false
dockerWorkspace No \<empty>
globalSettingsFile No
groupId No
m2Path No
mavenRepository No
nexusCredentialsId Yes
npmRepository No
password No
script Yes
url Yes
user No
verbose No false true, false
version No nexus3 nexus2, nexus3
  • artifactId: The artifact ID used for both the .mtar and mta.yaml files deployed for MTA projects, ignored for Maven.
  • 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.
  • dockerName: Kubernetes only: Name of the container launching dockerImage. SideCar only: Name of the container in local network.
  • 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.
  • globalSettingsFile: Path to the mvn settings file that should be used as global settings file.
  • groupId: Group ID of the artifacts. Only used in MTA projects, ignored for Maven.
  • m2Path: The path to the local .m2 directory, only used for Maven projects.
  • mavenRepository: Name of the nexus repository for Maven and MTA deployments. If this is not provided, Maven and MTA deployment is implicitly disabled.
  • nexusCredentialsId: The technical username/password credential for accessing the nexus endpoint.
  • npmRepository: Name of the nexus repository for npm deployments. If this is not provided, npm deployment is implicitly disabled.
  • password: Password for accessing the Nexus endpoint.
  • 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.
  • url: URL of the nexus. The scheme part of the URL will not be considered, because only http is supported.
  • user: Username for accessing the Nexus endpoint.
  • verbose: verbose output
  • version: The Nexus Repository Manager version. Currently supported are 'nexus2' and 'nexus3'.

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
artifactId
dockerEnvVars X
dockerImage X
dockerName X
dockerOptions X
dockerPullImage X
dockerWorkspace X
globalSettingsFile X X
groupId X
m2Path X X
mavenRepository X
npmRepository X
password
url X
user
verbose X
version X