argoproj / gitops-engine

Democratizing GitOps
https://pkg.go.dev/github.com/argoproj/gitops-engine?tab=subdirectories
Apache License 2.0
1.7k stars 260 forks source link

feat: Add sync-dependencies #514

Open alexec opened 1 year ago

alexec commented 1 year ago

Depended on by argo-cd#3517

This PR introduces a new feature: sync dependencies.

Sync dependencies give a new way to order sync operations that is influenced by sync waves and sync hooks (all of which I wrote, so I know it extremely well).

Like sync waves, a sync operation will only progress when all the dependents have completed.

Dependencies between objects is specified by the new argocd.argoproj.io/sync-dependencies annotation.

# The dependencies are specified as a comma-separated list of objects.
# The format of each object is <group>/<kind>/<namespace>/<name>
# The group and kind are optional. If not specified, they'll match any group or kind.
# The namespace is optional. If not specified, the namespace is assumed to be the same as the namespace of the object.
# The name is required.
argocd.argoproj.io/sync-dependencies: a,b,c

Reasons to do this:

Reasons not to do this:

Open questions:

codecov[bot] commented 1 year ago

Codecov Report

Attention: 7 lines in your changes are missing coverage. Please review.

Comparison is base (ed70eac) 55.75% compared to head (745fb5a) 55.61%. Report is 18 commits behind head on master.

:exclamation: Current head 745fb5a differs from pull request most recent head de3f8c9. Consider uploading reports for the commit de3f8c9 to get more accurate results

Files Patch % Lines
pkg/sync/sync_context.go 64.28% 4 Missing and 1 partial :warning:
pkg/sync/sync_tasks.go 94.73% 1 Missing and 1 partial :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #514 +/- ## ========================================== - Coverage 55.75% 55.61% -0.15% ========================================== Files 41 42 +1 Lines 4525 4531 +6 ========================================== - Hits 2523 2520 -3 - Misses 1808 1817 +9 Partials 194 194 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

sonarcloud[bot] commented 1 year ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 3 Code Smells

No Coverage information No Coverage information
8.0% 8.0% Duplication

sonarcloud[bot] commented 8 months ago

Quality Gate Passed Quality Gate passed

Issues
3 New issues

Measures
0 Security Hotspots
No data about Coverage
8.0% Duplication on New Code

See analysis details on SonarCloud