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

More knobs for rollback

Open alexec opened this issue 6 years ago • 12 comments

Is your feature request related to a problem? Please describe.

When you rollback you cannot:

  1. Decide to prune resources
  2. Run hooks

Describe the solution you'd like

Provide options to do that.

alexec avatar Jul 11 '19 23:07 alexec

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Sep 09 '19 23:09 stale[bot]

No one seems to be asking for this.

alexec avatar Oct 02 '19 20:10 alexec

I was surprised that hooks do not run on rollback, and kind of baffled that nobody seems to be asking for this.

The canonical example of using hooks is to combine a deployment with a database migration and temporary maintenance page. Why isn't it relevant to show the maintenance page when rolling back? And how do people manage reverting the database migration in that case?

It is of course possible to make a new commit in git that reverts the old change and then roll forwards to it -- but surely this defeats the purpose of the rollback feature.

Have I misunderstood something?

mattbennett avatar Jun 10 '20 10:06 mattbennett

@mattbennett you are not the only one with this issue. I also was surprised to find that hooks to do not run on rollback as I run some pipelines to ensure artifacts exists before deploying them and updating ArgoCD's parameter overrides with said artifacts. There is a similar problem I have with db migrations, we would like to make the migration process also be able to revert but this prevents us from doing it with ArgoCD.

kbambridge avatar Feb 16 '21 23:02 kbambridge

I really want to update this feature why you don't start about it ?

Hi! The same problems with the db migrations and hooks.

pluksha avatar Jun 24 '22 14:06 pluksha

Adding my voice to the requests for this feature. I update a CDN in a hook and on a rollback, I want the hook to run and update the CDN to the appropriate JS/CSS for the application code that's being deployed.

endophage avatar Jul 26 '22 16:07 endophage

Same for DB ! I Just jumped into GitOps and seem's like Hooks are not triggered during Rollback !

acuD1 avatar Jun 15 '23 13:06 acuD1

Also adding our team to people who would benefit greatly from this.

Lots of database migration strategies could be enabled in a clean purely GitOps way if Argo had a hook for a rollback. The operation to rollback a layer of migration is different than just applying the previous layer of migration. With the ability to differentiate if the new desired state is derived from rollback or from a new commit can change automatic migration behaviour in a really clean manner that aligns with the goals of Argocd as a whole.

nc-jhk avatar Jul 18 '23 10:07 nc-jhk

I, too, was very surprised there's no way to hook into a rollback event. I have an app that needs to tell a CDN to invalidate its cache on every deployment, and I expected a PostSync hook run on sync and rollback. It doesn't run on rollback, which leaves the CDN caching resources which were rolled back and no longer exist.

I haven't been able to find a workaround in ArgoCD for this problem.

I really like the suggestions in #355 to adopt helm's chart hooks, adding pre- and post- hooks for install, upgrade, rollback, and delete. I could add annotations to the CDN cache invalidation job to run on PostUpgrade and PostRollback.

mildmojo avatar Apr 24 '24 17:04 mildmojo

My advice would be to migrate the hooks to sync waves. It's been 5 years.

AndresPinerosZen avatar May 08 '24 07:05 AndresPinerosZen

My advice would be to migrate the hooks to sync waves. It's been 5 years.

@AndresPinerosZen Unfortunately, sync waves can't trigger jobs, they only determine the order that resources are synced. Hooks are the only way to trigger a job on sync, and they don't work on rollback.

A coworker was looking into using Argo Notifications to watch the ArgoCD Application resource state for changes during a sync or rollback, then trigger a webhook that calls an AWS Lambda function that talks to the CDN and clears the cache. I'm not sure if those state changes were detailed enough to work for this, though. Definitely a Rube Goldbergian solution, but that's the kind of desperation that rollback hooks would solve.

mildmojo avatar May 08 '24 20:05 mildmojo