Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.
BETA

Download Nexus Artifact

Download a raw, Maven, npm, or NuGet asset from a Nexus repository inside a containerized step group

This feature is in Beta and requires enablement. View all early access features.

Containerized step group required

The Download Nexus Artifact step is only available when used within a containerized step group.

The Download Nexus Artifact step downloads a single asset from a Nexus repository into your containerized step group, so later steps in the step group can use it. It supports raw, Maven, npm, and NuGet repository formats. Use it instead of a custom plugin or shell script when you need to pull a build dependency, SDF bundle, or evidence file from Nexus directly into a pipeline.


What you will learn from this topic

  • How to add the Download Nexus Artifact step and configure its settings

  • How to provide artifact coordinates for each supported repository format

  • How to control the download location and checksum validation


Before you begin

  • Nexus connector: Connect Harness to your Nexus server. The connector can use Anonymous or Username/Password authentication; if the repository allows anonymous access, you do not need to configure credentials. Go to Add a Nexus connector to create one.

  • Containerized step group: Add the step inside a containerized step group that runs on Kubernetes, VM, or Amazon ECS infrastructure.


Add the Download Nexus Artifact step

Add the Download Nexus Artifact step to your containerized step group, and configure the settings described below.

The following YAML example downloads a Maven artifact:

The following YAML example downloads a raw asset:

Download Nexus Artifact step settings

Name

Enter a name summarizing the step's purpose. Harness generates an Id (Entity Identifier) based on the Name. You can edit the Id.

Nexus Connector

Select the Nexus connector to use when connecting to your Nexus server.

Repository Format

Select the format of the Nexus repository the asset lives in: Raw, Maven, NPM, or NuGet. Harness does not support the Docker format for this step, because a container image is not a single downloadable file.

You must set Repository Format to a fixed value. It does not accept a runtime input or an expression, because Harness uses it to determine which coordinate fields to show and validate before the pipeline runs.

Repository

Select or enter the name of the Nexus repository the asset lives in.

Raw repository coordinates

When Repository Format is Raw, provide the following coordinates.

Group

The directory the asset lives in, such as /release/1.4.2.

Artifact Path

The file name of the asset within Group, such as bundle-1.4.2.zip.

Maven repository coordinates

When Repository Format is Maven, provide the following coordinates.

Group Id

The Maven group ID of the artifact.

Artifact Id

The Maven artifact ID of the artifact.

Version

The version of the artifact. This accepts a release version, a -SNAPSHOT version such as 1.0.0-SNAPSHOT, or a pinned timestamped snapshot build such as 1.0.0-20240101.120000-1.

Extension

Optional, but in practice usually required. A Maven coordinate normally matches both a JAR and a POM in a hosted repository, so omitting Extension usually fails the step rather than being a minor convenience. Set Extension (for example jar) to identify the asset you want.

Classifier

Optional. The Maven classifier of the artifact, such as sources. When you do not set Classifier, the step excludes classified assets (such as -sources or -javadoc) from the match, so they are not the cause of an ambiguous match. An unset Extension is the usual cause.

Resolving ambiguous Maven coordinates

If Group Id, Artifact Id, Version, Extension, and Classifier together match more than one asset, the step's behavior depends on whether the matches are identical:

  • If every match has identical content, which is common when Repository points at a group repository that mirrors the same artifact from more than one member repository, the step downloads the first match and logs that it did so.

  • If the matches differ in content, the step fails. The failure message lists each match along with the member repository it came from, so you can set Repository to that specific member repository to resolve the ambiguity.

NPM and NuGet repository coordinates

When Repository Format is NPM or NuGet, provide the following coordinates.

Package Name

The name of the npm or NuGet package.

Version

The version of the package.

For NuGet, the Nexus asset path does not carry a file name, so the step names the downloaded file <Package Name>.<Version>.nupkg.


Optional settings

Download Directory Path

The directory, inside the container, to download the asset to. If you do not specify a path, Harness downloads the asset to /harness/<step Id>.

Validate Checksum

Validates the downloaded asset's checksum against Nexus. Enabled by default. If Nexus reports no checksum for the asset, the step logs a warning and succeeds without performing validation.

Run as User

Specify the user ID to use to run all processes in the pod if running in containers. Go to Set the security context for a pod to configure the pod security context.

Privileged

Enable this option to run the container with escalated privileges. This is equivalent to running a container with the Docker --privileged flag. Most Nexus downloads do not need this.

Set Container Resources

Maximum resource limits for the resources used by the container at runtime:

  • Limit Memory: Maximum memory that the container can use. You can express memory as a plain integer or as a fixed-point number with the suffixes G or M. You can also use the power-of-two equivalents, Gi or Mi. Do not include spaces when entering a fixed value.

  • Limit CPU: The maximum number of cores that the container can use. CPU limits are measured in CPU units. Fractional requests are allowed. For example, you can specify one hundred millicpu as 0.1 or 100m. Go to Resource units in Kubernetes to review Kubernetes resource unit syntax.

Timeout

Set the timeout limit for the step. Once the timeout limit is reached, the step fails. What happens next depends on the step's failure strategy; by default, the stage fails. To set skip conditions or failure handling for steps, go to:

Output file paths

The YAML-only outputFilePathsContent field takes a list of file paths, each resolved relative to the download directory, not the Nexus repository. This field is not yet available in the Visual pipeline editor.

For each path, after the download completes, Harness publishes the file's content as a step output variable, keyed by the path exactly as you wrote it. The published value is not the raw file content: Harness base64-encodes it and replaces the = padding characters with -, because the output-variable format cannot carry = in a value.

To use the value, read it back in a later step and reverse the encoding. For example, a Shell Script step in the same stage can decode version.txt like this:

Harness has no built-in expression function that decodes this value for you; the tr and base64 -d steps shown above have to run in the consuming step itself. From a later stage instead of a later step in the same stage, use <+pipeline.stages.<stageId>.spec.execution.steps.Maven.output.outputVariables["version.txt"]>.


Important notes

  • Repository Format determines the shape of the coordinate fields and cannot be a runtime input or an expression. Nexus Connector, Repository, Download Directory Path, and the coordinate fields inside Repository Format, such as Version or Artifact Path, all accept runtime inputs and expressions.

  • Docker is not a supported repository format for this step.


Next steps

Last updated

Was this helpful?