microscopic-river-74022
03/12/2025, 5:38 PMmicroscopic-river-74022
03/12/2025, 5:38 PMgarden cleanup deploy
.
Run actions in Garden are primarily designed to execute before other actions (like Deploys) that depend on them. As mentioned in the documentation, "Runs that have dependents (i.e. something that depends on them) are run automatically by Garden." [Using-garden > Runs]()
When you execute garden cleanup deploy
, Garden is designed to un-deploy the specified actions without considering dependencies in the same way as during deployment. The documentation states: "Note that this command does not take into account any deploys depending on the cleaned up actions, and might therefore leave the project in an unstable state." [Reference > Commands > garden cleanup deploy]()
One potential approach would be to use the disabled
configuration option conditionally. You could potentially create a template variable that indicates whether the action is being run during cleanup or deployment, and then use that to conditionally disable the Run action:
yaml
kind: Run
name: my-run
disabled: ${some.condition.for.cleanup}
...
However, the knowledge sources don't specifically mention how to detect if an action is being executed during cleanup versus deployment.
Another approach might be to make your Run action idempotent and have it check internally whether it needs to execute its logic or exit early, as suggested in the FAQ: "So what we generally do is to make sure Runs are idempotent and exit early if they shouldn't run again." [Misc > FAQ > Tests and Runs]()microscopic-river-74022
03/12/2025, 5:38 PMmicroscopic-river-74022
03/12/2025, 5:38 PM