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

Services & Environments

Services define what you are deploying; environments define where. Together they configure the deployment target for a Harness 3.0 pipeline stage.

Services and Environments are core deployment concepts in Harness 3.0. A Service defines what you are deploying (application, container, function), and an Environment defines where you are deploying (dev, staging, production). Together, they configure the deployment target for a pipeline stage.

Services

A Service represents the application or workload being deployed. It includes artifact references, manifests, configuration files, and variables that define the deployment payload.

Service schema

interface Service {
  // Reference to a defined service entity
  ref: string

  // Inline service definition
  name: string

  // Service description
  description: string

  // Deployment type (kubernetes, native-helm, serverless, etc.)
  deployment_type: string

  // Artifact configuration
  artifacts: ArtifactConfig

  // Manifest configuration
  manifests: ManifestConfig[]

  // Config files
  config_files: ConfigFile[]

  // Service-level variables
  variables: Record<string, string>
}

Service definition

Define a service inline within the pipeline or reference a pre-configured service entity.

Single service reference

Reference a service defined at the project, organization, or account level. Service and environment can be specified at either the pipeline level or the stage level.

Multiple service references

Deploy multiple services in a single pipeline. By default, services are deployed in parallel.

Sequential service deployment

Deploy services one at a time in a defined order using the sequential flag.

SERVICE VARIABLES

Each service can define its own variables accessible within the stage using ${{ service.variables.<name> }}. Service variables override pipeline-level environment variables with the same name.


Environments

An Environment represents a deployment target such as development, staging, or production. Environments define infrastructure mappings, overrides, and governance policies.

Environment schema

Environment types

Type
Description
Governance

production

Live customer-facing environments. Requires approvals and freeze window compliance.

Approval gates, freeze windows, audit logging enforced.

non-production

Development, testing, and staging environments. Lighter governance requirements.

Optional approvals, no freeze window enforcement by default.

Environment definition

Reference an environment by name and specify the infrastructure to deploy to using the deploy-to field.


Multi-service deployment

Deploy multiple services to the same environment in a single stage. Services can be deployed in parallel (default) or sequentially.

Parallel service deployment

All services deploy simultaneously, reducing total deployment time. This is the default behavior when using items.

SERVICE ITERATION

When multiple services are specified, the stage steps execute once for each service. Use ${{ service.name }} and ${{ service.ref }} to reference the current service in expressions.

Sequential service deployment

Deploy services one after another, useful when services have startup order dependencies.


Multi-environment deployment

Deploy the same service across multiple environments, such as promoting a release from staging to production through a sequence of environment targets.

Sequential environment deployment

Promote a release through multiple environments sequentially. Use sequential: true on the environment and the deploy-to field to specify infrastructure targets per environment.

Complete multi-service, multi-environment deployment

A comprehensive example combining multiple services and environments in a single pipeline.

INFRASTRUCTURE TARGETING

Use deploy-to: all to deploy to all infrastructures defined in the environment. You can also specify a single infrastructure as a string or a list of specific infrastructure targets.

Last updated

Was this helpful?