Skip to content

nexusUpload

Upload artifacts to Nexus Repository Manager

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.

Usage

We recommend to define values of step parameters via config.yml file. In this case, calling the step is reduced to one simple line.
Calling the step can be done either via the Jenkins library step or on the command line.

Jenkins pipelines

nexusUpload script: this

Command line

piper nexusUpload

Parameters

Overview

Name Mandatory Additional information
nexusCredentialsId yes Jenkins only id of credentials (using credentials)
script yes Jenkins only reference to Jenkins main pipeline script
url yes
artifactId no
containerCommand no Jenkins only
containerShell no Jenkins only
dockerEnvVars no Jenkins only
dockerImage no Jenkins only
dockerName no Jenkins only
dockerOptions no Jenkins only
dockerPullImage no Jenkins only
dockerVolumeBind no Jenkins only
dockerWorkspace no Jenkins only
globalSettingsFile no
groupId no
m2Path no
mavenRepository no
npmRepository no
password no Secret pass via ENV or Jenkins credentials
user no Secret pass via ENV or Jenkins credentials
verbose no activates debug output
version no

Details

artifactId

The artifact ID used for both the .mtar and mta.yaml files deployed for MTA projects, ignored for Maven.

back to overview

Scope Details
Aliases -
Type string
Mandatory no
Default $PIPER_artifactId (if set)
Secret no
Configuration scope
  • ☒ parameter
  • ☐ general
  • ☐ steps
  • ☐ stages
Resource references none

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).

back to overview

Scope Details
Aliases -
Type string
Mandatory no
Default
Secret no
Configuration scope
  • ☒ parameter
  • ☒ general
  • ☒ steps
  • ☒ stages
Resource references none

containerShell

Jenkins-specific: Used for proper environment setup.

Allows to specify the shell to be executed for container with containerName.

back to overview

Scope Details
Aliases -
Type string
Mandatory no
Default
Secret no
Configuration scope
  • ☒ parameter
  • ☒ general
  • ☒ steps
  • ☒ stages
Resource references none

dockerEnvVars

Jenkins-specific: Used for proper environment setup.

Environment variables to set in the container, e.g. [http_proxy: "proxy:8080"].

back to overview

Scope Details
Aliases -
Type map[string]string
Mandatory no
Default
Secret no
Configuration scope
  • ☒ parameter
  • ☒ general
  • ☒ steps
  • ☒ stages
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.

back to overview

Scope Details
Aliases -
Type string
Mandatory no
Default
Secret no
Configuration scope
  • ☒ parameter
  • ☒ general
  • ☒ steps
  • ☒ stages
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.

back to overview

Scope Details
Aliases -
Type string
Mandatory no
Default
Secret no
Configuration scope
  • ☒ parameter
  • ☒ general
  • ☒ steps
  • ☒ stages
Resource references none

dockerOptions

Jenkins-specific: Used for proper environment setup.

Docker options to be set when starting the container.

back to overview

Scope Details
Aliases -
Type []string
Mandatory no
Default
Secret no
Configuration scope
  • ☒ parameter
  • ☒ general
  • ☒ steps
  • ☒ stages
Resource references none

dockerPullImage

Jenkins-specific: Used for proper environment setup.

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.

back to overview

Scope Details
Aliases -
Type bool
Mandatory no
Default false
Possible values - true
- false
Secret no
Configuration scope
  • ☒ parameter
  • ☒ general
  • ☒ steps
  • ☒ stages
Resource references none

dockerVolumeBind

Jenkins-specific: Used for proper environment setup.

Volumes that should be mounted into the docker container.

back to overview

Scope Details
Aliases -
Type map[string]string
Mandatory no
Default
Secret no
Configuration scope
  • ☒ parameter
  • ☒ general
  • ☒ steps
  • ☒ stages
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.

back to overview

Scope Details
Aliases -
Type string
Mandatory no
Default
Secret no
Configuration scope
  • ☒ parameter
  • ☒ general
  • ☒ steps
  • ☒ stages
Resource references none

globalSettingsFile

Path to the mvn settings file that should be used as global settings file.

back to overview

Scope Details
Aliases maven/globalSettingsFile
Type string
Mandatory no
Default $PIPER_globalSettingsFile (if set)
Secret no
Configuration scope
  • ☒ parameter
  • ☒ general
  • ☒ steps
  • ☒ stages
Resource references none

groupId

Group ID of the artifacts. Only used in MTA projects, ignored for Maven.

back to overview

Scope Details
Aliases nexus/groupId
Type string
Mandatory no
Default $PIPER_groupId (if set)
Secret no
Configuration scope
  • ☒ parameter
  • ☐ general
  • ☒ steps
  • ☒ stages
Resource references none

m2Path

The path to the local .m2 directory, only used for Maven projects.

back to overview

Scope Details
Aliases maven/m2Path
Type string
Mandatory no
Default $PIPER_m2Path (if set)
Secret no
Configuration scope
  • ☒ parameter
  • ☒ general
  • ☒ steps
  • ☒ stages
Resource references none

mavenRepository

Name of the nexus repository for Maven and MTA deployments. If this is not provided, Maven and MTA deployment is implicitly disabled.

back to overview

Scope Details
Aliases - nexus/mavenRepository
- nexus/repository (deprecated)
Type string
Mandatory no
Default $PIPER_mavenRepository (if set)
Secret no
Configuration scope
  • ☒ parameter
  • ☐ general
  • ☒ steps
  • ☒ stages
Resource references none

nexusCredentialsId

Jenkins-specific: Used for proper environment setup.

The technical username/password credential for accessing the nexus endpoint.

back to overview

Scope Details
Aliases -
Type string
Mandatory yes
Default
Secret no
Configuration scope
  • ☒ parameter
  • ☒ general
  • ☒ steps
  • ☒ stages
Resource references none

npmRepository

Name of the nexus repository for npm deployments. If this is not provided, npm deployment is implicitly disabled.

back to overview

Scope Details
Aliases nexus/npmRepository
Type string
Mandatory no
Default $PIPER_npmRepository (if set)
Secret no
Configuration scope
  • ☒ parameter
  • ☐ general
  • ☒ steps
  • ☒ stages
Resource references none

password

Password for accessing the Nexus endpoint.

back to overview

Scope Details
Aliases -
Type string
Mandatory no
Default $PIPER_password (if set)
Secret yes
Configuration scope
  • ☒ parameter
  • ☐ general
  • ☐ steps
  • ☐ stages
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.

back to overview

Scope Details
Aliases -
Type Jenkins Script
Mandatory yes
Default
Secret no
Configuration scope
  • ☐ parameter
  • ☐ general
  • ☐ steps
  • ☐ stages
Resource references none

url

URL of the nexus. The scheme part of the URL will not be considered, because only http is supported.

back to overview

Scope Details
Aliases nexus/url
Type string
Mandatory yes
Default $PIPER_url (if set)
Secret no
Configuration scope
  • ☒ parameter
  • ☐ general
  • ☒ steps
  • ☒ stages
Resource references none

user

Username for accessing the Nexus endpoint.

back to overview

Scope Details
Aliases -
Type string
Mandatory no
Default $PIPER_user (if set)
Secret yes
Configuration scope
  • ☒ parameter
  • ☐ general
  • ☐ steps
  • ☐ stages
Resource references none

verbose

verbose output

back to overview

Scope Details
Aliases -
Type bool
Mandatory no
Default false
Possible values - true
- false
Secret no
Configuration scope
  • ☒ parameter
  • ☒ general
  • ☒ steps
  • ☒ stages
Resource references none

version

The Nexus Repository Manager version. Currently supported are 'nexus2' and 'nexus3'.

back to overview

Scope Details
Aliases nexus/version
Type string
Mandatory no
Default nexus3
Possible values - nexus2
- nexus3
Secret no
Configuration scope
  • ☒ parameter
  • ☐ general
  • ☒ steps
  • ☒ stages
Resource references none