> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/continuous-delivery/use-gitops/pr-pipelines/pr-pipeline-application-set.md).

# ApplicationSets and PR Pipeline

Learn how to create GitOps applications via ApplicationSet through a Harness PR Pipeline.

ApplicationSet is an Argo CD feature that automates the creation and management of multiple applications from a single configuration. It enables dynamic application creation based on template-driven definitions. In our case, the ApplicationSet will detect the new environment configuration in the repo and automatically instantiate a new application with the desired configuration.

This approach ensures consistency, reduces manual effort, and enables streamlined deployments across environments using a GitOps-driven workflow.

***

## What you will learn from this topic

* **ApplicationSet overview:** How ApplicationSet automates multi-environment application management using template-driven definitions.
* **Git generator:** How the Git generator dynamically creates Argo CD applications from `config.json` files stored in Git.
* **PR pipeline workflow:** How to use Harness PR pipeline steps (Update Release Repo, GitOps Sync, Fetch Linked Apps) to provision new environments via ApplicationSet.
* **Scenario walkthrough:** A step-by-step scenario showing configuration file creation, PR merge, and ApplicationSet sync.

***

## Understanding application set in GitOps

Go to [Application Set](/continuous-delivery/use-gitops/applicationsets/appset-basics.md) to understand how ApplicationSets work in Harness GitOps.

Harness GitOps supports multiple ways of creating an ApplicationSet:

* Git Generator
* List Generator
* Cluster Generator
* Matrix Generator
* Merge generator
* SCM Provider generator
* Pull Request generator
* Cluster Decision Resource generator
* Plugin Generator

Go to [Generator Type](https://argo-cd.readthedocs.io/en/stable/operator-manual/applicationset/Generators/) to learn about each generator type. The following sections cover creating an ApplicationSet using the Git Generator.

***

## Git generator

At its core, Argo CD's Git generator allows for dynamic creation of Argo CD Application resources from templates using parameters sourced from a Git repository. This functionality enables applications to be defined once in a template and instantiated multiple times with different configurations. The Git generator ensures version control and traceability by pulling environment or application-specific configurations directly from a Git repository.

While the Git generator supports various methods, one of its standout features is the file-oriented approach, specifically using `config.json` files.

**Benefits of using a Git generator**

* **Arbitrary key updates:** With the file version of the Git generator, users can define key-value pairs in `config.json` that directly overrides or supplements values in the target application's configuration. This provides flexibility in updating configurations without altering the core template.
* **Decoupling configuration from template:** By using a separate `config.json` for overrides, the core application template remains untouched. This separation ensures that base configurations are consistent, reducing errors and ensuring that changes are traceable to specific configuration files.
* **Version control and auditability:** Since configurations are stored in Git, every change to `config.json` is versioned. This provides a clear audit trail, making it easy to track when a configuration change was made and by whom.
* **Dynamic application generation:** The Git generator, especially with `config.json` files, allows for the dynamic creation of applications based on varying configurations. For instance, you can have a base template for a microservice but instantiate it differently for development, staging, and production environments using different `config.json` files.
* **Centralized management:** Storing all `config.json` files in a single Git repository or organized structure ensures centralized management. Teams can collaboratively update configurations, propose changes through pull requests, and review configurations collectively.

***

## PR pipeline workflow

To help you get started with creating applications using ApplicationSet through PR pipelines in Harness, we have provided a working [sample](https://github.com/harness-community/Gitops-Samples/tree/main/Application-Set).

### Scenario

We have multiple environments, and we want to deploy an application with a unique configuration for each new environment. Using a PR pipeline, we will:

* **Create a new configuration file** for the target environment using **Update Release Repo**, specifying any necessary application-specific changes.
* **Merge the PR:** The pipeline pauses until the PR is reviewed and merged through your Git provider. Enable **Wait for PR merge** on the Update Release Repo step to use this flow. The PR approval in your Git provider acts as the deployment gate, so no separate Approval or Merge PR step is needed. Go to [PR-based promotion workflows](/continuous-delivery/use-gitops/pr-pipelines/pr-pipelines-basics.md#pr-based-promotion-workflows) to learn more.
* **Sync the ApplicationSet** using **GitOps Sync step**, which detects the new configuration and dynamically generates a new Harness GitOps application for the environment.
* **Fetch the Linked Application** using **Fetch Linked Apps step** to check the new application created.

***

## Next steps

Using ApplicationSets with Harness GitOps PR Pipelines enables a scalable way to manage multi-environment deployments. By leveraging Argo CD's Git generator and Harness pipeline steps, you can dynamically provision new environments, reduce manual overhead, and ensure consistency across deployments.

The following resources will help you put this into practice:

* [ApplicationSet basics](/continuous-delivery/use-gitops/applicationsets/appset-basics.md): Review the core ApplicationSet concepts and supported generators.
* [PR pipeline basics](/continuous-delivery/use-gitops/pr-pipelines/pr-pipelines-basics.md): Understand the full PR pipeline workflow and available steps.
* [Harness GitOps basics](/continuous-delivery/use-gitops/get-started/harness-git-ops-basics.md): Review foundational GitOps concepts in Harness.

{% @harness-feedback/feedback %}
