January 16, 2025

How to Create Multi Source Applications with Harness GitOps

Table of Contents

Harness GitOps continues to evolve to meet the needs of modern DevOps teams. With the recent introduction of multi-source application support, you can now configure and manage applications that pull from multiple repositories seamlessly. This feature enables teams to consolidate resources from various sources into a single application, enhancing flexibility and streamlining workflows.

Harness GitOps continues to evolve to meet the needs of modern DevOps teams. With the recent introduction of multi-source application support, you can now configure and manage applications that pull from multiple repositories seamlessly. This feature enables teams to consolidate resources from various sources into a single application, enhancing flexibility and streamlining workflows.

Let’s explore what this feature entails and how you can leverage it.

What is Multi-Source Application Support?

Multi-source application support allows you to configure a single application to draw from multiple repositories. Whether you're dealing with separate repositories for manifests, Helm charts, or configuration files, this feature makes it easy to bring them together under one roof.

Here’s a quick rundown of how it works:

  • Beta Feature: This capability is in beta and requires enabling the feature flag GITOPS_MULTI_SOURCE_ENABLED. Contact Harness Support to activate it
  • Supported Harness GitOps Versions: This feature is supported starting from GitOps Version 1.23.0 and GitOps Agent Version 0.83.0 .
  • Supported by ArgoCD 2.6: The feature is built on ArgoCD's multi-source functionality, ensuring compatibility with industry-leading GitOps practices.
  • Application Flexibility: Add multiple sources, designate reference repositories, and choose specific sources during synchronization.

Creating an Application with Multiple Sources

Configuring a multi-source application is straightforward. Follow these steps to set it up:

1. Enable Multi-Source Support

Ensure that the feature flag GITOPS_MULTI_SOURCE_ENABLED is activated by contacting Harness Support.

2. Add the Application

Follow the instructions to add a Harness GitOps Application in our docs.
During that process you will be asked to add a source. At that step do the following:

  • Navigate to the Source section in the application creation workflow.
  • Select the checkbox Is Multiple Source to enable multi-source configuration.

It should look like this:

3. Add Sources

  • Under Repository, choose one of two options:some text
    • Repo ID: Select this if you’ve pre-configured repositories in Harness GitOps Repositories.
    • Repo URL: Provide the repository URL directly. If the repository is private, ensure that you have a credentials template configured.
  • ⚠️ Note: Once you select Repo ID or Repo URL for the first source, all subsequent sources must follow the same method.
  • Select the Reference checkbox to designate a repository as a reference source. Reference sources can later be used to define values files, but they must be Git repositories (not Helm repositories).
  • Click + Add Source to include additional repositories.

4. Finalize Your Application

Complete the application setup by adding all necessary sources. Once configured, your application will be ready to sync with multiple repositories.

The application yaml will look like this after using multiple sources:

sources:
  - repoURL: https://github.com/argoproj/argocd-example-apps
    targetRevision: master
    kustomize:
      images:
        - weaveworksdemos/carts:0.4.8
        - mongo:undefined
        - weaveworksdemos/catalogue:0.3.5
        - weaveworksdemos/catalogue-db:0.3.0
        - weaveworksdemos/front-end:0.3.12
        - weaveworksdemos/orders:0.4.7
        - mongo:undefined
        - weaveworksdemos/payment:0.4.3
        - weaveworksdemos/queue-master:0.3.1
        - rabbitmq:3.6.8-management
        - kbudde/rabbitmq-exporter:undefined
        - redis:alpine
        - weaveworksdemos/shipping:0.4.8
        - weaveworksdemos/user:0.4.8
        - weaveworksdemos/user-db:0.3.0
      replicas: []
  - repoURL: https://github.com/argoproj/argocd-example-apps
    targetRevision: master
    helm:
      valueFiles:
        - values-production.yaml
        - values.yaml
      values: vals
applicationName: m1
agentId: account.ashintoarmcluster
targetRevision: master

Syncing an Application with Multiple Sources

With a multi-source application configured, you can control which sources to sync during the synchronization process. Here’s how:

1. Default Behavior

By default, all configured sources are synced when you initiate a synchronization operation.

2. Sync a Specific Source

  • Navigate to the Applications page.
  • Click the Sync button in the top-right corner.
  • In the sync dialog, under Synchronizing application manifest from, select the desired source tab.
  • Enable the Sync Source checkbox for the chosen source. The active source tab will be highlighted in green, indicating it is ready to sync.

This selective sync feature allows you to control which components of your application are updated during each operation.

For a more in depth look at syncing your applications, please go to our docs on Syncing GitOps Applications.

Updating Sources

When the GITOPS_MULTI_SOURCE_ENABLED feature flag is enabled, the Update GitOps App step becomes compatible with multi-source applications:

  • Application Selection: Choose your multi-source application in the Application field. This populates the step with all configured sources.
  • Source Updates: Update each source individually, just as you would with a single-source application.
  • Helm Overrides: Provide Helm parameters, file parameters, or values files as needed. Existing parameters are merged with new values from the pipeline, with pipeline-provided values taking precedence if conflicts arise.

Once your multi-source application is updated, you can use the GitOps Sync step to deploy the changes and synchronize your application state with the repositories.

Get Started Today

The ability to configure applications with multiple sources opens new doors for teams leveraging Harness GitOps. If you're ready to explore this beta feature, contact Harness Support to enable the GITOPS_MULTI_SOURCE_ENABLED flag and start experimenting with multi-source applications.

For detailed instructions and best practices, check out the Support for Multiple Sources documentation.

With multi-source support, Harness GitOps continues to empower teams with the tools they need for streamlined, efficient, and powerful application management. Give it a try and unlock the potential of your multi-repository workflows!

See Also

Use these resources to learn more about and get started with Harness GitOps:

You might also like
No items found.
Continuous Delivery & GitOps