Skip to main content

Use Harness Cloud build infrastructure

With Harness Cloud, you can run builds in isolation on Harness-hosted VMs that are preconfigured with tools, packages, and settings commonly used in CI pipelines. Harness hosts, maintains, and upgrades these machines so that you can focus on building software instead of maintaining build infrastructure.

Harness Cloud provides the following advantages:

  • Free monthly credits for up to 2,000 build minutes.
  • Starter pipelines for different programming languages.
  • Blazing fast builds on Linux, macOS, and Windows.
  • Get the latest features first. Harness may enable features for Harness Cloud before rolling them out to other build infrastructure options.
What happens when pipelines run on Harness Cloud?

During a pipeline build that uses Harness Cloud build infrastructure, Harness runs each CI stage in a new, ephemeral VM.

Example pipeline on Harness Cloud

The steps in each stage execute on the stage's dedicated VM. This allows the stage's steps to share information through the underlying filesystem. You can run CI steps directly on the VM or in a Docker container. When the stage is complete, the VM automatically shuts down.

Build credits

All plans get 2000 free build credits each month. For more information about Harness Cloud build credit consumption, go to Subscriptions and licenses.

Requirements

  • You must use Harness Secret Manager to store connector credentials and other secrets.
  • All connectors must connect through the Harness Platform, not the delegate.
  • AWS connectors can't use IRSA or AssumeRole.
  • GCP and Azure connectors can't inherit credentials from the delegate.

For a comparison of build infrastructure options, go to Which build infrastructure is right for me.

Platforms and image specifications

Harness Cloud offers the following operating systems and architectures:

  • Linux: amd64 and arm64
  • macOS: arm64 (M1)
  • Windows: amd64
tip

To enable Windows and macOS for Harness Cloud, contact Harness Support.

Refer to the following image specification README files for more information about image components and preinstalled software.

You can include steps in your pipeline to specify a version of a tool installed on an image, lock the stage to a required version, or install additional tools and versions that aren't available on the image. These steps run on the host machine or run as separate Docker images.

caution

Harness Cloud machine images can change. If your pipeline relies on a specific version of a software, tool, or environment, use the instructions in Lock versions or install additional tools to prevent your pipeline from failing when the image changes.

Specify versions

If there are multiple versions of a tool installed on an image, you can specify the version to use in a step's Command. For example, with the Harness Cloud macOS build infrastructure, you could use the following command in a Run step to select an Xcode version:

sudo xcode-select -switch /Applications/Xcode_14.1.0.app

However, Harness Cloud machine images can change. If your pipeline relies on a specific version of a software, tool, or environment, use the instructions in Lock versions or install additional tools to prevent your pipeline from failing when the image changes.

Lock versions or install additional tools

If your build requires a specific version of a tool or a tool that isn't already available on the Harness Cloud image, you can use a step to install it directly or run it in a Docker image. There are a variety of steps you can use to do this, such as a Run step or a Plugin step.

Example: Install Java 17

In the following YAML example, an Action step runs the actions/setup-java GitHub Action to install Java 17, and then the Run step confirms the Java version.

            steps:
- step:
identifier: install_java
name: intall java version 17
type: Action
spec:
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- step:
identifier: java_ver_check
name: java version check
type: Run
spec:
shell: Bash
command: |
JAVA_VER=$(java -version 2>&1 | head -1 | cut -d'"' -f2 | sed '/^1\./s///' | cut -d'.' -f1)
if [[ $JAVA_VER == 17 ]]; then
echo successfully installed $JAVA_VER
else
exit 1
fi
tip

You can also use the Bitrise plugin step to run Bitrise Integrations in your CI pipelines.

Example: Pull a Docker image

The following YAML example demonstrates how a Run step can use a Docker image (specified in conectorRef and image) to leverage tools available on that image that aren't available on the host image:

    - stage:
name: Print welcome message
identifier: welcome_message
type: CI
spec:
cloneCodebase: true
platform: // Platform properties describe the target machine required by this stage.
os: Linux
arch: Amd64
runtime:
type: Cloud // This build runs on Harness-provided infrastructure.
spec: {}
execution:
steps:
- step:
type: Run
name: Welcome
identifier: Welcome
spec:
connectorRef: my_docker_hub // Specify a Docker connector to pull an image from Docker.
image: alpine // If no image is specified, the step runs on the host machine.
shell: Sh
command: Echo "Welcome to Harness CI"
caution

Steps running in containers can't communicate with Background steps running on the Harness Cloud build infrastructure, because they do not have a common host.

Use Harness Cloud

You can start using Harness Cloud in minutes.

  1. Go to the pipeline where you want to use Harness Cloud build infrastructure.
  2. Select the Build stage, and then select the Infrastructure tab.
  3. Select Harness Cloud and the desired Platform.
  4. Save and run your pipeline.
info

Add steps to your pipeline to specify versions of tools, set up environments, or install additional tools. For image specifications and instructions on specifying versions, locking versions, and installing additional tools, go to the Platforms and image specifications section, above.

Harness Cloud machine images can change. If your pipeline relies on a specific version of a software, tool, or environment, use the instructions to Lock versions or install additional tools in Platforms and image specifications to prevent your pipeline from failing when the image changes.