argo-cd icon indicating copy to clipboard operation
argo-cd copied to clipboard

feat: implement source refs for helm set-file (Beta) (#13220)

Open cardoe opened this issue 10 months ago • 6 comments

In multi-source applications helm values files can come from other repos if you use the ref syntax but it is not possible for the --set-file param to take files from other repos via the ref syntax. This extends the behavior to cover set-file parameters as well as the values files. fixes #13220, refs #17822

Checklist:

  • [x] 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.
  • [x] The title of the PR states what changed and the related issues number (used for the release note).
  • [x] The title of the PR conforms to the Toolchain Guide
  • [x] I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • [x] I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • [x] Does this PR require documentation updates?
  • [x] I've updated documentation as required by this PR.
  • [x] I have signed off all my commits as required by DCO
  • [x] I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • [x] My build is green (troubleshooting builds).
  • [x] My new feature complies with the feature status guidelines.
  • [x] I have added a brief description of why this PR is necessary and/or what this PR solves.
  • [x] Optional. My organization is added to USERS.md.
  • [x] 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).

cardoe avatar Apr 23 '24 18:04 cardoe

This still needs testing added. The documentation pieces are in #17822, which I will rebase this PR on top once that lands. I'll readily admit I'm not a Go programmer so probably did some things wrong from an idiomatic standpoint. Hoping another contributor is willing to help me get this over the finish line.

cardoe avatar Apr 23 '24 18:04 cardoe

I've labeled this as beta since it's for multi-source applications which themselves are beta.

cardoe avatar Apr 25 '24 12:04 cardoe

I've set the documentation update to say the feature is available from ArgoCD 2.12+ because I'm assuming this won't make it into 2.11 since that's already in RC status.

cardoe avatar May 04 '24 17:05 cardoe

So I pushed once to confirm the test failed. And the most recent test confirms the test passes.

cardoe avatar May 04 '24 18:05 cardoe

@cardoe I can't open a PR against your branch, not sure why.

I added one commit at https://github.com/morremeyer/argo-cd/commit/aa090e2112b3e4cf88bffa6c07e5abab8cdc9e74 that uses slices.IndexFunc to check against all manifests, not just one.

Did not run the full test suite against it yet, feel free to add it to this PR.

morremeyer avatar May 06 '24 09:05 morremeyer

Thanks @morremeyer. I've squashed your change in since you prefixed it with fixup! and rebased the branch. Thanks for doing that!

cardoe avatar May 07 '24 22:05 cardoe

I just brought this PR up in the contributor weekly since I'd love to see it merged.

I'll build an image for this PR in our environment and will test it in our setup to verify it works as desired.

morremeyer avatar Jun 06 '24 15:06 morremeyer

I've got this patch built against 2.12.x and have been using it myself.

cardoe avatar Jun 07 '24 20:06 cardoe

Hello, Any chance of moving forward with this PR? It's a very useful feature in my opinion. Thanks

iulianivan avatar Jun 14 '24 11:06 iulianivan

I've rebased the branch and removed the documentation chunk that @morremeyer asked.

cardoe avatar Jun 15 '24 16:06 cardoe

Codecov Report

Attention: Patch coverage is 80.00000% with 4 lines in your changes missing coverage. Please review.

Project coverage is 50.24%. Comparing base (52b1b43) to head (ff604b3).

Files Patch % Lines
reposerver/repository/repository.go 80.00% 2 Missing and 2 partials :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #17941      +/-   ##
==========================================
+ Coverage   50.23%   50.24%   +0.01%     
==========================================
  Files         312      312              
  Lines       42969    42984      +15     
==========================================
+ Hits        21584    21598      +14     
  Misses      18907    18907              
- Partials     2478     2479       +1     

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

codecov[bot] avatar Jun 15 '24 17:06 codecov[bot]

I've rebased once again and attempted to add a test that checks for failure not just the happy path.

cardoe avatar Jun 16 '24 06:06 cardoe

We have now built ArgoCD with this PR and are running it on our infrastructure for this week to validate the feature and observe performance.

I'll report back about that on Friday.

morremeyer avatar Jun 19 '24 12:06 morremeyer

This has worked very well in our setup, from my point of view this PR is ready to be merged.

Thanks @cardoe for contributing this, we'll be very happy to see it released!

@crenshaw-dev Thanks for your feedback in the Contributor sync, as discussed then, we tested it in our infrastructure with success.

morremeyer avatar Jun 21 '24 11:06 morremeyer

Could we merge and release it?

phyllipecesar avatar Jun 25 '24 13:06 phyllipecesar

Like @morremeyer I'm successfully running this patch in my infra. Overall this increases test coverage. I know the codecov says there's some partials and missed tests but that's cause the calls to pathutil.ResolveValueFilePathOrUrl() aren't tested for failure. But that function is tested elsewhere so I didn't think it'd be worth the increased cycles.

cardoe avatar Jun 30 '24 14:06 cardoe

hi @morremeyer, the PR looks in a good shape 🤩, do you know if there is any news on this feature being accepted and released?

fllaca avatar Jul 11 '24 08:07 fllaca

We're also very interested for this feature, can't wait to have it released :)

kzgrzendek avatar Jul 11 '24 09:07 kzgrzendek

At this time we're waiting on @crenshaw-dev to review it. I've pinged him about it on Slack.

cardoe avatar Jul 11 '24 16:07 cardoe

this is a useful feature for configmap files in non-helm repos, please review it and merge so it is available to users at large. if user acceptance test is required, then i am willing to offer my services to test the feature.

gopaljayanthi avatar Jul 17 '24 11:07 gopaljayanthi

Will this be part of v2.12.0 ??

spy16 avatar Aug 04 '24 06:08 spy16

@spy16 No, it was merged after the first RC was made, so it will not appear in v2.12.0.

We can expect it with v2.13.0 if I remember the flow correctly.

morremeyer avatar Aug 06 '24 08:08 morremeyer