Skip to content

Conversation

@Elyytscha
Copy link

@Elyytscha Elyytscha commented Dec 1, 2025

feat(hydrator): support different repository for syncSource

Summary

This PR extends the Source Hydrator feature to support hydrating manifests to different Git repositories, not just different branches within the same repository. This enables users to maintain clean separation between their DRY source repositories and dedicated GitOps repositories for rendered manifests.

Changes

Core Functionality

  • Added repoURL field to SyncSource: Allows specifying a different repository for syncing hydrated manifests. If not set, defaults to DrySource.RepoURL.

Implementation Details

  • Updated GetSyncSource() method: Now respects the SyncSource.RepoURL field instead of always using DrySource.RepoURL.
  • Enhanced hydration queue key: Added DestinationRepoURL field to HydrationQueueKey to ensure proper deduplication when multiple applications hydrate to different repositories.
  • Improved validation:
    • Validates that destination repositories are permitted in the application's project
    • Updated duplicate path detection to use a combination of repository URL and path for uniqueness
  • Updated metadata retrieval: Commit metadata is now retrieved from the dry source repository, not the destination repository.

Documentation

  • Added comprehensive documentation in docs/user-guide/source-hydrator.md:
    • Explained how to hydrate to different repositories
    • Provided example for syncSource with different repositories
    • Documented path resolution and fallback behavior
    • Added notes about credential requirements for different repositories

API & Schema Changes

  • Updated CRDs: Added repoURL and path fields to SyncSource in both Application and ApplicationSet CRDs
  • Updated Protobuf definitions: Regenerated protobuf code to include new fields
  • Updated Swagger documentation: Reflected new API fields in OpenAPI spec

UI & CLI

  • Updated UI models: Added support for new fields in TypeScript models
  • Updated CLI documentation: Added examples showing how to use different repositories in command documentation

Testing

  • Added unit tests: Enhanced hydrator tests to cover repository resolution logic and validation

Use Cases

This feature enables several important use cases:

  1. Separate GitOps repositories: Keep DRY source manifests in one repository and push rendered manifests to a dedicated GitOps repository
  2. Multi-repository workflows: Different teams can maintain their DRY sources in separate repositories while all pushing to a shared GitOps repository

Example Configuration

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: my-app
spec:
  sourceHydrator:
    drySource:
      repoURL: https://github.com/org/app-configs
      path: apps/my-app
      targetRevision: main
    syncSource:
      repoURL: https://github.com/org/gitops-manifests
      targetBranch: main
      path: apps/my-app

Breaking Changes

None. All new fields are optional and maintain backward compatibility with existing configurations.

Migration

No migration required. Existing applications will continue to work as before, with SyncSource defaulting to the DrySource repository URL when not explicitly specified.

Closes [ISSUE #22719]

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • The title of the PR conforms to the Title of the PR
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • I have signed off all my commits as required by DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My build is green (troubleshooting builds).
  • My new feature complies with the feature status guidelines.
  • I have added a brief description of why this PR is necessary and/or what this PR solves.
  • Optional. My organization is added to USERS.md.
  • [] Optional. For bug fixes, I've indicated what older releases this fix should be cherry-picked into (this may or may not happen depending on risk/complexity).

@Elyytscha Elyytscha requested review from a team as code owners December 1, 2025 20:58
@bunnyshell
Copy link

bunnyshell bot commented Dec 1, 2025

🔴 Preview Environment stopped on Bunnyshell

See: Environment Details | Pipeline Logs

Available commands (reply to this comment):

  • 🔵 /bns:start to start the environment
  • 🚀 /bns:deploy to redeploy the environment
  • /bns:delete to remove the environment

Copy link
Member

@crenshaw-dev crenshaw-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Added one top-level question.

@crenshaw-dev crenshaw-dev added this to the v3.3 milestone Dec 1, 2025
@Elyytscha
Copy link
Author

@crenshaw-dev did you maybe forgot to send the question? because I can't find it for now..

Regarding the E2E tests, I’m still not sure why they’re failing in this way.

The only regression I’ve noticed so far during testing is that when hydrating to another repository, the commit hash added to the commit message is no longer rendered as a link.
image
https://github.com/devops-magic/argo-cd-hydration-test-hydrated/commits/main/apps/podinfo

@crenshaw-dev
Copy link
Member

Oops! Added. afk now but I'll address your other points ASAP. 🙂

@Elyytscha Elyytscha changed the title feat(hydrator): hydrateTo and syncSource as a different repository (#22719) feat(hydrator): syncSource as a different repository (#22719) Dec 2, 2025
@codecov
Copy link

codecov bot commented Dec 2, 2025

Codecov Report

❌ Patch coverage is 94.59459% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 62.58%. Comparing base (3bf3d8a) to head (278796c).
⚠️ Report is 7 commits behind head on master.

Files with missing lines Patch % Lines
pkg/apis/application/v1alpha1/types.go 75.00% 2 Missing and 2 partials ⚠️
controller/hydrator/hydrator.go 91.30% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #25464      +/-   ##
==========================================
+ Coverage   62.49%   62.58%   +0.08%     
==========================================
  Files         351      351              
  Lines       49602    49692      +90     
==========================================
+ Hits        31001    31101     +100     
+ Misses      15631    15623       -8     
+ Partials     2970     2968       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

…and reverted to orig protobuff order and used struct as map key (#3)

Signed-off-by: Elias Rami <[email protected]>
if repoURL == "" {
repoURL = s.DrySource.RepoURL
if path == "" {
path = s.DrySource.Path
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should fall back to the dry source path if it isn't specified on the sync source. The DRY branch is likely to have a significantly different directory structure (e.g. Kustomize overlays). syncSource.path is basically a required field.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants