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

Upgrade to service and environment v2

Historical reference for the v1 to v2 migration that completed in 2023

To provide the best software delivery experience for our customers, Harness introduced an enhanced experience for service and environment entities in the CD NextGen platform. We named this enhanced experience service and environment v2.

The v2 experience went into effect as the default experience on January 31, 2023.

The v1 experience was removed from all accounts on that date.


What you will learn

This page describes the service and environment v1 to v2 migration that occurred in 2023. It is retained for historical reference only.

  • What changed: The architectural changes from v1 to v2 services, environments, and infrastructure definitions.

  • Why the change was made: The benefits of the v2 experience (service variables, independent infrastructure definitions, environment groups).

  • How migration worked: The migration APIs that were used to upgrade accounts from v1 to v2.

  • YAML changes: Examples of v1 to v2 YAML structure changes for services, environments, infrastructure definitions, stages, pipelines, and templates.


Why make the change?

The v2 experience has more robust service and environment entities. V2 has service variables, independent infrastructure definitions, environment groups, and file and variable overrides.

With v2, you will notice a major reduction in the configuration included in pipelines. These changes are also reflected in the Harness APIs.

All new deployment types (ECS, Deployment Template, SSH, WinRM, etc.) are available in v2 only. New innovations such as Enterprise GitOps, multi-services and multi-environments, and environment groups are in v2 only.

The new v2 experience was designed to provide users and organizations with simpler configurations and an improved ability to scale.


Customer impact

Here is a summary of the impact to Harness accounts:

  • The changes only impacted the CD module. No other modules were impacted.

  • No impact on any existing pipelines using v1 services and environments during the transition period.

  • After January 31, 2023, when you create a new CD stage in an existing pipeline, the v2 experience became the default.

Any new services and environments created in Harness after January 31, 2023 use the v2 experience.


Important dates

Review these important historical dates:

  • Service and environment v1 APIs were deprecated in March 2023.

  • On the official EOL date (January 31, 2023), v1 services and environments continued to work as before. After March 2023, pipelines with v1 services and environments might have experienced issues or failures because Harness did not update v1 with fixes or enhancements after that date.

  • Harness globally enabled service and environments v2 APIs for all customers at the end of January 2023.

  • The forced change reduced the migration effort needed for users.

  • Harness provided an automated tool to help migrate services and environments from v1 to v2.

For questions or comments about this migration, contact support@harness.io or your CSM.


API changes

Harness introduced the following new APIs to support the v2 experience:

Go to Migrating from v1 services and environments to v2 to learn how these APIs were used for migration.


Terraform Provider automation

Customers using the Harness Terraform Provider needed to update their service and environment automation to use the v2 plugin resources:

Go to Changelog since service and environment v1 release to see Terraform Provider examples.


Changelog since service and environment v1 release

This section contains all the v1 to v2 changes for each of the impacted entity types.


Services

The following changes apply to services:

  • To use the service in a pipeline, service definitions must be configured via API/UI/YAML.

  • The service definition is a configuration mapped to the service irrespective of the pipelines where it is used.

  • For details on service v2, go to Services overview.

  • The service entity is now moved from the pipeline to a standalone entity. The service contains the following components:

    • Name, Description, Tag, Id. These are the same as in the service v1 experience.

    • Manifests and artifacts. The service manifests and artifacts are now mapped in the service. They are moved out of the pipeline Service tab.

    • Service variables. Service variables are now associated with the Service and can be overridden at the environment level.

Service YAML updates

Here is a YAML sample that demonstrates the changes in v2.

REST API updates

When creating a service via the Harness REST API, there is a new service endpoint.

Sample payload request

Sample payload response


Terraform Provider

Review the changes to the Harness Terraform Provider service resource.

  • The Harness Terraform Provider service resource endpoint did not change.

  • The service resource payload had a new field added for service creation: yaml.

  • yaml is not mandatory for service object creation.

  • When creating a service without yaml defined, the Terraform Provider creates a skeleton service that cannot be used for immediate deployment.

  • The yaml field defines the actual definition of the service so it can be used in a pipeline for deployment.


Environments

The following changes apply to v2 environments:

  • Environments are now standalone objects with global environment variables and manifest configurations.

  • V2 Environment Service Overrides and Environment Variables can override service variables when the service is deployed into a given environment. Based on the variable name, Harness can override the service variable with the environment variable value.

  • Harness has introduced service-specific environment overrides where users can define specific services and variables they want to override for a given environment.

  • For details on environments v2, go to Environments overview.

Environment groups

V2 introduces environment groups. You can now aggregate environments and manage them at scale.

Environment groups are simply a list of environments. You can deploy to a subset of environments within the group or to all of them.

For details on environment groups, go to Create environment groups.

Environment YAML updates

Environment REST API updates

When creating a service via the Harness REST API, there is a new environment endpoint.

Here are a few important details:

Environment REST Request changes


Terraform Provider

Review the changes to the Harness Terraform Provider environment resource.

New Terraform Provider environment resource


Infrastructure definition

Harness took the infrastructure definition that was originally defined in the pipeline and moved it to the environment. Go to Environments overview to learn about infrastructure definitions in v2.

Here are the changes to infrastructure definition:

  • The infrastructure definition can be associated with one environment only.

  • The infrastructure definition is required to run a pipeline execution.

  • Users now need to pick an environment and infrastructure definition.

The infrastructure definition configuration now contains:

  • Name, Description, Tag, Deployment Type.

  • Connector details.

  • Deployment target details.

Infrastructure definition YAML updates

V2 has the following infrastructure definition changes:

  • The infrastructure definition is now a standalone object not defined in a pipeline.

  • When configuring the infrastructure definition you will associate the infrastructure definition with the environment where you want to use it. For example, the actual cluster in the environment where you want to deploy.

Infrastructure definition Terraform Provider

Harness has released a new Terraform Provider resource for infrastructure definitions.

New Terraform Provider infrastructure definition resource


Stages

The stage definition changed when the service and environment v2 update was enabled.

Stages now have a deployment type, a service reference, an environment reference, and an infrastructure definition. These settings must be defined along with the Execution steps of the stage.


Pipelines

The following changes applied to pipelines:

  • The pipeline entity changes with the service and environment v2 update.

  • The combination of service, environment, and infrastructure definitions are no longer defined in the pipeline. These entities are now managed outside of the pipeline.

  • Pipelines use identifiers to reference the service, environment, and infrastructure definitions used in the pipeline.

  • Each stage now has a reference to the service, environment, and infrastructure definition entities.

Sample v2 pipeline YAML


Templates

The following changes applied to v2 templates:

  • Templates are impacted by the service and environments v2 update.

  • Your existing templates in the service and environments v1 experience will run until v1 EOL (see Important dates).

  • When migrating to v2 service and environments, you must create a new stage template that references the v2 service and environment.

Sample stage template


Migrating from v1 services and environments to v2

The user(s) running the APIs for migration must have had standard Harness RBAC permissions to update pipelines, services, environments, and templates (if used).

To support automated migration of services and environments, Harness created two APIs.

The APIs copy over the v1 serviceDefinition from a pipeline stage and update the existing service with this serviceDefinition.

The APIs also create an infrastructure definition by using the details from the infrastructure.infrastructureDefinition in the YAML of the pipeline stage.

Regardless of whether the pipeline uses templates, the API updates the pipeline YAML also.

Pipeline migration

The API will migrate services and environments for all CD stages that exist in a pipeline. It can update pipeline YAML also (optional). The API will migrate the CD stages of a pipeline to v2 one by one.

Sample cURL command for pipeline level migration

The <base_url> is usually app.harness.io.

Sample response for pipeline level migration API

Input fields for account level migration

  • Authorization. The auth bearer token. It can be extracted from header of network calls from the browser after logging into Harness.

  • accountIdentifier. The user account identifier.

  • orgIdentifier. Organization identifier of the pipeline you want to migrate.

  • projectIdentifier. Project identifier of the pipeline you want to migrate.

  • infraIdentifierFormat. The format for the infrastructure definition identifier. Harness will replace the expressions in this string with actual values and use it as an identifier to create an infrastructure definition.

  • templateMap. Mapping of source template to target template.

    • source template. This refers to a stage template that exists in a CD stage's YAML.

    • target template. This refers to a stage template that replaces the existing source template in a CD stage's YAML.

    • skipInfras. The list of infrastructure identifiers to skip during migration. This allows you to omit infrastructures you don't want to upgrade.

    • skipServices. The list of service identifiers to skip during migration. This allows you to omit services you don't want to upgrade.

    • isUpdatePipeline. The pipeline YAML is updated with the new service and environment framework if this label is true. Otherwise, the pipeline YAML is not updated.

Output fields for account level migration

  • failures. List of causes for migration failure.

  • pipelineYaml. Updated pipeline YAML with new service and environment framework.

  • migrated. This is true if the pipeline was updated. Otherwise it is false.

Project level migration

The API will migrate services and environments for all existing pipelines in a project. It can update pipeline YAML also.

Sample request for project level migration API

The <base_url> is usually app.harness.io.

Sample response for project level migration request

Additional input fields for project level migration request

  • skipPipelines. The list of pipeline identifiers to skip during migration. If you don't want to migrate a pipeline, then add the pipeline identifier to this list.

Output fields for project migration

  • failures. List of causes for migration failure.

  • migrated. This is true if the pipeline was updated. Otherwise it is false.


This migration completed in 2023. All Harness accounts now use service and environment v2.

Last updated

Was this helpful?