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

Artifact Registry and Continuous Integrations

Deep dive into the native integrations between the Artifact Registry and the Continuous Integration module.

Learn how to use Artifact Registry with the Continuous Integration (CI) module.

Build and push to Docker with Artifact Registry

Harness CI offers a Build and push to Docker step that allows you to build and push a docker image to any registry. Usually, this requires a connector to the registry you want, but with AR you can connect to a registry directly, within the platform, without any complicated setup.

Build and Push Docker Images with Harness Artifact Registry

To do so, follow these steps:

  1. Navigate to your pipeline, and enter your Build stage.

  2. Create a new Build and Push an image to Docker Registry step.

  3. Harness Artifact Registry is the default registry type. Ensure that it is selected, and move to the next step.

  4. Select your registry under Registry. Clicking the field will show a list of available registries.

  5. Once your registry is selected, a list of images will populate under Image Name. Choose one, or type the name of a new image that you are building the first time.

  6. Enter any image tags you wish under Tags.

  7. Click Apply Changes at the top right, and you are done! No connectors needed.

Upload Artifacts to Harness Artifact Registry

Harness CI provides a native Upload Artifacts to Harness Artifact Registry step that simplifies the process of publishing artifacts directly to your Harness Artifact Registry. This dedicated step supports multiple package types and eliminates the need for complex scripting or external connectors.

The Upload Artifacts step allows you to configure artifact uploads through a simple interface. You can specify the package type, target registry, and source path for your artifacts. The source path typically points to artifacts generated from a previous step in your pipeline, such as a Run step that builds, creates, or downloads packages.

SOURCE PATH CONFIGURATION

Enter the Source Path where your artifact is located:

  • This path typically references the output from a previous step, such as:

    • /harness/target/*.jar for Maven artifacts

    • /harness/example.tar.gz for npm tarballs

    • /harness/build/ for Python wheels

  • You can use expressions to reference outputs from earlier steps

Package-specific requirements:

  • Generic packages: Requires explicit package name and version

  • Go packages: Requires explicit version specification

The Upload Artifacts step uses Harness CLI internally to upload artifacts to Harness Artifact Registry, ensuring consistent behavior and authentication across all package types.

Example YAML

Key Points:

  1. Step 1 (Run): Downloads a Conda package from conda-forge and outputs the file path using DRONE_OUTPUT

  2. Step 2 (HarUpload): References the output variable from Step 1 using <+steps.download_conda_package.output.outputVariables.FILE_PATH> and uploads to the specified registry

  3. Package Type: Set to CONDA to ensure proper indexing in Artifact Registry

  4. Source Path: Dynamically references the downloaded artifact location from the previous step

Add a Run or Plugin Step to Your CI Pipeline

Seamlessly reference artifacts stored in Harness Artifact Registry within your CI Run and Plugin steps. This functionality eliminates the need for an external connector, providing a streamlined and user-friendly experience, while enabling efficient and simplified workflows.

To do so, follow these steps:

  1. Navigate to your pipeline, and enter your Build stage.

  2. Create a new Run step.

  3. Harness Artifact Registry is the default registry type. Ensure that it is selected, and move to the next step.

  4. Select your registry under Registry. Clicking the field will show a list of available registries.

  5. Enter your artifact's imageName:version.

  6. Add your run command, e.g. `echo "Run step completed".

  7. Click Apply Changes.

To verify the Run or Plugin step executes as expected, run the pipeline.

Last updated

Was this helpful?