argoproj / argo-cd

Declarative Continuous Deployment for Kubernetes
https://argo-cd.readthedocs.io
Apache License 2.0
17.58k stars 5.36k forks source link

Sync Behavior: Web UI vs. API #18903

Open lazysteel93 opened 3 months ago

lazysteel93 commented 3 months ago

Checklist:

Describe the bug

An app contains a k8s Job, that has annotations for either PreSync or PostSync. When performing normal Sync from the web UI, the job is ran. But when syncing using the API, job is not ran.

To Reproduce

  1. Add an app to Argo with some resources.
  2. Add a Job type resource to the app.
  3. Sync from web UI, and confirm job ran.
  4. Now, delete the app and resources from k8s for this app, and repeat steps #1 and #2.
  5. Sync the app using the API, ApplicationSyncRequest with v1alpha1.SyncStrategyApply strategy.
  6. Confirm that job did not run.

Expected behavior

I would expect the API sync request to also run the job.

Screenshots

Version

argocd: v2.11.3+3f344d5
  BuildDate: 2024-06-06T12:31:55Z
  GitCommit: 3f344d54a4e0bbbb4313e1c19cfe1e544b162598
  GitTreeState: clean
  GoVersion: go1.22.4
  Compiler: gc
  Platform: darwin/arm64
argocd-server: v2.10.11+27e49f8

Logs

Paste any relevant application logs here.
crenshaw-dev commented 3 months ago

Can you include the full application sync API request body?