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

chore: initial support for tilt based development (#22337)

Open FourFifthsCode opened this issue 7 months ago • 20 comments

This PR is an initial proof of concept for supporting tilt.dev tooling for local development of ArgoCD. Features and motivation mentioned in #22337

Quoted proposal motivation in initial docs docs/developer-guide/tilt.md

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.
  • [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
  • [ ] 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.
  • [X] Does this PR require documentation updates?
  • [ ] I've updated documentation as required by this PR.
  • [X] 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.
  • [x] 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).

FourFifthsCode avatar May 15 '25 19:05 FourFifthsCode

:x: Preview Environment deleted from Bunnyshell

Available commands (reply to this comment):

  • :rocket: /bns:deploy to deploy the environment

bunnyshell[bot] avatar May 15 '25 19:05 bunnyshell[bot]

After some more debugging, I was able to login to UI. But my CLI still refuses to conecct to the server.

nitishfy avatar May 16 '25 06:05 nitishfy

Tried to deploy an application and this is what I got Screenshot 2025-05-16 at 2 29 39 PM

If I'm missing something, I think this must be well documented too.

nitishfy avatar May 16 '25 08:05 nitishfy

After some more debugging, I was able to login to UI. But my CLI still refuses to conecct to the server.

I ended up moving UI to container and removed server.insecure: true, I think this might fix that

FourFifthsCode avatar May 16 '25 16:05 FourFifthsCode

Tried to deploy an application and this is what I got Screenshot 2025-05-16 at 2 29 39 PM

If I'm missing something, I think this must be well documented too.

Added missing cluster-rbac

FourFifthsCode avatar May 16 '25 16:05 FourFifthsCode

I wonder if we could also use Tilt to spin up the e2e test environment. Basically make start-e2e-local

crenshaw-dev avatar May 19 '25 14:05 crenshaw-dev

I wonder if we could also use Tilt to spin up the e2e test environment. Basically make start-e2e-local

tilt does have a 'ci' mode that might be useful for this: https://docs.tilt.dev/ci.html

FourFifthsCode avatar May 19 '25 17:05 FourFifthsCode

image

I think all these should be independent. lint-ui shouldn't depend on lint, and all the other components shouldn't depend on lint. Even if lint fails, API server should still be able to run.

crenshaw-dev avatar May 20 '25 19:05 crenshaw-dev

Can we make linting a manually triggered step- available only as a convenience? I agree that nothing should depend on it.

devopsjedi avatar May 20 '25 21:05 devopsjedi

I like the idea of early feedback for linting failures, but yeah if that requires making it a prereq to other stuff, we should just make it on-demand instead.

crenshaw-dev avatar May 20 '25 23:05 crenshaw-dev

I'm getting errors like this fairly often:

Reconnecting... Error port-forwarding argocd-ui (4000 -> 4000): error upgrading connection: pods "argocd-ui-74c4687d94-cczjj" not found

crenshaw-dev avatar May 21 '25 22:05 crenshaw-dev

We should probably go mod vendor before go lint, either in makefile or in tiltfile

crenshaw-dev avatar May 22 '25 16:05 crenshaw-dev

I'm getting errors like this fairly often:

Reconnecting... Error port-forwarding argocd-ui (4000 -> 4000): error upgrading connection: pods "argocd-ui-74c4687d94-cczjj" not found

might be something in your kube environment causing pod to not be ready

FourFifthsCode avatar May 22 '25 19:05 FourFifthsCode

We should probably go mod vendor before go lint, either in makefile or in tiltfile

we could watch the go.mod and go.sum files and the auto run when those change.. independant from other tasks

FourFifthsCode avatar May 22 '25 19:05 FourFifthsCode

@crenshaw-dev @devopsjedi Tilt will try and optimize tasks to stack so that a bunch of parallel tasks don't overrun you system, but you can toggle that off by adding: allow_parallel=True

I added that to build and linting resources which I think gives us the best of both worlds, we get visual representation of linting errors in ui without slowing down build substantially.

I also added a resource to watch go.mod and go.sum files to run vending

FourFifthsCode avatar May 22 '25 20:05 FourFifthsCode

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 59.95%. Comparing base (7496ede) to head (c72dc20). :warning: Report is 472 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #23002      +/-   ##
==========================================
+ Coverage   59.94%   59.95%   +0.01%     
==========================================
  Files         342      342              
  Lines       58605    58605              
==========================================
+ Hits        35129    35139      +10     
+ Misses      20628    20617      -11     
- Partials     2848     2849       +1     

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

codecov[bot] avatar May 22 '25 21:05 codecov[bot]

Running the tilt down deletes the resources. This means if we are using the default namespace i.e argocd for development purposes, we should never perform the tilt down except in some circumstances. I think this is wroth mentioning in the docs so people don't end up doing tilt down to clean up the resources.

nitishfy avatar May 26 '25 17:05 nitishfy

Tested it locally and this is running perfectly well. Can we have a make cli-local option too?

Totally! Just added button for that

FourFifthsCode avatar May 27 '25 14:05 FourFifthsCode

Running the tilt down deletes the resources. This means if we are using the default namespace i.e argocd for development purposes, we should never perform the tilt down except in some circumstances. I think this is wroth mentioning in the docs so people don't end up doing tilt down to clean up the resources.

Yeah, would make sense to call this out for sure

FourFifthsCode avatar May 27 '25 14:05 FourFifthsCode

FYI https://github.com/argoproj/argo-cd/issues/23224

nitishfy avatar Jun 02 '25 11:06 nitishfy

@nitishfy added example for Goland debugging

FourFifthsCode avatar Jun 04 '25 21:06 FourFifthsCode

Can we add port forwarding for metrics services on each component?

crenshaw-dev avatar Jun 05 '25 03:06 crenshaw-dev

Can we add port forwarding for metrics services on each component?

metrics ports added and docs updated!

FourFifthsCode avatar Jun 05 '25 14:06 FourFifthsCode

For the docs, there's already another issue created and someone is already working on it.

nitishfy avatar Jun 17 '25 15:06 nitishfy