Run Hooks only if condition is met #17992
Unanswered
JoaoPedroAssis
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi guys!
I currently have a large Ruby on Rails app successfully deployed in argocd. I have 3 main deployments, and all three depend on database migrations. My sync process contains a
PreSync
hook (delete policy ofBeforeHookCreation
) that performs the migrations before the pods are brought up.My pods have a initContainer that runs a rails task called
abort_if_pending_migrations
, preventing the container to start if there are pending migrations. When there is none, the task exits with 0.My issue is that not every Sync needs migrations, and it is executed anyway. Since the initContainer will not prevent pods to start in this case, is there a way to run the migrations only if they are needed? I used to manually apply a job yaml file to do this, but I prefer argos declarative way of things
Beta Was this translation helpful? Give feedback.
All reactions